報錯1:
標(biāo)準(zhǔn)不同
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.o unsquashfs.c
unsquashfs.c: In function ‘read_super’:
unsquashfs.c:1835:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
1835 | if(swap)
| ^~
unsquashfs.c:1841:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
1841 | read_fs_bytes(fd, SQUASHFS_START, sizeof(struct squashfs_super_block),
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
解決方法:
在unsquashfs.c文件第1835行下加上大括號,如下:
報錯2:
鏈接找不到符號
p.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: unsquashfs.o: in function `read_fs_bytes':
/tmp/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:638: undefined reference to `verbose'
/usr/bin/ld: /tmp/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:638: undefined reference to `verbose'
/usr/bin/ld: unsquashfs.o: in function `read_block':
/tmp/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:681: undefined reference to `verbose'
/usr/bin/ld: /tmp/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:681: undefined reference to `verbose'
/usr/bin/ld: unsquashfs.o: in function `read_data_block':
/tmp/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:749: undefined reference to `verbose'
/usr/bin/ld: unsquashfs.o:/tmp/sasquatch/squashfs4.3/squashfs-tools/unsquashfs.c:749: more undefined references to `verbose' follow
collect2: error: ld returned 1 exit status
在error.h里 #include下面加上extern int verbose
同時在 unsquashfs.c 里加上int verbose = 0,別塞到函數(shù)里就行
改完,應(yīng)該能順利編譯。