-
Notifications
You must be signed in to change notification settings - Fork 123
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
Make Failing on Linux Mint #90
Comments
Just curious, can you compile a regular glfw program in C using pkg-config for linking? |
The examples in the GLFW source works, except for "heightmap" for some reason. |
According to http://stackoverflow.com/questions/5311515/gcc-fpic-option and looking at the error message it seems that the /usr/local/lib/libglfw3.a file is compiled wrongly somehow. Will try to figure out how to include the -fPIC flag when compiling GLFW. |
It works! I edited 'CMakeCache.txt' in the GLFW source to:
Recompiled and reinstalled, it now links propertly with glfw-rs |
I meant when compiling a free-standing glfw program written in C, using the instructions here: http://www.glfw.org/docs/latest/build.html#build_link_pkgconfig I want to ascertain whether it's a glfw problem or a glfw-rs problem. You shouldn't have to edit the cmake files. |
@bvssvni Try adding |
@bvssvni Did this work for you? |
I recompiled GLFW without the fPIC flag and copied one of the C examples (GLBoing) to another folder. It works with the pkg-config instructions:
glfw-rs fails with the same error message. I believe if I add the fPIC flag back to GLFW it should link properly. I can reproduce the error on my computer. It could be something about the way Rust links libraries that fails on my computer or the C compiler, but the simplest fix seems to just add fPIC to GLFW. If there is a bug in glfw-rs I have no idea of what that could be.
|
I can add my experiences here. there seems to be 2 issues, it seems that glfw's static libs do not by default include -fPIC (meaning the glfw-rs .so can not be built). However, there is also weirdness around the fact that the shared lib is named glfw, and the static lib named glfw3 (on linux. Everywhere else it is only glfw3). My fix was to add -fPIC to glfw's compile flags, then install only the static libs so that pkg-config returned 'glfw3'. Hacky but effective. |
@elmindreda Should the glfw static libs include |
@bjz, @HildarTheDorf From what I know they should not, because @HildarTheDorf That's probably because version of shared library is stored in file and, by convention, as file extension after '.so', while static libs are just archives with code objects. This also lets you easily choose which one you want to link against. |
@aiwenar I understand 'why' the filename was chosen to be different, it just causes weirdness when you have both types of library installed. Perhaps the solution would be to not build a .so out of glfw3.a, just build the .rlib? (You can't use the .so easily in a program if you use gl-rs, since gl-rs doesn't provide a .so (by default) and you can't seem to make rustc use both static and dynamic libraries at the same time. Plus the rust abi is liable to break regularly until rustc gets closer to 1.0). Maybe move the .so to a "make shared" rule? |
@HildarTheDorf Sorry, I must have misunderstood your comment. Nevertheless it's not weird to have both types installed, as it's common to include .a in development version of library in case developer would like to link it statically. As to the solution, which you are proposing, it may indeed work because it wouldn't require glfw to be present in the system while building glfw-rs, and thus leaving the choice between static and shared version of glfw to the user. What do you think about it @bjz? |
@aiwenar So you think a |
By the way, what does |
No -fPIC here. |
Is this still an issue? |
I'm a little late but I just ran into this same issue on SteamOS, compiling glfw with the line below fixed the issue.
|
I'm using OSX now, so this is no longer an issue for me. |
I suggest this can be closed? |
I've had this exact problem after upgrading to the latest Rust nightly yesterday. I think this PR is to blame: rust-lang/rust#16340 I worked around it by compiling GLFW with -fPIC as suggested by @bvssvni :
The problem occurs when using glfw-rs via Cargo, but I've also confirmed that it happens when running the glfw-rs examples. The platform is Ubuntu 14.04 64-bit:
Has anyone else experienced this problem with a current Rust nightly? |
Static libraries need to be built with |
The GLFW I used didn't come with my distribution, I compiled it myself. |
Supporting ASLR by default in their static libraries (by passing |
@thestinger Thanks for the information, that makes things clearer! I'll contact upstream later to see what they say about it. |
Also worked for me: http://stackoverflow.com/a/22063830/761648 Add the following to CMakeLists.txt:
|
GLFW |
By running 'cat /proc/version' I get:
Linux version 3.5.0-17-generic (buildd@allspice) (gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) ) #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012
The text was updated successfully, but these errors were encountered: