Menu

#7 1.99.13 fails to build on systems with musl C-library

1.0
closed
nobody
None
2024-08-23
2024-08-14
Erhard F.
No

1.99.13 fails to build on my amd64-musl box:

 # ./autogen.sh
 # ./configure 
 # make
 # gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DGEN_DEP -msse4.2 -maes -mavx2 -mvaes -mavx2 -mrdrnd -MM ./*.c >.dep
gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DGEN_DEP -D__AES__ -D__SSE4_1__ -D__SSSE3__ -D__SSE3__ -D__SSE2__ -D__SSE__ -D__MMX__ -DNO_WARN_X86_INTRINSICS -I . -MM ./*.c >.dep
In file included from ./find_nonzero.h:13,
                 from ./dd_rescue.c:118:
./ffs.h:61:3: error: #error Need to define __WORDSIZE
   61 | # error Need to define __WORDSIZE
      |   ^~~~~
./dd_rescue.c:205:3: error: #error __WORDSIZE undefined
  205 | # error __WORDSIZE undefined
      |   ^~~~~
./fiemap.c:229:2: error: #error __WORDSIZE undefined
  229 | #error __WORDSIZE undefined
      |  ^~~~~
In file included from ./find_nonzero.h:13,
                 from ./file_zblock.c:16:
./ffs.h:61:3: error: #error Need to define __WORDSIZE
   61 | # error Need to define __WORDSIZE
      |   ^~~~~
In file included from ./find_nonzero.h:13,
                 from ./find_nonzero.c:11:
./ffs.h:61:3: error: #error Need to define __WORDSIZE
   61 | # error Need to define __WORDSIZE
      |   ^~~~~
In file included from ./find_nonzero.h:13,
                 from ./find_nonzero_arm.c:7:
./ffs.h:61:3: error: #error Need to define __WORDSIZE
   61 | # error Need to define __WORDSIZE
      |   ^~~~~
In file included from ./find_nonzero.h:13,
                 from ./find_nonzero_arm64.c:7:
./ffs.h:61:3: error: #error Need to define __WORDSIZE
   61 | # error Need to define __WORDSIZE
      |   ^~~~~
In file included from ./find_nonzero.h:13,
                 from ./find_nonzero_avx.c:11:
./ffs.h:61:3: error: #error Need to define __WORDSIZE
   61 | # error Need to define __WORDSIZE
      |   ^~~~~
In file included from ./find_nonzero.h:13,
                 from ./find_nonzero_sse2.c:7:
./ffs.h:61:3: error: #error Need to define __WORDSIZE
   61 | # error Need to define __WORDSIZE
      |   ^~~~~
In file included from ./find_nonzero.h:13,
                 from ./libddr_crypt.c:18:
./ffs.h:61:3: error: #error Need to define __WORDSIZE
   61 | # error Need to define __WORDSIZE
      |   ^~~~~
./libddr_crypt.c:65:2: error: #error __WORDSIZE unknown
   65 | #error __WORDSIZE unknown
      |  ^~~~~
./libddr_hash.c:414:2: error: #error __WORDSIZE unknown
  414 | #error __WORDSIZE unknown
      |  ^~~~~
./libddr_lzo.c:48:2: error: #error __WORDSIZE unknown
   48 | #error __WORDSIZE unknown
      |  ^~~~~
./libddr_null.c:98:2: error: #error __WORDSIZE unknown
   98 | #error __WORDSIZE unknown
      |  ^~~~~
./sha512.c:175:2: error: #error __WORDSIZE unknown
  175 | #error __WORDSIZE unknown
      |  ^~~~~
In file included from ./find_nonzero.h:13,
                 from ./test_aes.c:5:
./ffs.h:61:3: error: #error Need to define __WORDSIZE
   61 | # error Need to define __WORDSIZE
      |   ^~~~~
Makefile:240: .dep: No such file or directory
make: *** [Makefile:235: .dep] Error 1

Gentoo has a workaround for this (https://gitweb.gentoo.org/repo/gentoo.git/commit/sys-fs/dd-rescue?id=2dff586ec1e93dae97dd97cfa2e310edbd633515) by forcing ac_cv_func_fallocate64=yes and RPM_OPT_FLAGS="${CFLAGS} ${CPPFLAGS} -D_LARGEFILE64_SOURCE". A more detailed explanation in the workaround.

With the workaround 1.99.13 builds and runs fine on musl-1.2.4. Starting with musl-1.2.5 I however run into a new problem:

[...]
clang -Os -march=x86-64-v2 -pipe  -D_LARGEFILE64_SOURCE  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DNO_AVX2 -DVERSION=\"1.99.13\"  -D__COMPILER__="\"clang version 18.1.8+libcxx\"" -DID=\"DD_RESCUE_1_99_13\"  -fPIC -o libddr_hash.po -c libddr_hash.c
clang -Os -march=x86-64-v2 -pipe  -D_LARGEFILE64_SOURCE  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DNO_AVX2 -fPIC -o md5.po -c md5.c
clang -Os -march=x86-64-v2 -pipe  -D_LARGEFILE64_SOURCE  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DNO_AVX2 -fPIC -o sha256.po -c sha256.c
clang -Os -march=x86-64-v2 -pipe  -D_LARGEFILE64_SOURCE  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DNO_AVX2 -fPIC -o sha512.po -c sha512.c
clang -Os -march=x86-64-v2 -pipe  -D_LARGEFILE64_SOURCE  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DNO_AVX2 -fPIC -o sha1.po -c sha1.c
In file included from libddr_hash.c:17:
In file included from ./ddr_plugin.h:24:
./ddr_ctrl.h:10:9: warning: '_GNU_SOURCE' macro redefined
      [-Wmacro-redefined]
   10 | #define _GNU_SOURCE
      |         ^
libddr_hash.c:11:10: note: previous definition is here
   11 | # define _GNU_SOURCE 1
      |          ^
fatal: not a git repository (or any parent up to mount point /var)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
clang -Os -march=x86-64-v2 -pipe  -D_LARGEFILE64_SOURCE  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DNO_AVX2 -DVERSION=\"1.99.13\"  -D__COMPILER__="\"clang version 18.1.8+libcxx\"" -DID=\"DD_RESCUE_1_99_13\"  -fPIC -o pbkdf2.po -c pbkdf2.c
libddr_hash.c:848:20: warning: implicit truncation from 'int' to a one-bit
      wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
  848 |         .handles_sparse = 1,
      |                           ^
fatal: not a git repository (or any parent up to mount point /var)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
clang -Os -march=x86-64-v2 -pipe  -D_LARGEFILE64_SOURCE  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DNO_AVX2 -DVERSION=\"1.99.13\"  -D__COMPILER__="\"clang version 18.1.8+libcxx\"" -DID=\"DD_RESCUE_1_99_13\"  -fPIC -o checksum_file.po -c checksum_file.c
fatal: not a git repository (or any parent up to mount point /var)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
checksum_file.c:64:14: error: call to undeclared function 'basename'; ISO
      C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
   64 |         char* bnm = basename((char*)nm);
      |                     ^
checksum_file.c:64:8: error: incompatible integer to pointer conversion
      initializing 'char *' with an expression of type 'int' [-Wint-conversion]
   64 |         char* bnm = basename((char*)nm);
      |               ^     ~~~~~~~~~~~~~~~~~~~
checksum_file.c:156:14: error: call to undeclared function 'basename'; ISO
      C99 and later do not support implicit function declarations
      [-Wimplicit-function-declaration]
  156 |         char* bnm = basename(nm);
      |                     ^
checksum_file.c:156:8: error: incompatible integer to pointer conversion
      initializing 'char *' with an expression of type 'int' [-Wint-conversion]
  156 |         char* bnm = basename(nm);
      |               ^     ~~~~~~~~~~~~
4 errors generated.
clang -Os -march=x86-64-v2 -pipe  -D_LARGEFILE64_SOURCE  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DNO_AVX2 -DVERSION=\"1.99.13\"  -D__COMPILER__="\"clang version 18.1.8+libcxx\"" -DID=\"DD_RESCUE_1_99_13\"  -fPIC -o libddr_null.po -c libddr_null.c
make: *** [Makefile:282: checksum_file.po] Error 1
make: *** Waiting for unfinished jobs....
libddr_null.c:47:32: warning: implicit truncation from 'int' to a one-bit
      wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   47 |                         ddr_plug.changes_output_len = 1;
      |                                                     ^ ~
libddr_null.c:49:32: warning: implicit truncation from 'int' to a one-bit
      wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   49 |                         ddr_plug.changes_output_len = 1;
      |                                                     ^ ~
libddr_null.c:56:28: warning: implicit truncation from 'int' to a one-bit
      wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   56 |                         ddr_plug.changes_output = 1;
      |                                                 ^ ~
libddr_null.c:58:28: warning: implicit truncation from 'int' to a one-bit
      wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   58 |                         ddr_plug.changes_output = 1;
      |                                                 ^ ~
libddr_null.c:124:20: warning: implicit truncation from 'int' to a one-bit
      wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
  124 |         .handles_sparse = 1,
      |                           ^
5 warnings generated.
2 warnings generated.

 * ERROR: sys-fs/dd-rescue-1.99.13-r1::gentoo failed (compile phase):

This is Gentoo downstream bug report #937492.

Discussion

1 2 > >> (Page 1 of 2)
  • Kurt Garloff

    Kurt Garloff - 2024-08-17

    Thanks for reporting!
    The basename() function is declared in libgen.h, I now test for it and include it.
    The ddr_ctrl.h file in my tree does NOT contain #define _GNU_SOURCE, so I wonder where that comes from.
    Please check whether the current git state (DD_RESCUE_1_99_BRANCH) works well.

     
  • Erhard F.

    Erhard F. - 2024-08-17

    Thanks for looking into this!
    I had trouble getting the repo (git clone git://git.code.sf.net/p/ddrescue/code ddrescue-code) as the link provided by sourceforge does not give me branches but only the master repo with commits up to 2017 (?). But this may be very well my git skills lacking...

    So I used the SF webinterface to generate me a snapshot of DD_RESCUE_1_99_BRANCH. But I still get the same errors:

    ~/builddir/ddrescue-code-789c03c853b925907b925b68d73fbd98ded0bf10 # make
    
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DGEN_DEP -msse4.2 -maes -mavx2 -mvaes -mavx2 -mrdrnd -MM ./*.c >.dep
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DGEN_DEP -D__AES__ -D__SSE4_1__ -D__SSSE3__ -D__SSE3__ -D__SSE2__ -D__SSE__ -D__MMX__ -DNO_WARN_X86_INTRINSICS -I . -MM ./*.c >.dep
    In file included from ./find_nonzero.h:13,
                     from ./dd_rescue.c:118:
    ./ffs.h:61:3: error: #error Need to define __WORDSIZE
       61 | # error Need to define __WORDSIZE
          |   ^~~~~
    ./dd_rescue.c:209:3: error: #error __WORDSIZE undefined
      209 | # error __WORDSIZE undefined
          |   ^~~~~
    ./fiemap.c:229:2: error: #error __WORDSIZE undefined
      229 | #error __WORDSIZE undefined
          |  ^~~~~
    In file included from ./find_nonzero.h:13,
                     from ./file_zblock.c:16:
    ./ffs.h:61:3: error: #error Need to define __WORDSIZE
       61 | # error Need to define __WORDSIZE
          |   ^~~~~
    In file included from ./find_nonzero.h:13,
                     from ./find_nonzero.c:11:
    ./ffs.h:61:3: error: #error Need to define __WORDSIZE
       61 | # error Need to define __WORDSIZE
          |   ^~~~~
    In file included from ./find_nonzero.h:13,
                     from ./find_nonzero_arm.c:7:
    ./ffs.h:61:3: error: #error Need to define __WORDSIZE
       61 | # error Need to define __WORDSIZE
          |   ^~~~~
    In file included from ./find_nonzero.h:13,
                     from ./find_nonzero_arm64.c:7:
    ./ffs.h:61:3: error: #error Need to define __WORDSIZE
       61 | # error Need to define __WORDSIZE
          |   ^~~~~
    In file included from ./find_nonzero.h:13,
                     from ./find_nonzero_avx.c:11:
    ./ffs.h:61:3: error: #error Need to define __WORDSIZE
       61 | # error Need to define __WORDSIZE
          |   ^~~~~
    In file included from ./find_nonzero.h:13,
                     from ./find_nonzero_sse2.c:7:
    ./ffs.h:61:3: error: #error Need to define __WORDSIZE
       61 | # error Need to define __WORDSIZE
          |   ^~~~~
    In file included from ./find_nonzero.h:13,
                     from ./libddr_crypt.c:18:
    ./ffs.h:61:3: error: #error Need to define __WORDSIZE
       61 | # error Need to define __WORDSIZE
          |   ^~~~~
    ./libddr_crypt.c:65:2: error: #error __WORDSIZE unknown
       65 | #error __WORDSIZE unknown
          |  ^~~~~
    ./libddr_hash.c:414:2: error: #error __WORDSIZE unknown
      414 | #error __WORDSIZE unknown
          |  ^~~~~
    ./libddr_lzo.c:48:2: error: #error __WORDSIZE unknown
       48 | #error __WORDSIZE unknown
          |  ^~~~~
    ./libddr_null.c:98:2: error: #error __WORDSIZE unknown
       98 | #error __WORDSIZE unknown
          |  ^~~~~
    ./sha512.c:180:2: error: #error __WORDSIZE unknown
      180 | #error __WORDSIZE unknown
          |  ^~~~~
    In file included from ./find_nonzero.h:13,
                     from ./test_aes.c:5:
    ./ffs.h:61:3: error: #error Need to define __WORDSIZE
       61 | # error Need to define __WORDSIZE
          |   ^~~~~
    Makefile:240: .dep: No such file or directory
    make: *** [Makefile:235: .dep] Error 1
    
     
  • Kurt Garloff

    Kurt Garloff - 2024-08-17

    __WORDSIZE I did not address. It should be defined by the C library, but musl might not do it? Can you grep through the include headers? I can try to find something in the official documentation ...
    Looks like I addressed all the other issues, though.

     
  • Erhard F.

    Erhard F. - 2024-08-17

    __WORDSIZE is defined in two places in musl:

    # cat /usr/include/bits/reg.h
    #undef __WORDSIZE
    #define __WORDSIZE 64
    #define R15    0
    #define R14    1
    #define R13    2
    #define R12    3
    #define RBP    4
    #define RBX    5
    #define R11    6
    #define R10    7
    #define R9     8
    #define R8     9
    #define RAX    10
    #define RCX    11
    #define RDX    12
    #define RSI    13
    #define RDI    14
    #define ORIG_RAX 15
    #define RIP    16
    #define CS     17
    #define EFLAGS 18
    #define RSP    19
    #define SS     20
    #define FS_BASE 21
    #define GS_BASE 22
    #define DS     23
    #define ES     24
    #define FS     25
    #define GS     26
    

    and

     # cat /usr/include/bits/user.h 
    #undef __WORDSIZE
    #define __WORDSIZE 64
    
    typedef struct user_fpregs_struct {
        uint16_t cwd, swd, ftw, fop;
        uint64_t rip, rdp;
        uint32_t mxcsr, mxcr_mask;
        uint32_t st_space[32], xmm_space[64], padding[24];
    } elf_fpregset_t;
    
    struct user_regs_struct {
        unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
        unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
        unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
    };
    #define ELF_NGREG 27
    typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
    
    struct user {
        struct user_regs_struct     regs;
        int             u_fpvalid;
        struct user_fpregs_struct   i387;
        unsigned long           u_tsize;
        unsigned long           u_dsize;
        unsigned long           u_ssize;
        unsigned long           start_code;
        unsigned long           start_stack;
        long                signal;
        int             reserved;
        struct user_regs_struct     *u_ar0;
        struct user_fpregs_struct   *u_fpstate;
        unsigned long           magic;
        char                u_comm[32];
        unsigned long           u_debugreg[8];
    };
    
    #define PAGE_MASK       (~(PAGESIZE-1))
    #define NBPG            PAGESIZE
    #define UPAGES          1
    #define HOST_TEXT_START_ADDR    (u.start_code)
    #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
    
     
  • Kurt Garloff

    Kurt Garloff - 2024-08-18

    Thanks for the insight!
    The headers in bits/ are not supposed to be included directly...
    If you could find out, which headers in include, include/sys or maybe include/Linux pull them in, that would be helpful.
    (Sorry, I don't have a musl system at hand. Or well, maybe I can grep through openwrt build system...)

     
  • Erhard F.

    Erhard F. - 2024-08-18

    Ok, didn't know that. But looks like the solution is straightforward:

      # cat /usr/include/sys/user.h
    #ifndef _SYS_USER_H
    #define _SYS_USER_H
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    #include <limits.h>
    #include <stdint.h>
    #include <unistd.h>
    
    #include <bits/user.h>
    
    #ifdef __cplusplus
    }
    #endif
    #endif
    

    or

     # cat /usr/include/sys/reg.h 
    #ifndef _SYS_REG_H
    #define _SYS_REG_H
    
    #include <limits.h>
    #include <unistd.h>
    
    #include <bits/reg.h>
    
    #endif
    
     
  • Kurt Garloff

    Kurt Garloff - 2024-08-18

    I added a test for sys/user.h existence and include in places where __WORDSIZE is being used.
    Feedback welcome!

     
  • Erhard F.

    Erhard F. - 2024-08-18

    This works now on your latest git. Thanks!

    Next thing I run into is:

    # make
    #gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DGEN_DEP -msse4.2 -maes -mavx2 -mvaes -mavx2 -mrdrnd -MM ./*.c >.dep
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DGEN_DEP -D__AES__ -D__SSE4_1__ -D__SSSE3__ -D__SSE3__ -D__SSE2__ -D__SSE__ -D__MMX__ -DNO_WARN_X86_INTRINSICS -I . -MM ./*.c >.dep
    sed 's/\.o:/\.po:/' <.dep >.dep2
    cat .dep2 >> .dep
    rm .dep2
    fatal: not a git repository (or any of the parent directories): .git
    cat: REL-ID: No such file or directory
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DVERSION=\"1.99.14\"  -D__COMPILER__="\"gcc (Gentoo 14.2.0 p4) 14.2.0\"" -DID=\"\"  -fPIE -c random.c
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -O3 -fPIE -c frandom.c
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -O3 -fPIE -c fmt_no.c
    In file included from fmt_no.c:13:
    fmt_no.h:8:17: error: unknown type name 'loff_t'; did you mean 'off_t'?
        8 |                 loff_t no, const char* bold, const int blen,
          |                 ^~~~~~
          |                 off_t
    fmt_no.h:16:17: error: unknown type name 'loff_t'; did you mean 'off_t'?
       16 |                 loff_t no, const char* bold, const char* norm, const char boldinvis)
          |                 ^~~~~~
          |                 off_t
    fmt_no.c:49:17: error: unknown type name 'loff_t'; did you mean 'off_t'?
       49 |                 loff_t no, const char* bold, const int blen,
          |                 ^~~~~~
          |                 off_t
    fmt_no.c:33:13: warning: 'fmtbufs' defined but not used [-Wunused-variable]
       33 | static char fmtbufs[8][64];
          |             ^~~~~~~
    fmt_no.c:24:12: warning: 'mypow' defined but not used [-Wunused-function]
       24 | static int mypow(int base, int pwr)
          |            ^~~~~
    make: *** [Makefile:251: fmt_no.o] Error 1
    
     
  • Erhard F.

    Erhard F. - 2024-08-18

    If I replace loff_t with off_t in fmt_no.h, fmt_no.c, fstrim.h, fstrim.c the build continues and I run later info:

     # make
    #gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DGEN_DEP -msse4.2 -maes -mavx2 -mvaes -mavx2 -mrdrnd -MM ./*.c >.dep
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DGEN_DEP -D__AES__ -D__SSE4_1__ -D__SSSE3__ -D__SSE3__ -D__SSE2__ -D__SSE__ -D__MMX__ -DNO_WARN_X86_INTRINSICS -I . -MM ./*.c >.dep
    sed 's/\.o:/\.po:/' <.dep >.dep2
    cat .dep2 >> .dep
    rm .dep2
    fatal: not a git repository (or any of the parent directories): .git
    cat: REL-ID: No such file or directory
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -DVERSION=\"1.99.14\"  -D__COMPILER__="\"gcc (Gentoo 14.2.0 p4) 14.2.0\"" -DID=\"\"  -fPIE -c fstrim.c
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -O3 -fPIE -msse2 -c find_nonzero_sse2.c
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -O3 -fPIE -msse4.2 -c ffs_sse42.c
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -fPIE -mrdrnd -maes -mavx2 -mvaes -c rdrand.c
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -O3 -fPIE -mavx2 -c find_nonzero_avx.c
    fatal: not a git repository (or any of the parent directories): .git
    cat: REL-ID: No such file or directory
    gcc -Os -Wall -g -D_FORTIFY_SOURCE=2  -DHAVE_CONFIG_H -I . -DHAVE_AESNI -fPIE -pie -DVERSION=\"1.99.14\"  -D__COMPILER__="\"gcc (Gentoo 14.2.0 p4) 14.2.0\"" -DID=\"\"  dd_rescue.c -o dd_rescue random.o frandom.o fmt_no.o find_nonzero.o  fstrim.o find_nonzero_sse2.o ffs_sse42.o rdrand.o find_nonzero_avx.o -ldl  -rdynamic
    In file included from dd_rescue.c:163:
    fallocate64.h:29:9: error: unknown type name 'off64_t'; did you mean 'off_t'?
       29 | typedef off64_t __off64_t;
          |         ^~~~~~~
          |         off_t
    In file included from dd_rescue.c:87:
    fallocate64.h:31:19: error: conflicting types for 'fallocate'; have 'int(int,  int,  __off64_t,  __off64_t)' {aka 'int(int,  int,  int,  int)'}
       31 | static inline int fallocate64(int fd, int mode, __off64_t start, __off64_t len)
          |                   ^~~~~~~~~~~
    /usr/include/fcntl.h:186:5: note: previous declaration of 'fallocate' with type 'int(int,  int,  off_t,  off_t)' {aka 'int(int,  int,  long int,  long int)'}
      186 | int fallocate(int, int, off_t, off_t);
          |     ^~~~~~~~~
    dd_rescue.c:185:3: warning: #warning We lack stat64, may not handle >2GB files correctly [-Wcpp]
      185 | # warning We lack stat64, may not handle >2GB files correctly
          |   ^~~~~~~
    dd_rescue.c:190:3: warning: #warning We lack lseek64, may not handle >2GB files correctly [-Wcpp]
      190 | # warning We lack lseek64, may not handle >2GB files correctly
          |   ^~~~~~~
    make: *** [Makefile:370: dd_rescue] Error 1
    
     

    Last edit: Erhard F. 2024-08-18
  • Kurt Garloff

    Kurt Garloff - 2024-08-18

    loff_t should be declared in sys/types.h if _GNU_SOURCE is defined, off64_t if _LARGEFILE64_SOURCE is defined. Does it work that way with musl?

     
  • Erhard F.

    Erhard F. - 2024-08-18

    In sys/types.h (git.musl-libc.org) only off64_t is defined.

    In fcntl.h (git.musl-libc.org) both, loff_t and off64_t are defined.

     
  • Kurt Garloff

    Kurt Garloff - 2024-08-20

    I have done some work on an Alpine chroot on Android (with UserLand).
    I found a number of compile issues:

    • The autoconf tests for the *64 functions did all fail. musl seems to provide these functions via #define tricks, so a test that just tries linking against libc is insufficient
    • I need to include a few more headers such as fcntl.h and ensure _LARFEFOLE64_SOURCE and _GNU_SOURCE

    Things compile without any extra effort now on Alpine. Do you want to check latest git against your environment?

     
  • Erhard F.

    Erhard F. - 2024-08-20

    I can confirm that latest git DD_RESCUE_1_99_BRANCH builds fine now on my musl 1.2.4 and musl 1.2.5 boxes.

    Many thanks for your efforts!

     
  • Kurt Garloff

    Kurt Garloff - 2024-08-20

    Thanks for testing and confirming!
    Does it also pass the make check target?
    I will push this also into OBS (openSuSE'sOopen Build Service) to have it built for many different distributions and architectures. There is a small risk that it breaks on 32bit architectures, as I have changed the checks and defines for LFS (Large File Support) functions ...

     
  • Erhard F.

    Erhard F. - 2024-08-20

    This is the output I captured via make check &> check_output.txt.

    If you are interested whether it builds on 32bit I could test on my i686 box (glibc) and ppc32 box (glibc, musl) too. ;-)

     
  • Kurt Garloff

    Kurt Garloff - 2024-08-21

    Checking is appreciated.
    Logfile looks good though cut-off.
    make check exits with a failure code in case of issues. Whether that happens is actually all I need to know.
    OBS project at https://build.opensuse.org/package/show/home:garloff:storage/dd_rescue

     
  • Kurt Garloff

    Kurt Garloff - 2024-08-21

    Just for the record: I pushed a few more changes to git:
    The fact that basename() may change the argument and may return a pointer to a buffer that might be overwritten requires us to use strdup(basename(strdupa(nm))) in some cases. To add insult oto injury, strdupa() does not exist on BIONIC and thus needs to be open-coded (which is straight-forward -- if we can rely on GNU extensions).
    So I submitted to the NIH and opencoded basename in mybasename.h, avoiding all these memory allocation pains just for safety.
    (In fairnesss, glibc does NOT do stupid things, and other C libs probably not either. But we can only rely on POSIX, sigh.)

     
  • Erhard F.

    Erhard F. - 2024-08-21

    Current builds fine on musl 1.2.4 and 1.2.5.

    On my musl 1.2.5 box make check fails like this:

    ./test_aes AES256+-CTR 10 0 130
    ./test_aes AES256x2-CTR 10 0 130
    # *** Reverse ***
    #Validating enc/decryption  AES192-CTR ::keysfile:ivsfile
    ./dd_rescue -qptAr -L ./libddr_crypt.so=enc:weakrnd:alg=AES192-CTR:keygen:ivgen::keysfile:ivsfile dd_rescue dd_rescue.enc
    ./dd_rescue -qptAr -L ./libddr_crypt.so=dec:weakrnd:alg=AES192-CTR::keysfile:ivsfile dd_rescue.enc dd_rescue.cmp
    #Validating enc/decryption  AES192-ECB ::keysfile:ivsfile
    ./dd_rescue -qptAr -L ./libddr_crypt.so=enc:weakrnd:alg=AES192-ECB:keygen:ivgen::keysfile:ivsfile dd_rescue dd_rescue.enc
    ./dd_rescue -qptAr -L ./libddr_crypt.so=dec:weakrnd:alg=AES192-ECB::keysfile:ivsfile dd_rescue.enc dd_rescue.cmp
    #Validating enc/decryption  AES192-CTR ::keysfile:ivsfile
    ./dd_rescue -qptA -L ./libddr_crypt.so=enc:weakrnd:alg=AES192-CTR:::keysfile:ivsfile dd_rescue dd_rescue.enc
    ./dd_rescue -qptA -L ./libddr_crypt.so=dec:weakrnd:alg=AES192-CTR::keysfile:ivsfile dd_rescue.enc dd_rescue.cmp
    ./dd_rescue -qAx -L ./libddr_crypt.so=enc:weakrnd:alg=AES192-CTR:keysfile:ivsfile dd_rescue dd_rescue.enc
    dd_rescue: (warning): crypt(0): dd_rescue: (info): ipos:       128.0k, opos:       350.2k, xferd:       128.0k
                       errs:      0, errxfer:         0.0k, succxfer:       127.0k
                 +curr.rate:   119738kB/s, avg.rate:   119738kB/s, avg.load: 33.6%
                 >.......................-.................<  57%  ETA:  0:00:00 
    make[1]: *** [Makefile:712: check_crypt] Error 1
    make[1]: Leaving directory '/root/builddir/ddrescue-code-eaeca866e187b27f5b5098800f48971a1167505b'
    make: *** [Makefile:580: check] Error 2
    

    I'll check i686 and ppc32 next.

     
  • Erhard F.

    Erhard F. - 2024-08-21

    Ok, 32bit building & testing went fine on i686 glibc and ppc32 glibc. Only testfailure on ppc32 musl 1.2.4:

    [...]
    ./test_aes AES192x2-CTR 10 0 130
    ./test_aes AES256-CTR 10 0 130
    ./test_aes AES256+-CTR 10 0 130
    ./test_aes AES256x2-CTR 10 0 130
    # *** Reverse ***
    #Validating enc/decryption  AES192-CTR ::keysfile:ivsfile
    ./dd_rescue -qptAr -L ./libddr_crypt.so=enc:weakrnd:alg=AES192-CTR:keygen:ivgen::keysfile:ivsfile dd_rescue dd_rescue.enc
    ./dd_rescue -qptAr -L ./libddr_crypt.so=dec:weakrnd:alg=AES192-CTR::keysfile:ivsfile dd_rescue.enc dd_rescue.cmp
    #Validating enc/decryption  AES192-ECB ::keysfile:ivsfile
    ./dd_rescue -qptAr -L ./libddr_crypt.so=enc:weakrnd:alg=AES192-ECB:keygen:ivgen::keysfile:ivsfile dd_rescue dd_rescue.enc
    ./dd_rescue -qptAr -L ./libddr_crypt.so=dec:weakrnd:alg=AES192-ECB::keysfile:ivsfile dd_rescue.enc dd_rescue.cmp
    #Validating enc/decryption  AES192-CTR ::keysfile:ivsfile
    ./dd_rescue -qptA -L ./libddr_crypt.so=enc:weakrnd:alg=AES192-CTR:::keysfile:ivsfile dd_rescue dd_rescue.enc
    ./dd_rescue -qptA -L ./libddr_crypt.so=dec:weakrnd:alg=AES192-CTR::keysfile:ivsfile dd_rescue.enc dd_rescue.cmp
    ./dd_rescue -qAx -L ./libddr_crypt.so=enc:weakrnd:alg=AES192-CTR:keysfile:ivsfile dd_rescue dd_rescue.enc
    dd_rescue: (warning): crypt(0): dd_rescue: (info): ipos:       256.0k, opos:       516.6k, xferd:       256.0k
                       errs:      0, errxfer:         0.0k, succxfer:       255.0k
                 +curr.rate:    52438kB/s, avg.rate:    52438kB/s, avg.load: 51.9%
                 >.......................................-.<  98%  ETA:  0:00:00 
    make[1]: *** [Makefile:712: check_crypt] Error 1
    make[1]: Leaving directory '/root/builddir/ddrescue-code-eaeca866e187b27f5b5098800f48971a1167505b'
    make: *** [Makefile:580: check] Error 2
    
     
  • Kurt Garloff

    Kurt Garloff - 2024-08-21

    I have seen this also on aarch64 musl. No reported error, but an exit code of 1 from this exact same test. Will need to study code to understand how this can happen.

     
  • Kurt Garloff

    Kurt Garloff - 2024-08-22

    OK, this is due to errno not being cleared always.
    Fix in git (aa22c34).

     
  • Erhard F.

    Erhard F. - 2024-08-22

    Thanks! Tests pass now flawlessly on ppc32 musl .

    All those changes now in place are probably a good excuse to do a new point release? ;-)

     
  • Kurt Garloff

    Kurt Garloff - 2024-08-22

    Done on my homepage, and tagged with DD_RESCUE_1_99_14

     
  • Kurt Garloff

    Kurt Garloff - 2024-08-22

    I pushed one more change to configure.ac after the release.
    There was a conflict to set _FORTIFY_SOURCE in configure with flags passed in by the build system e.g. on openSUSE Tumbleweed. Removed it.

    I think this issue can be closed.

     
  • Erhard F.

    Erhard F. - 2024-08-22

    Thanks for your work and for the new release!

    Seems you need to close the issue; I don't see any option or button to accomplish myself...

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

MongoDB Logo MongoDB