devttys0 / sasquatch

510 stars 158 forks source link

loSame issue on Kali/Debian with `gcc (Debian 10.2.1-6) 10.2.1` #43

Open sevrb opened 3 years ago

sevrb commented 3 years ago

Same issue on Kali/Debian with gcc (Debian 10.2.1-6) 10.2.1

Both solutions did not work for me. @Jegeva I changed in sasquatch/squashfs4.3/squashfs-tools/error.h int verbose; to extern int verbose; and added in unsquashfs.c int verbose; after int user_xattrs = FALSE;. Are these steps right?

Afterwards I get these errors:

/usr/bin/ld: unsquash-1.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquash-2.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquash-3.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquash-4.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: compressor.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquashfs_info.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
/usr/bin/ld: unsquashfs_xattr.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/error.h:34: multiple definition of `verbose'; unsquashfs.o:/home/jk2210/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:85: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:298: sasquatch] Error 1

Originally posted by @JK2210 in https://github.com/devttys0/sasquatch/issues/36#issuecomment-800177296

ghost commented 2 years ago

This worked for me. Just make sure to run make clean before running make again. Also, for the error you get before this one, delete -Werror from the Makefile to get rid of:

unsquashfs.c:1835:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
 1835 |     if(swap)
chilik commented 2 years ago

I have successfully compiled on Kali linux (M1) using this simple patch to the ./patches/patch0.txt to add the cflags: -fcommon and to remove the -Wall from the makefile:

diff --git a/patches/patch0.txt b/patches/patch0.txt
index 42af923..35c80a6 100644
--- a/patches/patch0.txt
+++ b/patches/patch0.txt
@@ -38118,12 +38118,12 @@ diff --strip-trailing-cr -NBbaur squashfs-tools/Makefile squashfs-tools-patched/
        unsquash-4.o swap.o compressor.o unsquashfs_info.o

 -CFLAGS ?= -O2
-+# CJH: Added -g, -Werror and -DSQUASHFS_TRACE
-+CFLAGS ?= -g -O2
++# CJH: Added -g, -fcommon and removed -Werror and -DSQUASHFS_TRACE
++CFLAGS ?= -g -O2 -fcommon
  CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \
[M1-Kali.patch.txt](https://github.com/devttys0/sasquatch/files/7776843/M1-Kali.patch.txt)

        -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"$(COMP_DEFAULT)\" \
 -      -Wall
-+      -Wall -Werror #-DSQUASHFS_TRACE
++      -Wall #-Werror #-DSQUASHFS_TRACE

  LIBS = -lpthread -lm
  ifeq ($(GZIP_SUPPORT),1)
sevrb commented 2 years ago

Vfkvg

bijoy26 commented 2 years ago

The solution by @chilik worked fine for my machine

tchereau commented 1 year ago

diff --git a/patches/patch0.txt b/patches/patch0.txt

for newby like who don't understand what to do with that :

cd patches
wget https://github.com/devttys0/sasquatch/files/7776843/M1-Kali.patch.txt
patch patch0.txt M1-Kali.patch.txt
cd ..
./build.sh

result : it's work :)

cc -g -O2 -fcommon  -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  -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT   -c -o lzma_wrapper.o lzma_wrapper.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
mkdir -p /usr/local/bin
cp sasquatch /usr/local/bin

and the patch also work on regular x64 machin