32-bit Linux: build flags lost with depends & overriden CC(X) #28096

issue fanquake opened this issue on July 18, 2023
  1. fanquake commented at 10:39 AM on July 18, 2023: member

    Building depends for 32-bit Linux (i686-pc-linux-gnu) but setting CC/CXX, causes us to loose build flags, and ultimately build a 64-bit executable:

    # make -C depends/ HOST=i686-pc-linux-gnu -j9 NO_QT=1 NO_WALLET=1 NO_ZMQ=1 NO_UPNP=1 NO_USDT=1 NO_NATPMP=1 CC=clang CXX=clang++
    ...
    copying packages: boost libevent
    to: /home/ubuntu/bitcoin/depends/i686-pc-linux-gnu
    
    ./autogen.sh
    CONFIG_SITE=/home/ubuntu/bitcoin/depends/i686-pc-linux-gnu/share/config.site ./configure
    make -9
    ....
    # file src/bitcoind
    src/bitcoind: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=737f136c656f8dd3f5510e0d4d74b20880231066, for GNU/Linux 3.2.0, not stripped
    

    We currently work around something similar in our oss-fuzz builds, i.e https://github.com/google/oss-fuzz/pull/10562.

  2. fanquake added the label Build system on Jul 18, 2023
  3. maflcko commented at 10:58 AM on July 18, 2023: member

    Isn't -m32 set by oss-fuzz already? Also, if you compile locally, I'd always assume you'd have to embed -m32 into the CC and CXX env vars.

  4. fanquake commented at 11:02 AM on July 18, 2023: member

    Isn't -m32 set by oss-fuzz already?

    Yes. I think in the oss-fuzz case it's an additional interaction with DEBUG=1, which causes sqlite to loose the flags.

    Also, if you compile locally, I'd always assume you'd have to embed -m32 into the CC and CXX env vars.

    Builds work as expected when not overriding CC & CXX, I don't think there's a reason to expect that not to work, without additional flags, when using a different compiler.

  5. hebasto commented at 7:27 AM on July 22, 2023: member

    This issue seems related to another one with overridden CC and CXX -- #23571.

  6. hebasto commented at 2:13 PM on May 8, 2025: member

    I've just re-checked on Ubuntu 25.04 for the master branch @ 66c968b4b4a98b1d476cb79b0dd2f6b09420c945:

    $ sudo apt install g++-multilib
    $ gmake -C depends -j $(nproc) HOST=i686-pc-linux-gnu NO_QT=1 NO_WALLET=1 NO_ZMQ=1 NO_USDT=1 CC=clang CXX=clang++
    $ cmake -B build --toolchain depends/i686-pc-linux-gnu/toolchain.cmake
    $ cmake --build build -t bitcoind
    $ file build/bin/bitcoind 
    build/bin/bitcoind: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=e2fb9df45feabf0a787564360c634b5d7bf7930f, for GNU/Linux 3.2.0, with debug_info, not stripped
    

    It seems to work fine.

  7. fanquake closed this on May 8, 2025


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: 2026-04-26 06:13 UTC

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