ballaswag / guppyscreen

A native Touch UI for 3D Printers running Klipper/Moonraker.
GNU General Public License v3.0
236 stars 25 forks source link

Static linking fails when building for x86_64 #110

Open krakpot opened 4 months ago

krakpot commented 4 months ago

I've been trying to get everything to compile for x86_64 under Ubuntu 22.04. AFAIK I've followed the instructions in DEVELOPMENT.md but linking failed:

user@hosts:~/src/guppyscreen-ballaswag (main)$ make -j8 build

[... stuff removed ...]

/usr/bin/ld: (.text+0xc2): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: (.text+0xd1): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: (.text+0xe7): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: (.text+0xf6): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: (.text+0x10c): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: (.text+0x11b): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: (.text+0x131): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: (.text+0x140): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: (.text+0x15f): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: (.text+0x189): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: (.text+0x1ac): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: (.text+0x1bf): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libSDL2.a(SDL_waylandkeyboard.o): in function `Wayland_StopTextInput':
(.text+0x247): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: (.text+0x25d): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: (.text+0x26c): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libSDL2.a(SDL_waylandkeyboard.o): in function `Wayland_SetTextInputRect':
(.text+0x329): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: (.text+0x34c): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: (.text+0x35f): undefined reference to `wl_proxy_get_version'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libSDL2.a(SDL_waylandkeyboard.o): in function `Wayland_StartTextInput':
(.text+0x1e3): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libSDL2.a(SDL_waylandkeyboard.o): in function `Wayland_StopTextInput':
(.text+0x288): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libSDL2.a(SDL_waylandkeyboard.o): in function `Wayland_SetTextInputRect':
(.text+0x383): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libSDL2.a(SDL_waylandtouch.o): in function `Wayland_touch_create':
(.text+0x204): undefined reference to `wl_proxy_marshal_flags'
/usr/bin/ld: (.text+0x221): undefined reference to `wl_proxy_add_listener'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:132: default] Error 1

I bisect:ed and noticed that it started failing when static linking was introduced after the 0.0.26-beta release.

As a workaround to acquainted with the code (I'm a low level embedded/MCU C guy so I need to get up to speed!) I updated the Makefile so it would only do static linking when cross compiling. See (https://github.com/ballaswag/guppyscreen/compare/main...krakpot:guppyscreen:no-static-for-x86)

Is static linking supposed to work for x86_64? If so is there some dependency missing from DEVELOPMENT.md?