Hi,

I recall fiddling out what happens in such cases by copying the entire compiler 
invocation from the log and run it by hand
Good luck… I think this will be one of the more trivial problems you will 
encounter on this journey

Erik

From: curl-library [mailto:[email protected]] On Behalf Of 
Gianfilippo Fornaro via curl-library
Sent: donderdag 24 augustus 2017 23:20
To: [email protected]
Cc: Gianfilippo Fornaro <[email protected]>
Subject: Cross-compile libcurl for embedded arm target running freeRtos and 
LWIP stack

Hi everybody,
What I want to do is compile libcurl library for my target platform: an arm 
microcontroller from NXP based on a arm-cortex-m4, 32bit, flash ram and flash 
rom are not a concern.
I need to do this beacause I need to use an other library which requests an 
https-client "object" providing a suitable interface. So whilst I am "only" in 
the need to provide it an https-client, that library do provide not only an 
interface but also an implementation of this client using libcurl. So at a 
first glance it seems that cross-compile libcurl will worth the work.

-As an environment system, I can use either windows7(64bit) or ubuntu 16(64bit).
-The toolchain is the arm-none-eabi one, but NXP has made a redlib.spec custom 
C library that is used in C projects (it is passed to compiler trough 
-spec=redlib.spec; see https://community.nxp.com/thread/389152 )
-As a cryptoghraphic library I will use mbedTLS.
-libcurl version curl-7.55.0

AFAIK libcurl does not need an OS to run, but a TCP-IP stack that can provide 
unix-like network api. Morover I read that with the proper optimization it has 
a little foot-print.
I think I have detected two distinct ways to try to achive my goal.
I here try to well describe them both, guessing to collect as much advaices as 
I can from you.

1) Linux env(to semplify stuff). Build libcurl from sources using make build, 
preparing a cross-compile environment for make configure step and use the LWIP 
stack.
2) In mcuExpresso IDE, which is actually the IDE of NXP, a flavour of  Eclipse, 
import the libcurl source code, do some code tailoring keeping only the code 
that I really need. Let the IDE do the compilation.

If you have any suggestion about any other ways, please do inform me.

Till now I tried only point 1) with no success.
To accomplish it I did the following: prepared a library (libProject_prova1.a) 
from freeRtos + LWIP + drivers sources. Then I used libProject_prova1.a  in the 
make configuration step as the library to link against in order to let libcurl 
find all the network and 'system' api it needs along with the redlib.spec .
What I obtained is:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
checking forgrep.../bin/grep
checking foregrep.../bin/grep -E
checking fora BSD-compatible install.../usr/bin/install -c
checking forarm-none-eabi-gcc...arm-none-eabi-gcc
checking whether the C compiler works...no
configure:error:in 
`/home/user/Desktop/curl_libProject_prova1/curl-7.55.0':configure:error:C 
compiler cannot create executables See`config.log' for more details

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
And the config.log shows the following:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
configure:4781:checking whether the C compiler works
configure:4803:arm-none-eabi-gcc -O0 -fno-common -g3 -Wall-c 
-fmessage-length=0-fno-builtin -ffunction-sections -fdata-sections 
-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb --specs=redlib.specs 
-D__REDLIB__ -DUSE_LWIPSOCK -DLWIP_DNS=1-DUSE_RTOS=1-DCR_INTEGER_PRINTF 
-DSDK_DEBUGCONSOLE=0-D__MCUXPRESSO -D__USE_CMSIS -DNDEBUG -DFSL_RTOS_FREE_RTOS 
-DSDK_OS_FREE_RTOS -DCPU_LPC54608J512ET180 -DCPU_LPC54608J512ET180_cm4 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/include/lwip
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/include/lwip/priv
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/include/lwip/prot
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/include/netif
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/include/netif/ppp
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/include/netif/ppp/polarssl
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/include/posix
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/include/posix/sys
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/port
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/port/arch
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/include
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/lwip/src/netif
 -I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/drivers
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/utilities
 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/freertos
 -I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/CMSIS 
-I/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/startup
 -I/home/user/Desktop/mbed_TLS_NXP/build/include/mbedtls 
-L/home/user/Desktop/mbed_TLS_NXP/build/lib 
-L/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/Releaseconftest.c
 -lProject_prova1 >&5configure:4807:$?=0configure:4845:result:no
configure:failed program was:|/* confdefs.h */|#definePACKAGE_NAME 
"curl"|#definePACKAGE_TARNAME "curl"|#definePACKAGE_VERSION 
"-"|#definePACKAGE_STRING "curl -"|#definePACKAGE_BUGREPORT "a suitable curl 
mailing list: 
https://curl.haxx.se/mail/";|#definePACKAGE_URL<https://curl.haxx.se/mail/%22|#definePACKAGE_URL>
 ""|/* end confdefs.h. */||intmain 
(void)|{||;|return0;|}configure:4850:error:in 
`/home/user/Desktop/curl_libProject_prova1/curl-7.55.0':configure:4852:error:C 
compiler cannot create executables
See`config.log' for more details
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I dont understand where the problem is.
The configuration script is:

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#! /bin/sh
exportPATH=/usr/local/mcuxpressoide-10.0.2_411/ide/tools/bin:$PATH

PATH=/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1/Release:$PATH
 exportROOTDIR="${PWD}"exportMBEDDIR=/home/user/Desktop/mbed_TLS_NXP/build 
exportPROJDIR=/home/user/Documents/MCUXpresso_10.0.2_411/workspace/libProject_prova1
cd ./curl-7.55.0

exportCPPFLAGS="-DUSE_LWIPSOCK -D__REDLIB__ -DLWIP_DNS=1 -DUSE_RTOS=1 
-DCR_INTEGER_PRINTF -DSDK_DEBUGCONSOLE=0 -D__MCUXPRESSO -D__USE_CMSIS -DNDEBUG 
-DFSL_RTOS_FREE_RTOS -DSDK_OS_FREE_RTOS -DCPU_LPC54608J512ET180 
-DCPU_LPC54608J512ET180_cm4 -I${PROJDIR}/lwip/src/include/lwip 
-I${PROJDIR}/lwip/src/include/lwip/priv -I${PROJDIR}/lwip/src/include/lwip/prot 
-I${PROJDIR}/lwip/src/include/netif -I${PROJDIR}/lwip/src/include/netif/ppp 
-I${PROJDIR}/lwip/src/include/netif/ppp/polarssl 
-I${PROJDIR}/lwip/src/include/posix -I${PROJDIR}/lwip/src/include/posix/sys 
-I${PROJDIR}/lwip/port -I${PROJDIR}/lwip/port/arch -I${PROJDIR}/lwip/src 
-I${PROJDIR}/lwip/src/include -I${PROJDIR}/lwip/src/netif -I${PROJDIR} 
-I${PROJDIR}/drivers -I${PROJDIR}/utilities -I${PROJDIR}/freertos 
-I${PROJDIR}/CMSIS -I${PROJDIR}/startup 
-I${MBEDDIR}/include/mbedtls"exportCFLAGS="-O0 -fno-common -g3 -Wall -c 
-fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections 
-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb 
-specs=redlib.specs"exportLDFLAGS="-L${MBEDDIR}/lib 
-L${PROJDIR}/Release"exportLIBS="-lProject_prova1"
exportCROSS_COMPILE=arm-none-eabi
exportAR=${CROSS_COMPILE}-ar exportAS=${CROSS_COMPILE}-as
exportLD=${CROSS_COMPILE}-ld
exportRANLIB=${CROSS_COMPILE}-ranlib
exportCC=${CROSS_COMPILE}-gcc
exportNM=${CROSS_COMPILE}-nm
exportPREFIX=${ROOTDIR}/build
./configure 
--target=${CROSS_COMPILE}--host=${CROSS_COMPILE}--prefix=${ROOTDIR}/build 
--build=x86_64-linux-gnu --without-ssl --with-mbedtls 
--enable-static--disable-shared --disable-ftp --disable-file --disable-pop3 
--disable-smb --disable-smtp --disable-imap --disable-ldap --disable-ldaps 
--disable-dict --disable-telnet --disable-tftp --disable-manual --disable-ipv6 
--disable-unix-sockets --disable-versioned-symbols --disable-ares 
--disable-sspi --disable-gopher --without-zlib --without-libssh2 
--without-ca-bundle -without-ca-path --without-libidn --without-librtmp 
--without-libidn
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Can anyone figures out what I am doing wrong?


If I procede with the 2) way, I would ask how can I set/unset all the features 
that I can choose using directives like -without-ssl --with-mbedtls 
--enable-static--disable-shared in the configure step?

From whitch file do I need to start to tailor libcurl to fit my needs?




-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to