glfw / glfw

A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input
https://www.glfw.org
zlib License
13.08k stars 5.26k forks source link

71829a0f0de23345fecc7576a0541f6fbec78b25 breaks building with -DGLFW_USE_WAYLAND=ON -DBUILD_SHARED_LIBS=ON #1949

Closed n3rdopolis closed 3 years ago

n3rdopolis commented 3 years ago

Commit 71829a0f0de23345fecc7576a0541f6fbec78b25 breaks building glfw with

cmake -Wno-dev .. -DCMAKE_INSTALL_PREFIX=$INSTALLDIR -DCMAKE_PREFIX_PATH=$INSTALLDIR -DGLFW_USE_WAYLAND=ON -DBUILD_SHARED_LIBS=ON

on Linux, I get a bunch of linker errors

/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_get_version'
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_marshal_flags'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/sharing.dir/build.make:115: examples/sharing] Error 1
make[1]: *** [CMakeFiles/Makefile2:364: examples/CMakeFiles/sharing.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_get_version'
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_marshal_flags'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/triangle-opengl.dir/build.make:115: examples/triangle-opengl] Error 1
make[1]: *** [CMakeFiles/Makefile2:442: examples/CMakeFiles/triangle-opengl.dir/all] Error 2
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_get_version'
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_marshal_flags'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/heightmap.dir/build.make:115: examples/heightmap] Error 1
make[1]: *** [CMakeFiles/Makefile2:338: examples/CMakeFiles/heightmap.dir/all] Error 2
[ 42%] Linking C executable boing
[ 42%] Linking C executable splitview
[ 43%] Linking C executable gears
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_get_version'
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_marshal_flags'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/boing.dir/build.make:115: examples/boing] Error 1
make[1]: *** [CMakeFiles/Makefile2:286: examples/CMakeFiles/boing.dir/all] Error 2
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_get_version'
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_marshal_flags'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/splitview.dir/build.make:115: examples/splitview] Error 1
make[1]: *** [CMakeFiles/Makefile2:416: examples/CMakeFiles/splitview.dir/all] Error 2
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_get_version'
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_marshal_flags'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/gears.dir/build.make:115: examples/gears] Error 1
make[1]: *** [CMakeFiles/Makefile2:312: examples/CMakeFiles/gears.dir/all] Error 2
[ 43%] Linking C executable particles
[ 44%] Linking C executable offscreen
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_get_version'
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_marshal_flags'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/particles.dir/build.make:148: examples/particles] Error 1
make[1]: *** [CMakeFiles/Makefile2:390: examples/CMakeFiles/particles.dir/all] Error 2
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_get_version'
/usr/bin/ld: ../src/libglfw.so.3.4: undefined reference to `wl_proxy_marshal_flags'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/offscreen.dir/build.make:115: examples/offscreen] Error 1
make[1]: *** [CMakeFiles/Makefile2:468: examples/CMakeFiles/offscreen.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
elmindreda commented 3 years ago

That does look like a bug but I cannot reproduce it. What version of which distro are you on?

n3rdopolis commented 3 years ago

Debian 11, Wayland master, and my own build CMake v3.20.2

elmindreda commented 3 years ago

I set up a Debian 11 VM just now and it seems to build a shared library for Wayland just fine there. Could there be something stale in your CMake build directory? What version of the wayland-protocols package do you have installed?

n3rdopolis commented 3 years ago

Hi

Nothing should be stale in there, the scripts I have ensures a clean build. I use a new Wayland-Protocols, but since I was able to build in July, nothing breaking seems to be in there to me.

Wait, dang I think it's commit dffe203c178ecea44a0c3d52a7b62c45a6615944 that's actually the isse, and I can see that the issue is just failing to build some tests and examples, which makes a little more sense?

elmindreda commented 3 years ago

That does make more sense but I cannot reproduce it. Tried again now with wayland-protocols 1.21 from experimental.

n3rdopolis commented 3 years ago

Try with wayland master (not Wayland Protocols), I tried a few commits back, and it built. I think this was also compound with https://gitlab.freedesktop.org/wayland/wayland/-/commit/0e0274af0c9f60d2759713df136f4294054c9096 and the wayland-scanner utility

elmindreda commented 3 years ago

Please see if the wayland-atomic-marshalling-fix branch works for you.

n3rdopolis commented 3 years ago

Thanks, that worked!

elmindreda commented 3 years ago

Thank you for reporting and testing!