cginternals / globjects

C++ library strictly wrapping OpenGL objects.
https://globjects.org
MIT License
539 stars 59 forks source link

Readme should mention potential problems when linking to static libraries, especially GLFW #240

Closed lethal-guitar closed 10 years ago

lethal-guitar commented 10 years ago

Trying to build glow on Linux fails with the following error message when linking against a default build of GLFW:

/usr/bin/ld: /usr/local/lib/libglfw3.a(context.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC

Linking against the shared library version of GLFW works as expected - but this requires an additional configuration step when building GLFW (GLFW builds only a static library by default). I think this should at least be mentioned in the README.

Some more details: OS: Linux Mint 16 (based on Ubuntu 13.10) Compiler: gcc 4.8.1

sbusch42 commented 10 years ago

This is a standard problem when using static libraries. On 64bit linux systems, fPIC is turned off by default when building static libraries. This means that those libraries cannot later be used in dynamic libraries. IIRC, on 32bit linux systems, fPIC was turned on by default also for static libraries.

This is not a bug in glow, but rather a bug in GLFW, or in my opinion an unfortunate default setting in gcc. However, mentioning this as a standard pitfall (applying to other static libraries as well) would be OK.

scheibel commented 10 years ago

I think this issue will get obsolete once #250 is closed. Then, the only third party dependency will be glbinding which prints such warnings during the cmake configuration step.

cgcostume commented 10 years ago

250 is closed