build: depends sqlite compile failure for FreeBSD Clang cross #33560

issue fanquake openend this issue on October 7, 2025
  1. fanquake commented at 11:11 am on October 7, 2025: member

    Using master (919e6d01e93a57d991ed456bc67c43605583ada8) and doing something like:

    0make -C depends/ HOST=aarch64-unknown-freebsd CC=clang CXX=clang++ CFLAGS="--sysroot=/path/to/sysroot/ " CXXFLAGS="--sysroot=/path/to/sysroot/ -stdlib=libc++" LDFLAGS="-fuse-ld=lld" AR=llvm-ar STRIP=llvm-strip NM=llvm-nm RANLIB=llvm-ranlib NO_QT=1
    

    Results in:

     0libtool: compile:  clang -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.46.1\" "-DPACKAGE_STRING=\"sqlite 3.46.1\"" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.46.1\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_ZLIB_H=1 -I. -I/bitcoin/depends/aarch64-unknown-freebsd/include -DSQLITE_DQS=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_JSON -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_AUTOINIT -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_HAVE_ZLIB --sysroot=/opt/cross-freebsd-14/ -pipe -std=c11 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c sqlite3.c  -fPIC -DPIC -o sqlite3.o
     1sqlite3.c:38913:42: error: use of undeclared identifier 'mremap'
     2 38913 |   { "mremap",       (sqlite3_syscall_ptr)mremap,          0 },
     3       |                                          ^
     4sqlite3.c:38988:22: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall[]'
     5 38988 |     for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
     6       |                      ^~~~~~~~~~
     7sqlite3.c:38997:22: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall[]'
     8 38997 |     for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
     9       |                      ^~~~~~~~~~
    10sqlite3.c:39024:20: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall[]'
    11 39024 |   for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){
    12       |                    ^~~~~~~~~~
    13sqlite3.c:39041:16: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall[]'
    14 39041 |     for(i=0; i<ArraySize(aSyscall)-1; i++){
    15       |                ^~~~~~~~~~~~~~~~~~~
    16sqlite3.c:15273:38: note: expanded from macro 'ArraySize'
    17 15273 | #define ArraySize(X)    ((int)(sizeof(X)/sizeof(X[0])))
    18       |                                      ^~~
    19sqlite3.c:39045:14: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall[]'
    20 39045 |   for(i++; i<ArraySize(aSyscall); i++){
    21       |              ^~~~~~~~~~~~~~~~~~~
    22sqlite3.c:15273:38: note: expanded from macro 'ArraySize'
    23 15273 | #define ArraySize(X)    ((int)(sizeof(X)/sizeof(X[0])))
    24       |                                      ^~~
    25sqlite3.c:43706:42: error: use of undeclared identifier 'MREMAP_MAYMOVE'
    26 43706 |     pNew = osMremap(pOrig, nReuse, nNew, MREMAP_MAYMOVE);
    27       |                                          ^
    287 errors generated.
    29make[1]: *** [Makefile:542: sqlite3.lo] Error 1
    
  2. fanquake added the label Build system on Oct 7, 2025
  3. willcl-ark commented at 11:47 am on October 7, 2025: member

    Does adding

    0$(package)_cppflags_freebsd+=-DHAVE_MREMAP=0
    

    to depends/packages/sqlite.mk help?

    I can’t test myself easily, so not sure if that will simply progress onto another error…

  4. hebasto commented at 11:49 am on October 7, 2025: member
    cc @vasild
  5. vasild commented at 6:21 pm on October 7, 2025: contributor

    When I run this on Ubuntu 24.04.3 I get:

    0$ make -C depends/ HOST=aarch64-unknown-freebsd CC=clang CXX=clang++ CFLAGS="--sysroot=/path/to/sysroot/ " CXXFLAGS="--sysroot=/path/to/sysroot/ -stdlib=libc++" LDFLAGS="-fuse-ld=lld" AR=llvm-ar STRIP=llvm-strip NM=llvm-nm RANLIB=llvm-ranlib NO_QT=1
    1...
    2Configuring boost...
    3-- The CXX compiler identification is Clang 18.1.3
    4-- Detecting CXX compiler ABI info
    5-- Detecting CXX compiler ABI info - failed
    6-- Check for working CXX compiler: /usr/bin/clang++
    7-- Check for working CXX compiler: /usr/bin/clang++ - broken
    8...
    9clang++: error: invalid linker name in argument '-fuse-ld=lld'
    

    The OP is a bit scarce. Have this worked before? Is it a recent regression? In what environment to run the above command to reproduce the error?

  6. willcl-ark commented at 8:49 am on October 8, 2025: member

    Cross-compiling for freebsd from linux using clang is just currently untested/unused.

    This branch includes a patch to fix sqlite use of mremap and a build script demonstrating a freebsd crosscompile from linux using clang and a freebsd sysroot:

    https://github.com/bitcoin/bitcoin/compare/master...willcl-ark:bitcoin:cross-compile-freebsd-depends

    (tested with clang18 and freebsd 14.2 and 14.3 only).

    If we moved to using clang in the guix builds a similar process could perhaps be used to provide freebsd (and other) release binaries.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-10-10 15:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me