Skip to content

libffi compilation does not use bundled g++ on Windows

Building GHC fails on Windows (at least on mingw32) if there is no host g++ compiler available. The cause seems to be that configure script looks for a C++ compiler and fails to find one.

Here's the invocation of the libffi configure script from the main build:

cd libffi && \

\

cd build && \

CC=C:/Users/Gintas/Downloads/msys32/home/Gintas/ghc/inplace/mingw/bin/gcc.exe \

LD=C:/Users/Gintas/Downloads/msys32/home/Gintas/ghc/inplace/mingw/bin/ld.exe \

AR=/usr/bin/ar \

NM=C:/Users/Gintas/Downloads/msys32/home/Gintas/ghc/inplace/mingw/bin/nm.exe \

RANLIB=C:/Users/Gintas/Downloads/msys32/home/Gintas/ghc/inplace/mingw/bin/ranlib.exe \

CFLAGS=" -U__i686 -march=i686 -fno-stack-protector -w" \

LDFLAGS=" -w" \

"/bin/sh" ./configure \

--prefix=C:/Users/Gintas/Downloads/msys32/home/Gintas/ghc/libffi/build/inst \

--libdir=C:/Users/Gintas/Downloads/msys32/home/Gintas/ghc/libffi/build/inst/lib \

--enable-static=yes \

--enable-shared=no \

--host=i386-unknown-mingw32

Note that CC is overridden, but CXX is not. The configure script then looks for a C++ compiler and finds KCC, which is not even a compiler but a kerberos tool:

checking for g++... no checking for c++... no checking for gpp... no checking for aCC... no checking for CC... no checking for cxx... no checking for cc++... no checking for cl.exe... no checking for FCC... no checking for KCC... KCC checking whether we are using the GNU C++ compiler... no checking whether KCC accepts -g... no checking dependency style of KCC... none

This causes the configure script to fail later on.

g++ is not actually used in the build (looks like it's only needed for one test case), passing in gcc for CXX seems to work fine.

Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Build System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information