setmind / sacd-ripper

Improved sacd_extract
GNU General Public License v2.0
73 stars 21 forks source link

compiling sacd-extract fails on Linux (x86) #8

Open klslz opened 3 years ago

klslz commented 3 years ago

Under Linux, on x86 with gcc 10.2.1 and Fedora 33 make fails on sacd-extract:

...
/usr/bin/ld: CMakeFiles/sacd_extract.dir/root/sacd-ripper/libs/libsacd/scarletbook_read.c.o:(.bss+0x10): multiple definition of `character_set_t'; CMakeFiles/sacd_extract.dir/main.c.o:(.bss+0x20): first defined here
/usr/bin/ld: CMakeFiles/sacd_extract.dir/root/sacd-ripper/libs/libsacd/scarletbook_read.c.o:(.bss+0x14): multiple definition of `frame_format_t'; CMakeFiles/sacd_extract.dir/main.c.o:(.bss+0x24): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sacd_extract.dir/build.make:793: sacd_extract] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/sacd_extract.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

Any ideas?

I did try to compile it as root under ~root

THX

ghost commented 3 years ago

@klslz Have you got a solution yet? Thx PS:Build have suceeded on my raspberry pi, so it may a related specifically to x86, but I still have not found out how.

kalaklanar commented 3 years ago

I can confirm the issue on x86_64 fedora 33 as OP using the 0.3.9 release and the git release. The same release is working on a Ubuntu 20.04.01 LTS

It also fails on Ubunu 20.10 which leads me to suspect something broke with newer systems.

dijkstrah commented 3 years ago

Since GCC version 10, default compilation is with -fno-common. The libsacd code has a couple of multiple definitions which cannot be linked if that flag is active. I have to comb through the code for a structural fix. In the meantime you could say: export CFLAGS="-fcommon" and then compile as that is the old behaviour of gcc.

z4deepfz commented 3 years ago

Pass -DCMAKE_C_FLAGS="-fcommon" to cmake also works. My approach: cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_C_FLAGS="-fcommon"