mincequi / qLouder

A tool to measure and design loudspeakers
GNU General Public License v3.0
16 stars 2 forks source link

Build fails on Linux (Ubuntu 22.04): r8brain symbols defined twice. #1

Closed be1 closed 2 years ago

be1 commented 2 years ago

Hello. It appears both cinder and qLouder use r8brain as static lib, so symbols in r8bbase.cpp are defined twice. Thus the linking stage fails obviously. I'm not used to CMake so I cannot help resolving the dependency graph.

$ LANG=C make
[ 64%] Built target cinder
[ 64%] Automatic MOC and UIC for target qLouder
[ 64%] Built target qLouder_autogen
[ 65%] Linking CXX executable qLouder
/usr/bin/ld: _deps/cinder-src/lib/linux/x86_64/ogl/Debug/libcinder.a(r8bbase.cpp.o):(.bss+0x0): multiple definition of `r8b::CDSPRealFFTKeeper::StateSync'; CMakeFiles/qLouder.dir/_deps/r8brain-src/r8bbase.cpp.o:(.bss+0x0): first defined here
/usr/bin/ld: _deps/cinder-src/lib/linux/x86_64/ogl/Debug/libcinder.a(r8bbase.cpp.o):(.bss+0x40): multiple definition of `r8b::CDSPRealFFTKeeper::FFTObjects'; CMakeFiles/qLouder.dir/_deps/r8brain-src/r8bbase.cpp.o:(.bss+0x40): first defined here
/usr/bin/ld: _deps/cinder-src/lib/linux/x86_64/ogl/Debug/libcinder.a(r8bbase.cpp.o):(.bss+0x140): multiple definition of `r8b::CDSPFIRFilterCache::StateSync'; CMakeFiles/qLouder.dir/_deps/r8brain-src/r8bbase.cpp.o:(.bss+0x140): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/qLouder.dir/build.make:781: qLouder] Error 1
make[1]: *** [CMakeFiles/Makefile2:199: CMakeFiles/qLouder.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
be1 commented 2 years ago

I think the best way to avoid this is to not make qLouder source depend directly on r8brain, but let it use cinder API that uses r8brain.

mincequi commented 2 years ago

Hi @be1, thanks for your feedback. You are right. Cinder has its own version of r8brain shipped with (actually, an ancient version). Currently, i do not have a recent linux installation to test compilation with and cinder does not compile on my debian installation (my primary platform is macOS).

However, I tried a different approach with the recent commit. You might try this.

Yeah, there are several ways to get around this, but i do not plan to make cinder a central component of my app. I would prefer to extract the relevant sources from cinder and create a dedicated library (e.g. libcinder-audio) which behaves more cooperative.

Since i am already maintaining my own fork of cinder (until they get my PRs merged), i will add some fixes there. Stay tuned...

be1 commented 2 years ago

Hi @mincequi Thanks for your reply. Now compilation fails on another symbol.

$ LANG=C make
Consolidate compiler generated dependencies of target cinder
[ 63%] Built target cinder
[ 63%] Automatic MOC and UIC for target player
[ 63%] Built target player_autogen
Consolidate compiler generated dependencies of target player
[ 64%] Built target player
[ 65%] Automatic MOC and UIC for target measure
[ 65%] Built target measure_autogen
Consolidate compiler generated dependencies of target measure
[ 68%] Built target measure
[ 68%] Automatic MOC and UIC for target qLouder
[ 68%] Built target qLouder_autogen
Consolidate compiler generated dependencies of target qLouder
[ 69%] Linking CXX executable qLouder
/usr/bin/ld: _deps/cinder-src/lib/linux/x86_64/ogl/Debug/libcinder.a(r8bbase.cpp.o):(.bss+0x0): multiple definition of `r8b::CDSPRealFFTKeeper::StateSync'; src/measure/libmeasure.a(r8bbase.cpp.o):(.bss+0x0): first defined here
/usr/bin/ld: _deps/cinder-src/lib/linux/x86_64/ogl/Debug/libcinder.a(r8bbase.cpp.o):(.bss+0x40): multiple definition of `r8b::CDSPRealFFTKeeper::FFTObjects'; src/measure/libmeasure.a(r8bbase.cpp.o):(.bss+0x40): first defined here
/usr/bin/ld: _deps/cinder-src/lib/linux/x86_64/ogl/Debug/libcinder.a(r8bbase.cpp.o):(.bss+0x140): multiple definition of `r8b::CDSPFIRFilterCache::StateSync'; src/measure/libmeasure.a(r8bbase.cpp.o):(.bss+0x140): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/qLouder.dir/build.make:511: qLouder] Error 1
make[1]: *** [CMakeFiles/Makefile2:239: CMakeFiles/qLouder.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
mincequi commented 2 years ago

Hi @be1 I force pushed another change. I kicked out the r8brain dependency from qLouder as you suggested in favor of using the r8brain lib that comes with cinder.

This should finally do the trick.

be1 commented 2 years ago

Great, It works, at least after installing libqt5multimedia5-plugins. Otherwise the program segfaults because no I/O device is found.

mincequi commented 2 years ago

Thanks, your feedback is highly appreciated. Please let me know your thoughts when using this tool.