Topic: [SOLVED] C compiler cannot create executables

I am cross compiling on a Intel based Linux Ubuntu system for a Arm iMX6.

And I am having the most basic error on building.

On autoconfigure I do this:

./configure CC=/usr/bin/arm-linux-gnueabihf-gcc-4.7

And I get this:

checking for gcc... /usr/bin/arm-linux-gnueabihf-gcc-4.7
checking whether the C compiler works... no
configure: error: in `/home/jps/Downloads/WolfSSL/wolfssl-4.4.0':
configure: error: C compiler cannot create executables
See `config.log' for more details

That is is the compiler I use for all of the product code we write so I know it works.
No information in config.log

please help

Share

Re: [SOLVED] C compiler cannot create executables

Hi weaver4,

Usually its because the cross-compiler requires something additional like the CPU architecture. If you look in config.log it should explain.

Here are a couple of ARM cross compiles I've used:

./configure CC=arm-linux-gnueabihf-gcc-5 --host=arm-linux-gnueabihf --enable-armasm --enable-all --enable-debug --disable-shared --enable-static  CFLAGS="-mcpu=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8"
./configure --host=arm-none-eabi CC=gcc AR=ar 

RISC-V:

./configure --host=riscv64 \
    CC="riscv64-sifive-linux-gnu-gcc" \
    --with-sysroot="buildroot_initramfs_sysroot/" \
    --disable-shared \
    --enable-sp \
    CFLAGS="-mabi=lp64d -march=rv64imafdc"

MIPS:

./configure --host=mips64 CC="mips64-octeon-linux-gnu-gcc -mabi=64"

Thanks,
David Garske, wolfSSL

Share

Re: [SOLVED] C compiler cannot create executables

I have tried:

./configure --host=arm-linux-gnueabihf CC=/usr/bin/arm-linux-gnueabihf-gcc-4.7 CFLAGS="-mcpu=cortex-a9 -mtune=cortex-a9 -march=armv7-a -mvectorize-with-neon-quad -mfpu=neon -mfloat-abi=hard -Wno-write-strings -Wno-deprecated"

And got the same results.

But now I see in the log file this message:

configure:3648: checking whether the C compiler works
configure:3670: /usr/bin/arm-linux-gnueabihf-gcc-4.7 -mcpu=cortex-a9 -mtune=cortex-a9 -march=armv7-a -mvectorize-with-neon-quad -mfpu=neon -mfloat-abi=hard -Wno-write-strings -Wno-deprecated   conftest.c  >&5
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:3674: $? = 1
configure:3712: result: no

So how do I tell it where to find crt1.o for the arm?  I tried:

LDFLAGS="-L/home/jps/Development/Platypus/common-deb7/rootfs_of_arm/usr/lib/arm-linux-gnueabihf/"

but it still looked in (according to log):
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld

Share

Re: [SOLVED] C compiler cannot create executables

OK got it to do ./configure with using this command:

./configure --host=arm-linux-gnueabihf CC=/usr/bin/arm-linux-gnueabihf-gcc-4.7 CFLAGS="-mcpu=cortex-a9 -mtune=cortex-a9 -march=armv7-a -mvectorize-with-neon-quad -mfpu=neon -mfloat-abi=hard -Wno-write-strings -Wno-deprecated" LDFLAGS='--sysroot=/home/jps/Development/Platypus/Z2-R2/../common-deb7/rootfs_of_arm'

Setting the sysroot seemed to be the key.

Share

Re: [SOLVED] C compiler cannot create executables

Hi weaver4,

You might consider moving the --sysroot out of the LDFLAGS and using --with-sysroot=.

Thanks,
David Garske, wolfSSL

Share

Re: [SOLVED] C compiler cannot create executables

It does not seem to work:

This works:
./configure --host=arm-linux-gnueabihf CC="/usr/bin/arm-linux-gnueabihf-gcc-4.7" CFLAGS="-mcpu=cortex-a9 -mtune=cortex-a9 -march=armv7-a -mvectorize-with-neon-quad -mfpu=neon -mfloat-abi=hard -Wno-write-strings -Wno-deprecated" LDFLAGS="--sysroot=/home/jps/Development/Platypus/common-deb7/rootfs_of_arm"

But this does not:
./configure --host=arm-linux-gnueabihf --with-sysroot="/home/jps/Development/Platypus/common-deb7/rootfs_of_arm/" CC="/usr/bin/arm-linux-gnueabihf-gcc-4.7" CFLAGS="-mcpu=cortex-a9 -mtune=cortex-a9 -march=armv7-a -mvectorize-with-neon-quad -mfpu=neon -mfloat-abi=hard -Wno-write-strings -Wno-deprecated"

Why is that?

Share

Re: [SOLVED] C compiler cannot create executables

Resolved by changing the compiler to gcc-8

Share