Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building dependencies via deps.sh: squashfs build error ("multiple definition of 'verbose'") #588

Closed
mzpqnxow opened this issue Jan 13, 2022 · 3 comments

Comments

@mzpqnxow
Copy link

I have not looked into this yet but it seems like it will probably be an easy-ish fix. Here's the info:

11:14:48 › lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

11:15:49 › gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-10-Km9U7s/gcc-10-10.2.1/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-Km9U7s/gcc-10-10.2.1/debian/tmp-gcn/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20210110 (Debian 10.2.1-6)


Using `./deps.sh`:

T -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o lzo_wrapper.o lzo_wrapper.c
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT="gzip" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o read_xattrs.o read_xattrs.c
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT="gzip" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o unsquashfs_xattr.o unsquashfs_xattr.c
g++ ./LZMA/lzmalt/*.o unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o unsquash-4.o swap.o compressor.o unsquashfs_info.o gzip_wrapper.o lzma_wrapper.o ./LZMA/lzma465/C/Alloc.o ./LZMA/lzma465/C/LzFind.o ./LZMA/lzma465/C/LzmaDec.o ./LZMA/lzma465/C/LzmaEnc.o ./LZMA/lzma465/C/LzmaLib.o xz_wrapper.o lzo_wrapper.o read_xattrs.o unsquashfs_xattr.o -lpthread -lm -lz -L./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -llzmalib -llzma -llzo2 -o sasquatch
/usr/bin/ld: unsquash-1.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here /usr/bin/ld: unsquash-2.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: unsquash-3.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here /usr/bin/ld: unsquash-4.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: compressor.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here /usr/bin/ld: unsquashfs_info.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: lzma_wrapper.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here /usr/bin/ld: read_xattrs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of verbose'; unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
/usr/bin/ld: unsquashfs_xattr.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/error.h:34: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:298: sasquatch] Error 1

@mzpqnxow
Copy link
Author

If there is an issue here, it will be in the current master of https://github.com/devttys0/sasquatch but I'll leave this issue here for now

Can be reproduced via:

$ git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/sasquatch
    (cd sasquatch && $SUDO ./build.sh)

@mzpqnxow
Copy link
Author

mzpqnxow commented Jan 13, 2022

diff --strip-trailing-cr -NBbaur squashfs-tools/error.h squashfs-tools-patched/error.h
--- squashfs-tools/error.h	2016-08-25 09:06:22.983529595 -0400
+++ squashfs-tools-patched/error.h	2016-08-25 09:06:03.223530354 -0400
@@ -30,14 +30,18 @@
 extern void progressbar_error(char *fmt, ...);
 extern void progressbar_info(char *fmt, ...);
 
-#ifdef SQUASHFS_TRACE
+// CJH: Updated so that TRACE prints if -verbose is specified on the command line
+int verbose;
+//#ifdef SQUASHFS_TRACE
 #define TRACE(s, args...) \
 		do { \
-			progressbar_info("squashfs: "s, ## args);\
+			if(verbose) progressbar_info("squashfs: "s, ## args);\
 		} while(0)
+/*

seems like because verbose is declared in a common header, it is being compiled separately into each object, so when they're linked, they blow up. I'm guessing it would be better to have extern int verbose in error.h and then put int verbose in one of the common .c files, so each object file is referencing the same instance of verbose and can be linked together joyously

NOTE: verbose is only set via unsquashfs.c and is only accessed via the TRACE macro in error.h

@mzpqnxow
Copy link
Author

Seems to be already reported in devttys0/sasquatch#36

My fix was to move the declaration of verbose to unsquashfs.c and to make ernor.h reference it as extern int verbose. I'll close this now, sorry for the noise :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant