libnxz / power-gzip

POWER NX zlib compliant library
23 stars 18 forks source link

Failed to compile with GCC10 #35

Closed runlevel5 closed 4 years ago

runlevel5 commented 4 years ago

GCC10 Default to -fno-common caused compilation errors:

$ make
gcc -std=gnu11 -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -DZLIB_API -mcpu=power9  -I./inc_nx -c nx_inflate.c nx_deflate.c nx_zlib.c nx_crc.c nx_dht.c nx_dhtgen.c nx_dht_builtin.c nx_adler32.c gzip_vas.c nx_compress.c nx_uncompr.c crc32_ppc.c crc32_ppc_asm.S
rm -f libnxz.a
ar rcs -o libnxz.a nx_inflate.o nx_deflate.o nx_zlib.o nx_crc.o nx_dht.o nx_dhtgen.o nx_dht_builtin.o nx_adler32.o gzip_vas.o nx_compress.o nx_uncompr.o crc32_ppc.o crc32_ppc_asm.o
rm -f libnxz.so
gcc -shared  -Wl,-soname,libnxz.so,--version-script,zlib.map -o libnxz.so nx_inflate.o nx_deflate.o nx_zlib.o nx_crc.o nx_dht.o nx_dhtgen.o nx_dht_builtin.o nx_adler32.o gzip_vas.o nx_compress.o nx_uncompr.o crc32_ppc.o crc32_ppc_asm.o 
/usr/bin/ld: nx_deflate.o:(.bss+0x0): multiple definition of `mutex_log'; nx_inflate.o:(.bss+0x0): first defined here
/usr/bin/ld: nx_zlib.o:(.bss+0x8228): multiple definition of `mutex_log'; nx_inflate.o:(.bss+0x0): first defined here
/usr/bin/ld: gzip_vas.o:(.bss+0x18): multiple definition of `mutex_log'; nx_inflate.o:(.bss+0x0): first defined here
/usr/bin/ld: nx_compress.o:(.bss+0x0): multiple definition of `mutex_log'; nx_inflate.o:(.bss+0x0): first defined here
/usr/bin/ld: nx_uncompr.o:(.bss+0x0): multiple definition of `mutex_log'; nx_inflate.o:(.bss+0x0): first defined here

The fix is quite trivial by using extern for mutex_log in header file and declare the variable in C file. Here is one example

tuliom commented 4 years ago

This is a duplicate of issue #3. It's already fixed in branch develop.