Skip to content

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

Closed

Description

@fanquake

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 google/oss-fuzz#10562.

Activity

  1. maflcko commented on Jul 18, 2023

    @maflcko
    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.

  2. fanquake commented on Jul 18, 2023

    @fanquake
    MemberAuthor

    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.

  3. hebasto commented on Jul 22, 2023

    @hebasto
    Member

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

  4. hebasto commented on May 8, 2025

    @hebasto
    Member

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

    $ 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.

  5. locked and limited conversation to collaborators on Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions