Skip to content

CFLAGS passed to bindist configure do not get saved to the settings file

I've been trying to leverage multilib support in GCC to install an i386 GHC on an x86_64 system. This requires passing -m32 on all invocations of GCC.

I downloaded the i386 bindist: https://downloads.haskell.org/~ghc/9.8.1/ghc-9.8.1-i386-deb10-linux.tar.xz and ran configure with:

./configure CFLAGS=-m32 CXXFLAGS=-m32
make install

The configure script did use the flags to run its compilation tests (without them the tests do not pass), and GHC was installed successfully, however its settings file didn't contain the -m32 flags, and GHC was unable to build anything.

I would expect that the installed GHC would run GCC with the same CFLAGS as it used in the tests in ./configure.

Workarounds:

  • Manually edit the settings file (PREFIX/lib/ghc-9.8.1/lib/settings) and add -m32 to "C compiler flags" and "C++ compiler flags".
  • Configure with ./configure CFLAGS=-m32 CXXFLAGS=-m32 CONF_CC_OPTS_STAGE2=-m32 CONF_CXX_OPTS_STAGE2=-m32

Doing either of these installs a 32-bit GHC that works just fine.

  • GHC version used: 9.8.1
  • Operating System: linux
  • System Architecture: x86_64/i386

Cc: @maerwald

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information