pantherb / setBfree

DSP tonewheel organ
http://setbfree.org
GNU General Public License v2.0
194 stars 35 forks source link

fix: add -lGL to UILIBS for non-static unix LV2 builds #84

Closed SpotlightKid closed 1 year ago

SpotlightKid commented 2 years ago

Otherwise I get undefined reference to symbol 'glXSwapBuffers' when linking b_synth UI:

cc -D_FORTIFY_SOURCE=2 -march=native -O2 -pipe -fstack-protector-strong -fno-plt -fPIC -DVERSION="\"0.8.11-5\"" -DHAVE_LV2_1_8 -DHAVE_MEMSTREAM `pkg-config --cflags glu` -I../src -I../b_overdrive -I../b_reverb -I../b_whirl -I../b_synth/ `pkg-config --cflags lv2` -DLV2SYNTH -DREQUIRE_UI -std=c99 -I.. -DFONTFILE=\"/usr/share/fonts/TTF/DejaVuSans-Bold.ttf\" `pkg-config --cflags freetype2` `pkg-config --cflags ftgl` -DHAVE_FTGL -DUINQHACK=Sbf `pkg-config  --cflags liblo` -DHAVE_LIBLO  \
    -pthread \
    -DXTERNAL_UI -DJACK_AUTOCONNECT=15 \
    -DAPPNAME="\"setBfree\"" \
    -DJACK_DESCRIPT=\"/home/chris/work/setBfree/ui/desc.h\" \
    -o setBfreeUI \
    /home/chris/work/setBfree/robtk/jackwrap.c   \
    ../src/midi.c ../src/cfgParser.c ../src/program.c ../src/vibrato.c ../src/state.c ../src/tonegen.c ../src/pgmParser.c ../src/memstream.c ../src/midnam.c ../b_whirl/eqcomp.c ../b_whirl/whirl.c ../b_overdrive/overdrive.c ../b_reverb/reverb.c  ../b_synth/lv2.c ../b_synth/ui.c \
    -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now ../pugl/pugl_x11.c -lX11 `pkg-config --libs glu ftgl` -ldl `pkg-config --libs jack` `pkg-config  --libs liblo` -lrt  \
    -lm
/home/chris/work/setBfree/robtk/jackwrap.c:271:1: Warnung: »LV2_URI_Map_Callback_Data« ist veraltet [-Wdeprecated-declarations]
  271 | static uint32_t uri_to_id (LV2_URI_Map_Callback_Data callback_data, const char* uri);
      | ^~~~~~
/home/chris/work/setBfree/robtk/jackwrap.c:821:1: Warnung: »LV2_URI_Map_Callback_Data« ist veraltet [-Wdeprecated-declarations]
  821 | uri_to_id (LV2_URI_Map_Callback_Data callback_data, const char* uri)
      | ^~~~~~~~~
/home/chris/work/setBfree/robtk/jackwrap.c: In Funktion »main«:
/home/chris/work/setBfree/robtk/jackwrap.c:1671:23: Warnung: Der Rückgabewert von »system«, der mit dem Attribut »warn_unused_result« deklariert wurde, wird ignoriert [-Wunused-result]
 1671 |                 (void)system ("xmessage -button ok -center \"Cannot connect to JACK.\nPlease start the JACK Server first.\" &");
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /home/chris/tmp/ccC5DFll.o: undefined reference to symbol 'glXSwapBuffers'
/usr/bin/ld: /usr/lib/libGL.so.1: error adding symbols: DSO missing from command line
x42 commented 2 years ago

Is this possibly a duplicate of #83 ?

SpotlightKid commented 2 years ago

Hmm. sort of. I have glu 9.0.2-2, the latest package on Arch, and pkg-config --libs glu returns:

-lGLU -lOpenGL

not

-lGLU -lGL

I'm not sure what to make of this.

dvzrv commented 2 years ago

It appears that glu can be built with libglvnd as GL provider. In that case OpenGL and not GL is being used in the pkgconfig integration created by the meson setup as well as created by the autotools setup.

To quote from https://github.com/pantherb/setBfree/pull/83#issuecomment-1008335676

Arch ships a bleeding-edge build of libglu (using meson to build it instead of autotools).

That is technically not correct. 1.4.0 is the latest stable upstream release. Bleeding edge makes it sound as if someone shipped a pre-release or something like that.

Looking at the libraries that are required by the various setbfree components, I believe adding gl to the list of pkg-config libraries does not pose any issue (worst case it is mentioned twice which is no issue for the linker, best case it works on more than just Debian going forward):

checking linked libraries for setbfree-0.8.11-3-x86_64.pkg.tar.zst
/usr/bin/setBfree
  NEEDED               libm.so.6
  NEEDED               libjack.so.0
  NEEDED               libc.so.6
/usr/bin/setBfreeUI
  NEEDED               libX11.so.6
  NEEDED               libOpenGL.so.0
  NEEDED               libGL.so.1
  NEEDED               libftgl.so.2
  NEEDED               libjack.so.0
  NEEDED               liblo.so.7
  NEEDED               libm.so.6
  NEEDED               libc.so.6
/usr/bin/x42-whirl
  NEEDED               libX11.so.6
  NEEDED               libpangocairo-1.0.so.0
  NEEDED               libpango-1.0.so.0
  NEEDED               libgobject-2.0.so.0
  NEEDED               libcairo.so.2
  NEEDED               libOpenGL.so.0
  NEEDED               libGL.so.1
  NEEDED               libjack.so.0
  NEEDED               liblo.so.7
  NEEDED               libm.so.6
  NEEDED               libc.so.6
/usr/lib/lv2/b_synth/b_synth.so
  NEEDED               libm.so.6
  NEEDED               libc.so.6
/usr/lib/lv2/b_synth/b_synthUI.so
  NEEDED               libX11.so.6
  NEEDED               libOpenGL.so.0
  NEEDED               libGL.so.1
  NEEDED               libftgl.so.2
  NEEDED               libc.so.6
/usr/lib/lv2/b_whirl/b_whirl.so
  NEEDED               libc.so.6
/usr/lib/lv2/b_whirl/b_whirlUI_gl.so
  NEEDED               libX11.so.6
  NEEDED               libpangocairo-1.0.so.0
  NEEDED               libpango-1.0.so.0
  NEEDED               libgobject-2.0.so.0
  NEEDED               libcairo.so.2
  NEEDED               libOpenGL.so.0
  NEEDED               libGL.so.1
  NEEDED               libm.so.6
  NEEDED               libc.so.6

However, I can not make any assumptions as to whether both libOpenGL.so and libGL.so are required and how this is handled in the context of setbfree. I guess you can make better assertions there than me ;-)

SpotlightKid commented 2 years ago

I believe adding gl to the list of pkg-config libraries does not pose any issue

Just to clarify: so you think this patch should be merged and would pose no harm where pkgconfig --libs gl already returns -lGL?

x42 commented 2 years ago

It appears that glu can be built with libglvnd as GL provider. In that case OpenGL and not GL is being used in the pkgconfig integration created by the meson setup as well as created by the autotools setup.

Won't that conflict later on when combined with ftgl and libgl?

dvzrv commented 1 year ago

FWIW: We have been patching setbfree for adding GL on Arch Linux, so that it links properly and it has caused no issue (to my knowledge). What is keeping this from being merged?

It would have been great to get this fixed before the latest release, as I'll have to continue to carry a patch now :cry:

x42 commented 1 year ago

Nothing, adding it to pkg-config its fine. adding -lGL directly is not. rebased and merged as v0.8.12-1 756437d