REGoth-project / REGoth

OpenSource-Reimplementation of the zEngine, used by the game "Gothic"
GNU General Public License v3.0
630 stars 62 forks source link

Cmake fails at linking altonegen, possibly libopenal version conflict ? #373

Open 1ykos opened 4 years ago

1ykos commented 4 years ago

I just tried to compile REGoth on opensuse tumbleweed and it failed at linking altonegen. I suspect there is a version conflict due to my version of libopenal (1.20), which is probably very recent.

Error Message: `multiple definition of `FuMa2N3DScale' libopenal.a` ```cmake Scanning dependencies of target altonegen [ 97%] Building C object lib/openal-soft/CMakeFiles/altonegen.dir/examples/altonegen.c.o [ 97%] Building C object lib/openal-soft/CMakeFiles/altonegen.dir/examples/common/alhelpers.c.o [ 97%] Linking C executable ../../bin/altonegen /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(ALu.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:29: multiple definition of `FuMa2N3DScale'; ../libopenal.a(ALc.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:29: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(ALu.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:28: multiple definition of `SN3D2N3DScale'; ../libopenal.a(ALc.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:28: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(ALu.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:27: multiple definition of `N3D2N3DScale'; ../libopenal.a(ALc.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:27: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(bformatdec.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:28: multiple definition of `SN3D2N3DScale'; ../libopenal.a(ALc.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:28: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(bformatdec.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:27: multiple definition of `N3D2N3DScale'; ../libopenal.a(ALc.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:27: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(bformatdec.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:29: multiple definition of `FuMa2N3DScale'; ../libopenal.a(ALc.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:29: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(panning.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:29: multiple definition of `FuMa2N3DScale'; ../libopenal.a(ALc.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:29: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(panning.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:28: multiple definition of `SN3D2N3DScale'; ../libopenal.a(ALc.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:28: first defined here /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(panning.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:27: multiple definition of `N3D2N3DScale'; ../libopenal.a(ALc.c.o):/home/wolfi/src/REGoth/lib/openal-soft/Alc/bformatdec.h:27: first defined here collect2: error: ld returned 1 exit status make[2]: *** [lib/openal-soft/CMakeFiles/altonegen.dir/build.make:121: bin/altonegen] Error 1 make[1]: *** [CMakeFiles/Makefile2:1432: lib/openal-soft/CMakeFiles/altonegen.dir/all] Error 2 make: *** [Makefile:150: all] Error 2 ```
ataulien commented 4 years ago

Hi, the linker-error seems to originate from one of the OpenAL-soft examples. You may can just remove them from the build by supplying -DALSOFT_EXAMPLES=OFF to cmake.

1ykos commented 4 years ago
make clean
cmake -DALSOFT_EXAMPLES=OFF ~/src/REGoth/
make

gives the exact same error message. When I comment out the definition in bformatdec.h:29 the variable FuMa2N3DScale is not defined in panning.c... I suspect something in the compilation procedure went wrong to trigger the inclusion of bformatdec.h twice even though there is an include guard, how is that possible? '-DALSOFT_EXAMPLES=OFF apparently did not do anything even though it should have prevented the compilation of the alsoft examples judging from the CMakeLists.txt. So I tried cmake -D ALSOFT_EXAMPLES=OFF ~/src/REGoth too, but the same result. Any ideas?

ataulien commented 4 years ago

make clean only cleans build-artifacts, but does not cause CMake to regenerate build-files on the next run. You should delete/clear the complete build-directory and call CMake again.

1ykos commented 4 years ago

Thank you for the suggestion but this gives the same error message.

~/bin % rm -rf REGoth 
~/bin % mkdir ~/bin/REGoth
~/bin % cd REGoth 
~/bin/REGoth % cmake -DALSOFT_EXAMPLES=OFF ~/src/REGoth
~/bin/REGoth % make
Gryxx commented 4 years ago

openSUSE Tumbleweed here too.

[ 97%] Linking C executable ../../bin/altonegen
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(ALu.c.o):(.rodata+0x3bfc0): multiple definition of `FuMa2N3DScale'; ../libopenal.a(ALc.c.o):(.rodata+0x2e60): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(ALu.c.o):(.rodata+0x3c000): multiple definition of `SN3D2N3DScale'; ../libopenal.a(ALc.c.o):(.rodata+0x2ea0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(ALu.c.o):(.rodata+0x3c040): multiple definition of `N3D2N3DScale'; ../libopenal.a(ALc.c.o):(.rodata+0x2ee0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(bformatdec.c.o):(.rodata+0x2e0): multiple definition of `SN3D2N3DScale'; ../libopenal.a(ALc.c.o):(.rodata+0x2ea0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(bformatdec.c.o):(.rodata+0x320): multiple definition of `N3D2N3DScale'; ../libopenal.a(ALc.c.o):(.rodata+0x2ee0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(bformatdec.c.o):(.rodata+0x2a0): multiple definition of `FuMa2N3DScale'; ../libopenal.a(ALc.c.o):(.rodata+0x2e60): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(panning.c.o):(.rodata+0x13c0): multiple definition of `FuMa2N3DScale'; ../libopenal.a(ALc.c.o):(.rodata+0x2e60): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(panning.c.o):(.rodata+0x1440): multiple definition of `N3D2N3DScale'; ../libopenal.a(ALc.c.o):(.rodata+0x2ee0): first defined here
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: ../libopenal.a(panning.c.o):(.rodata+0x1400): multiple definition of `SN3D2N3DScale'; ../libopenal.a(ALc.c.o):(.rodata+0x2ea0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [lib/openal-soft/CMakeFiles/altonegen.dir/build.make:120: bin/altonegen] Błąd 1
make[1]: *** [CMakeFiles/Makefile2:1403: lib/openal-soft/CMakeFiles/altonegen.dir/all] Błąd 2
make: *** [Makefile:149: all] Błąd 2
stefson commented 1 year ago

I keep hitting the same linking error, is there no nuclear option to disable all of openal through cmake?