ZDoom / ZMusic

GZDoom's music system as a standalone library
https://forum.zdoom.org/index.php
60 stars 32 forks source link

`BUILD_SHARED_LIBS=OFF` does not work properly in Ubuntu 18.04 #35

Open madame-rachelle opened 2 years ago

madame-rachelle commented 2 years ago

I am not sure what I am doing wrong, but the linker says that everything is a duplicate reference.


Consolidate compiler generated dependencies of target OSDependent
[  0%] Built target OSDependent
Consolidate compiler generated dependencies of target OGLCompiler
[  0%] Built target OGLCompiler
Consolidate compiler generated dependencies of target glslang
[  5%] Built target glslang
Consolidate compiler generated dependencies of target SPIRV
[  6%] Built target SPIRV
Consolidate compiler generated dependencies of target asmjit
[ 10%] Built target asmjit
Consolidate compiler generated dependencies of target jpeg
[ 14%] Built target jpeg
Consolidate compiler generated dependencies of target bz2
[ 15%] Built target bz2
Consolidate compiler generated dependencies of target lzma
[ 18%] Built target lzma
Consolidate compiler generated dependencies of target re2c
[ 26%] Built target re2c
Consolidate compiler generated dependencies of target lemon
[ 26%] Built target lemon
Consolidate compiler generated dependencies of target zipdir
[ 27%] Built target zipdir
Consolidate compiler generated dependencies of target arithchk
[ 28%] Built target arithchk
Consolidate compiler generated dependencies of target qnan
[ 29%] Built target qnan
Consolidate compiler generated dependencies of target gdtoa
[ 30%] Built target gdtoa
src/gitinfo.h is up to date at commit ha0.0-717-g7c80ffa8d.
[ 30%] Built target revision_check
Consolidate compiler generated dependencies of target zdoom
[ 30%] Linking CXX executable ../gzdoom
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libzmusic.a(i_module.cpp.o): In function `FModule::Unload()':
i_module.cpp:(.text+0x0): multiple definition of `FModule::Unload()'
CMakeFiles/zdoom.dir/common/utility/i_module.cpp.o:i_module.cpp:(.text+0xd0): first defined here
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libzmusic.a(i_module.cpp.o): In function `FModule::Open(char const*)':
i_module.cpp:(.text+0x30): multiple definition of `FModule::Open(char const*)'
CMakeFiles/zdoom.dir/common/utility/i_module.cpp.o:i_module.cpp:(.text+0x100): first defined here
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libzmusic.a(i_module.cpp.o): In function `FModule::GetSym(char const*)':
i_module.cpp:(.text+0x60): multiple definition of `FModule::GetSym(char const*)'
CMakeFiles/zdoom.dir/common/utility/i_module.cpp.o:i_module.cpp:(.text+0x130): first defined here
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libzmusic.a(i_module.cpp.o): In function `FModule::Load(std::initializer_list<char const*>)':
i_module.cpp:(.text+0x70): multiple definition of `FModule::Load(std::initializer_list<char const*>)'
CMakeFiles/zdoom.dir/common/utility/i_module.cpp.o:i_module.cpp:(.text+0x0): first defined here
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libzmusic.a(i_module.cpp.o): In function `FModule_SetProgDir(char const*)':
i_module.cpp:(.text+0x100): multiple definition of `FModule_SetProgDir(char const*)'
CMakeFiles/zdoom.dir/common/utility/i_module.cpp.o:i_module.cpp:(.text+0x140): first defined here
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libzmusic.a(music_alsa_state.cpp.o): undefined reference to symbol 'snd_seq_query_next_port@@ALSA_0.9'
//usr/lib/x86_64-linux-gnu/libasound.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
src/CMakeFiles/zdoom.dir/build.make:7781: recipe for target 'gzdoom' failed
make[2]: *** [gzdoom] Error 1
CMakeFiles/Makefile2:784: recipe for target 'src/CMakeFiles/zdoom.dir/all' failed
make[1]: *** [src/CMakeFiles/zdoom.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2
raa125@r-sweden:~/Projects/gzdoom/build$```
alexey-lysiuk commented 2 years ago

Does GZDoom link with the following line commented out? https://github.com/coelckers/ZMusic/blob/6b5aebf6a33d83912de16ed5a7999946bd7b6988/source/CMakeLists.txt#L8

madame-rachelle commented 2 years ago

Doing that gave me this:


[ 30%] Linking CXX executable ../gzdoom
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libzmusic.a(music_alsa_state.cpp.o): undefined reference to symbol 'snd_seq_query_next_port@@ALSA_0.9'
//usr/lib/x86_64-linux-gnu/libasound.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
src/CMakeFiles/zdoom.dir/build.make:7781: recipe for target 'gzdoom' failed
make[2]: *** [gzdoom] Error 1
CMakeFiles/Makefile2:784: recipe for target 'src/CMakeFiles/zdoom.dir/all' failed
make[1]: *** [src/CMakeFiles/zdoom.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2```
madame-rachelle commented 2 years ago

I just tried this in Ubuntu 20.04 and same thing. The 18.04 was chrooted.