Use external libraries in crosscompile

Hello,

I am trying to crosscompile a c/c++ project, that use external libs such as lexpat and lcurl using eclipse IDE. I already added the CXX, CXXFLAGS, LDFLAGS and all the instructions indicated in the toradex procedure.

However, I don’t know how to deal with lexpat (the xml parser lib) and lcurl in the crosscomp. This is the output after build:

make all 
Building target: cmi_lib
Invoking: Cross G++ Linker
arm-fslc-linux-gnueabi-g++  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/opt/fslc-framebuffer/2.6.2/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lcurl -lexpat -o "cmi_lib"  ./src/libs/sha-2/sha-256.o  ./src/libs/dictionary.o ./src/libs/getlog.o ./src/libs/iniparser.o ./src/libs/strlib.o ./src/libs/timer.o ./src/libs/utils.o  ./src/cardreader.o ./src/cvip.o ./src/hardware.o ./src/main.o ./src/serial.o   
/opt/fslc-framebuffer/2.6.2/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/8.2.0/real-ld: ./src/cvip.o: in function `parse_xml(char*, unsigned int)':
/home/gaston/eclipse-workspace/cmi_lib/Debug/../src/cvip.cpp:217: undefined reference to `XML_ParserCreate'
/opt/fslc-framebuffer/2.6.2/sysroots/x86_64-fslcsdk-linux/usr/libexec/arm-fslc-linux-gnueabi/gcc/arm-fslc-linux-gnueabi/8.2.0/real-ld: /home/gaston/eclipse-workspace/cmi_lib/Debug/../src/cvip.cpp:218: undefined reference to `XML_SetElementHandler'

It seems it cannot find the expat lib inside the sysroot, despite I added expat to the IMAGE_INSTALL variable in Yocto recipe. And in then generated rootfs, I can see this:

./usr/lib/libexpat.so.1
./usr/lib/libexpat.so.1.6.8
./var/lib/dnf/yumdb/l/51c8c03b831eb7a8effe3f9d2f6c5103f34e61a1-libexpat1-2.2.6-r0-armv7at2hf_neon

Thanks!

HI @gasmbas

Could you provide the software version of your module?

This is the output after build

What are you trying to build?
Could you share a sample project your compilation environment settings?

It seems it cannot find the expat lib inside the sysroot, despite I added expat to the IMAGE_INSTALL variable in Yocto recipe

Could you provide the changes you have done to do the compilation of the image and the SDK?

Best regards,
Jaski