user2748943
user2748943

Reputation: 563

configure: error: cannot run C compiled programs

I'm trying to install different software onto my Raspberry Pi with Debian Wheezy OS. When I run try to configure software I'm trying to install I get this output

checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling...  configure: error: in 'directory of where I'm installing the software'
configure: error: cannot run C compiled programs.
If you meant to cross compile, use '--host'.
See config.log' for more details

So then I check the config log and it basically says the same thing, the only difference is I see there was a segfault when checking whether cross compiling:

configure:3547: checking for suffix of executables
configure:3554: /usr/bin/gcc -o conftest -Wno-long-long    conftest.c  >&5
configure:3558: $? = 0
configure:3580: result: 
configure:3602: checking whether we are cross compiling
configure:3610: /usr/bin/gcc -o conftest -Wno-long-long    conftest.c  >&5
configure:3614: $? = 0
configure:3621: ./conftest
./configure: line 3623:  3679 Segmentation fault    ./conftest$ac_cv_exeext
configure:3625: $? = 139
configure:3632: error: in `/usr/local/src/VALGRIND/valgrind-3.10.1':
configure:3634: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

This error has come up twice now. Once when trying to install Valgrind and once when trying to install libusb.

The output with gcc -v is this:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-14+rpi1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-   languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-14+rpi1) 

Upvotes: 20

Views: 53534

Answers (4)

David Liu
David Liu

Reputation: 31

In my case, the reason was that the version of libasan did not match the version of gcc. Just update the version of libasan.aarch64 to be the same as the gcc version.

[root@node1 isa-l]# cat /etc/os-release
NAME="openEuler"
VERSION="22.03 (LTS-SP1)"
ID="openEuler"
VERSION_ID="22.03"
PRETTY_NAME="openEuler 22.03 (LTS-SP1)"
ANSI_COLOR="0;31"

platform: Kunpeng-920

[root@node1 isa-l]# yum list installed |grep gcc
gcc.aarch64                                                                10.3.1-20                          @OS
gcc-11.2.0-runtimes-Generic-AArch64-RHEL-8-aarch64-linux.aarch64           11.2.0-193                         @System
gcc-c++.aarch64                                                            10.3.1-20                          @OS
gcc-gdb-plugin.aarch64                                                     10.3.1-20                          @OS
gcc-gfortran.aarch64                                                       10.3.1-20                          @OS
libgcc.aarch64                                                             10.3.1-20                          @OS
[root@node1 isa-l]# yum list installed |grep asan
libasan.aarch64                                                            10.3.1-20                          @everything

Upvotes: 1

hughes
hughes

Reputation: 5713

I got this exact error. When I looked in config.log I saw the message:

fatal error: sys/cdefs.h: No such file or directory

To fix this, I ran:

sudo apt-get install libc6-dev

I could then configure and compile my program.

Upvotes: 1

pengchy
pengchy

Reputation: 820

The problem here has been resolved by:

export PATH=/path/to/gcc-4.9.2/bin/:$PATH
export LD_LIBRARY_PATH=/path/to/gcc-4.9.2/lib64/:$LD_LIBRARY_PATH
./configure --prefix=/path/to/  --host=arm

Hope this will help you.

Upvotes: 6

Eric A Suess
Eric A Suess

Reputation: 41

On CoreOS, solved the problem with.

install.packages('rgdal', type = "source", configure.args='--host=host')

Upvotes: 4

Related Questions