-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider making glfw3 Go package go-gettable by vendoring GLFW inside? #82
Comments
I tried go getting it on OS X,
But I'm sure that's easy to fix. |
Hey! Thanks for supporting this idea! From the issue you linked:
One annoying thing is that I don't think go-get will checkout Git submodules, so we actually have to commit the sources not as a submodule (which IMHO is easier to do anyway), basically just:
Note that the trailing slash in
I do agree with this, but I think it can be worth it. Since the way I did it was by actually #including the C sources and using for example
The removal of the folder is needed because it can't be added as a submodule for go-get.
Actually -- We can make build tags for any CMAKE configurable feature that we want (e.g. tell people to compile their application with Although -- the test will be finding which flags we want on what os/arch's so that we can add them and make sure they work -- for instance the linker options for
This is one reason why I think we should do it, a lot of people don't configure anything. If someone did need a configuration option, they could add an issue and we could add it, or they could even modify the build.go file themselves by just looking over GLFW's CMAKE file to see what it defines for the option they want. |
Sigh I really need to get myself some Apple. I can't verify anything just yet, but it looks like the true issue at hand could very well be a bug with Go itself as these all seem similar: https://golang.org/issue/6472 But I think that perhaps there could be a different issue at hand. Could you dump the output of |
Nah, I don't wanna make you try to debug things blindly, that wouldn't be nice. Let me look into this. It might just be an issue with independent of embedding GLFW source into glfw3. Which revision of GLFW did you use? |
In any case, it seems likely to be a cgo bug.
I can try to debug this. |
The following change makes diff --git a/native_darwin.go b/native_darwin.go
index aee8b98..126b3a5 100644
--- a/native_darwin.go
+++ b/native_darwin.go
@@ -6,10 +6,10 @@ package glfw3
//#include "glfw/include/GLFW/glfw3native.h"
import "C"
-func (w *Window) GetCocoaWindow() C.id {
+/*func (w *Window) GetCocoaWindow() C.id {
return C.glfwGetCocoaWindow(w.data)
-}
+}*/
-func (w *Window) GetNSGLContext() C.id {
+/*func (w *Window) GetNSGLContext() C.id {
return C.glfwGetNSGLContext(w.data)
-}
+}*/ It is possibly a bug in cgo related to more recent Objective-C support (or an issue with the code/usage). Wow. I still can't believe this actually works. This approach will allow glfw3 (or a version thereof) to have its own release schedule AND be go-gettable. With that, my Conception-go project becomes 100% go-gettable. :D |
I've gone ahead and added that fix for now, and I am going to submit a pull request where we can do further discussion etc.
Very good point. We can track it in the changelog so other people know it too. In emidoots@fe4551c I make mention of it in the changelog, but it's the wrong revision! I am sorry I messed up! So in emidoots@0b95038 I updated the GLFW sources to the revision actually listed in the changelog. Sorry for any confusion. Could you test again on OS X and ensure that the new GLFW sources compiler there OK? |
Confirmed to be working as of posting this. |
I think this can be closed now that #84 is merged. |
@slimsag In Also in cmake config below options are set to _ON_ by default. I don't know how cmake works so maybe we should define these also?
Edit: Can you also elaborate how wayland tag works. I don't think go has such an identifier? |
Let's continue about the issue mentioned in #8 here.
Note that, the go get works without issues, it's only when I compile another code referencing to the devel_glfw3.1 that I get below error. Quick google search shows that we may lack |
Sigh. I think it's a bug in Go: I've ran into a few issues like this before -- I think it is because Go does not use gcc for the final link on Windows yet. EDIT: Also, Mozilla has had some trouble with it too: |
I've pushed a change to my repository that defines both symbols -- It's a bit of a hack but I think it's okay:
Can you test the changes I made and see if it works well for you @tapir ? |
@slimsag |
Fix undefined symbols on Windows. See #82
Sorry -- I was wrong.
This causes the package to not compiler with mingw-w64 -- see for instance someone reporting a bug on my mirror of the package: azul3d-legacy/native-glfw#1 I've made a workaround and verified that the package now builds on windows/amd64 with both mingw32 and mingw-w64 compilers successfully, I will submit a PR shortly. |
I was on holiday and getting married, so I have to give a retroactive 👍 to this! |
Oh, and am I missing something or can this issue be closed? |
Ah yes, I forgot/got confused by the existence of the devel branch. |
Most of the currently open issues are already fixed in devel branch, and the plan was to have them get closed when the 3.1 PR is merged into master (it has a bunch of "fixes this and that" clauses). However, given that it's taking 3.1 a very long time to be released (it may very well be another year or more), and there are new legitimate issues with the latest devel branch coming up, it might be easier just to close the fixed issues and use issue tracker for issues in devel branch? Otherwise it's becoming harder to tell what issues are open and which ones are already fixed... |
Makes sense. It's getting harder to find your way around in the issue list.
|
👍 |
It might be good time to start making a development script that updates the glfw/ subfolder and writes the GLFW revision into some file, so that it's not possible to forgot to update it. Not to mention it was relatively hard to find the issue that described steps to update. For reference, it was: #82 (comment)
@slimsag was able to make the glfw3 Go package go-gettable by including GLFW sources inside. See azul3d-legacy/issues#18 (comment).
If that really works, I think it's a great idea and we should consider doing that. Either as a separate package, or simply modify glfw3 to do it.
Any reasons not to do that?
Advantages:
Disadvntages:
The text was updated successfully, but these errors were encountered: