Skip to content
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

Can't build on Ubuntu 13.04 #42

Closed
fcorrea opened this issue Aug 6, 2013 · 9 comments
Closed

Can't build on Ubuntu 13.04 #42

fcorrea opened this issue Aug 6, 2013 · 9 comments

Comments

@fcorrea
Copy link

fcorrea commented Aug 6, 2013

After trying to install it on Ubuntu, the only way I could find was to change the cgo line in glfw.go to look like this:

//#cgo linux LDFLAGS: -lglfw3 -lGL -lm -lGLU -lX11 -lXi -lXxf86vm -lXrandr

Maybe it should be possible to use a cgo pkg-config instead of that line. Haven't tried though

@dmitshur
Copy link
Member

dmitshur commented Aug 6, 2013

Did you have a static or dynamic glfw3 library?

It used to be the case that you needed dynamic, but that seems to be changing over time.

@fcorrea
Copy link
Author

fcorrea commented Aug 6, 2013

Quite frankly, no idea. I grabbed the glfw3 sources, generated the make files, compiled and installed. Not sure what's the default there.
In this case it seems to be dynamic since I had to link all the other libraries, correct?

@tapir
Copy link
Member

tapir commented Aug 6, 2013

Use cmake -DBUILD_SHARED_LIBS=ON.

Right now we're only using static lib on mac os because of the mentioned
reasons in that issue.

Most linux distributions come with the dyanmic library.
On Aug 6, 2013 7:31 AM, "Fernando Correa Neto" notifications@github.com
wrote:

Quite frankly, no idea. I grabbed the glfw3 sources, generated the make
files, compiled and installed. Not sure what's the default there.
In this case it seems to be dynamic since I had to link all the other
libraries, correct?


Reply to this email directly or view it on GitHubhttps://github.com//issues/42#issuecomment-22157798
.

@tapir tapir closed this as completed Aug 6, 2013
tapir added a commit that referenced this issue Aug 6, 2013
Related to #42 and #39
@ghost
Copy link

ghost commented Nov 9, 2013

I used cmake -DBUILD_SHARED_LIBS=ON. Still could not go install.
Do the trick as fcorrea mentioned, go install ok.

Is there any method one could tell whether the compiled libglfw.so and libglfw3.a is static or dynamic?
Thanks.

@tapir
Copy link
Member

tapir commented Nov 9, 2013

*.so = shared object
*.a = static library

can you try to do this:

export LD_LIBRARY_PATH="/path/to/libglfw.so/"
go build github.com/go-gl/glfw3

@ghost
Copy link

ghost commented Nov 9, 2013

It's weird.

I do have those .so files:

:/usr/local/lib$ ls
cmake libglfw.so libglfw.so.3.0 python2.7 site_ruby
libglfw3.a libglfw.so.3 pkgconfig R x86_64-linux-gnu

Still cannot build.

export LD_LIBRARY_PATH="/usr/local/lib/libglfw.so/"
go build github.com/go-gl/glfw3

I rm -rf the glfw3 directory, and go get again, still those errors:

github.com/go-gl/glfw3

/usr/local/lib/libglfw3.a(context.c.o): In function parseGLVersion': context.c:(.text+0x53): undefined reference toglGetString'
/usr/local/lib/libglfw3.a(context.c.o): In function _glfwRefreshContextAttribs': context.c:(.text+0x907): undefined reference toglGetIntegerv'
context.c:(.text+0x98a): undefined reference to glGetIntegerv' context.c:(.text+0x9df): undefined reference toglGetIntegerv'
context.c:(.text+0xa32): undefined reference to glGetIntegerv' /usr/local/lib/libglfw3.a(context.c.o): In functionglfwExtensionSupported':
context.c:(.text+0xd59): undefined reference to glGetString' context.c:(.text+0xd93): undefined reference toglGetIntegerv'
/usr/local/lib/libglfw3.a(gamma.c.o): In function glfwSetGamma': gamma.c:(.text+0x182): undefined reference topow'
/usr/local/lib/libglfw3.a(window.c.o): In function glfwCreateWindow': window.c:(.text+0x6f8): undefined reference toglClear'
/usr/local/lib/libglfw3.a(x11_clipboard.c.o): In function writeTargetToProperty': x11_clipboard.c:(.text+0x112): undefined reference toXChangeProperty'
x11_clipboard.c:(.text+0x238): undefined reference to XChangeProperty' x11_clipboard.c:(.text+0x2ad): undefined reference toXChangeProperty'
x11_clipboard.c:(.text+0x2b9): undefined reference to XFree' x11_clipboard.c:(.text+0x2f3): undefined reference toXInternAtom'
x11_clipboard.c:(.text+0x331): undefined reference to XChangeProperty' x11_clipboard.c:(.text+0x3d1): undefined reference toXChangeProperty'
/usr/local/lib/libglfw3.a(x11_clipboard.c.o): In function _glfwHandleSelectionRequest': x11_clipboard.c:(.text+0x50e): undefined reference toXSendEvent'
/usr/local/lib/libglfw3.a(x11_clipboard.c.o): In function _glfwPushSelectionToManager': x11_clipboard.c:(.text+0x57e): undefined reference toXConvertSelection'
x11_clipboard.c:(.text+0x59e): undefined reference to XCheckIfEvent' /usr/local/lib/libglfw3.a(x11_clipboard.c.o): In function_glfwPlatformSetClipboardString':
x11_clipboard.c:(.text+0x662): undefined reference to XSetSelectionOwner' x11_clipboard.c:(.text+0x67b): undefined reference toXGetSelectionOwner'
..... and more

@tapir
Copy link
Member

tapir commented Nov 9, 2013

It should be

export LD_LIBRARY_PATH="/usr/local/lib/"

But if you don't want to do this everytime you're using glfw3, you can configure glfw with -DCMAKE_INSTALL_PREFIX=/usr when running cmake. Then it will install everything under /usr/lib which should be automatically found by cgo.

@ghost
Copy link

ghost commented Nov 9, 2013

export still has no effect:

export LD_LIBRARY_PATH="/usr/local/lib/"

I make the glfw3 with the option as you told, everything is ok now.

cmake .. -DCMAKE_INSTALL_PREFIX=/usr
sudo make
sudo make install

Thank you very much.

@tapir
Copy link
Member

tapir commented Nov 9, 2013

no problem

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants