devttys0 / sasquatch

501 stars 155 forks source link

Patched compilation fails #24

Open E3V3A opened 5 years ago

E3V3A commented 5 years ago
$ make
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
In file included from unsquashfs.c:26:0:
unsquashfs.h:51:0: error: "__BYTE_ORDER" redefined [-Werror]
 #define __BYTE_ORDER BYTE_ORDER

In file included from /usr/include/machine/_endian.h:14:0,
                 from /usr/include/machine/endian.h:6,
                 from /usr/include/sys/types.h:67,
                 from /usr/include/stdio.h:61,
                 from unsquashfs.h:29,
                 from unsquashfs.c:26:
/usr/include/bits/endian.h:20:0: note: this is the location of the previous definition
 # define __BYTE_ORDER __LITTLE_ENDIAN

In file included from unsquashfs.c:26:0:
unsquashfs.h:52:0: error: "__BIG_ENDIAN" redefined [-Werror]
 #define __BIG_ENDIAN BIG_ENDIAN

In file included from /usr/include/machine/_endian.h:14:0,
                 from /usr/include/machine/endian.h:6,
                 from /usr/include/sys/types.h:67,
                 from /usr/include/stdio.h:61,
                 from unsquashfs.h:29,
                 from unsquashfs.c:26:
/usr/include/bits/endian.h:13:0: note: this is the location of the previous definition
 # define __BIG_ENDIAN 4321

In file included from unsquashfs.c:26:0:
unsquashfs.h:53:0: error: "__LITTLE_ENDIAN" redefined [-Werror]
 #define __LITTLE_ENDIAN LITTLE_ENDIAN

In file included from /usr/include/machine/_endian.h:14:0,
                 from /usr/include/machine/endian.h:6,
                 from /usr/include/sys/types.h:67,
                 from /usr/include/stdio.h:61,
                 from unsquashfs.h:29,
                 from unsquashfs.c:26:
/usr/include/bits/endian.h:16:0: note: this is the location of the previous definition
 # define __LITTLE_ENDIAN 1234

unsquashfs.c: In function ‘matches’:
unsquashfs.c:1443:35: error: ‘FNM_EXTMATCH’ undeclared (first use in this function)
     name, FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
                                   ^~~~~~~~~~~~
unsquashfs.c:1443:35: note: each undeclared identifier is reported only once for each function it appears in
unsquashfs.c: In function ‘initialise_threads’:
unsquashfs.c:2299:12: error: ‘CTL_HW’ undeclared (first use in this function)
   mib[0] = CTL_HW;
            ^~~~~~
unsquashfs.c:2303:12: error: ‘HW_NCPU’ undeclared (first use in this function)
   mib[1] = HW_NCPU;
            ^~~~~~~
unsquashfs.c:2306:6: error: implicit declaration of function ‘sysctl’ [-Werror=implicit-function-declaration]
   if(sysctl(mib, 2, &processors, &len, NULL, 0) == -1) {
      ^~~~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: unsquashfs.o] Error 1

Any ideas?

E3V3A commented 5 years ago

Main problem seem to be around here:

int matches(struct pathnames *paths, char *name, struct pathnames **new)
{
    int i, n;

    if(paths == NULL) {
        *new = NULL;
        return TRUE;
    }

    *new = init_subdir();

    for(n = 0; n < paths->count; n++) {
        struct pathname *path = paths->path[n];
        for(i = 0; i < path->names; i++) {
            int match = use_regex ?
                regexec(path->name[i].preg, name, (size_t) 0,
                NULL, 0) == 0 : fnmatch(path->name[i].name,
                name, FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
                0;
            if(match && path->name[i].paths == NULL)
                /*
                 * match on a leaf component, any subdirectories
                 * will implicitly match, therefore return an
                 * empty new search set
                 */
                goto empty_set;
...
E3V3A commented 5 years ago

Is related to #15 and (probably?) need another patch: here Would be great if you could include that in your own patch...

E3V3A commented 5 years ago

Ok, looking at various places how to patch this up...and there are a lot! After first patching with included script, then:

I posted the patches here:

  1. cygwin_sasquatch_43.patch
  2. cygwin_sasquatch_43_b.patch

Using:

# (1) diff --strip-trailing-cr -NBbaur squashfs-tools_orig/ squashfs-tools/ >cygwin_sasquatch_43.patch
# (2) diff --strip-trailing-cr -Bbaur squashfs-tools_orig/ squashfs-tools/ >cygwin_sasquatch_43_b.patch
E3V3A commented 5 years ago

@devttys0 Just to clarify, #25 fixes this issue. Please merge and close.