Cross Compiling libcurl for arm-linux-gnueabihf: Unable to link function recv

Viewed 3607

I'm trying to cross-compile libcurl (version 7.54.0) for arm-linux-gnueabihf, I have the toolkit installed in my $PATH. I'm running the command to configure libcurl:

./configure --enable-static --disable-shared --prefix=/usr/arm-linux-gnueabihf --host=arm-linux-gnueabi --build=i686-pc-linux-gnu CC=arm-linux-gnueabihf-gcc

It starts configuring but then outputs: checking if sig_atomic_t is already defined as volatile... yes checking return type of signal handlers... void checking for sys/select.h... (cached) yes checking for sys/socket.h... (cached) yes checking for select... no checking for sys/types.h... (cached) yes checking for sys/socket.h... (cached) yes checking for recv... no configure: error: Unable to link function recv

I believe it may have something to do with the shared libraries, I installed arm-linux-gnueabihf-gcc via sudo apt-get install arm-linux-gnueabihf-gcc

2 Answers

The function recv is the first to be check in terms of execution and linking by autotools. The standard flags for the test comprehend also -lz , which is the flag to link the zlib ( see the file config.log below ) :

 configure:21072: arm-linux-gnueabihf-gcc-4.9 -o conftest -O2 -Wno-error -Werror-implicit-function-declaration -Wno-system-headers -O2 -Wno-error        conftest.c -lbrotlidec   -lz  >&5
 /usr/lib/gcc-cross/arm-linux-gnueabihf/4.9/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lbrotlidec
 /lib/../lib/libz.so: file not recognized: File format not recognized   

If you are cross compiling, the system location - generally /lib/libz.so - is not good. Please ensure to place the correct location of zlib using --with-zlib .

Related