Solved gcc8 compile fails "cannot run C compiled programs"

trev

Daemon

Reaction score: 297
Messages: 1,018

A host of other ports just compiled without issue (eg apache) but gcc8 fails with this:

Code:
configure:3506: checking for C compiler default output file name
configure:3528: /usr/ports/lang/gcc8/work/.build/./gcc/xgcc -B/usr/ports/lang/gcc8/work/.build/./gcc/ -B/usr/local/x86_64-portbld- 
freebsd11.2/bin/ -B/usr/local/x86_64-portbld-freebsd11.2/lib/ -isystem /usr/local/x86_64-portbld-freebsd11.2/include -isystem /usr/local 
/x86_64-portbld-freebsd11.2/sys-include  -m32 -g -O2 -pipe  -DLIBICONV_PLUG -fno-strict-aliasing    conftest.c  >&5
configure:3532: $? = 0
configure:3569: result: a.out
configure:3585: checking whether the C compiler works
configure:3594: ./a.out
eval: ./a.out: Exec format error
configure:3598: $? = 126
configure:3605: error: in `/usr/ports/lang/gcc8/work/.build/x86_64-portbld-freebsd11.2/32/libgcc':
configure:3609: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

Any ideas?

Looking through my pkg logs it was last compiled successfully in February:

pkg.log.1.bz2:Feb 25 11:31:53 shadow pkg: gcc8-8.2.0_4 deinstalled
pkg.log.1.bz2:Feb 25 11:32:07 shadow pkg-static: gcc8-8.3.0 installed
 
OP
T

trev

Daemon

Reaction score: 297
Messages: 1,018

The solution: make config and uncheck the MULTILIB Build support for 32-bit and 64-bit targets option. The compiler then builds without issue.
 
  • Thanks
Reactions: ksb
Top