Cross compilation error finding libraries


Bel Hadj Salem Talel
 

Hi All,

I have an SDK populated from an image.
After sourcing the SDK env file, I try to run make on a project with this command :
make CC="$CC" LD="$LD" CFLAGS="${CFLAGS} --sysroot=/media/talel/data/sdk-multigate/sysroots/aarch64-poky-linux" CXXFLAGS="${CXXFLAGS} --sysroot=/media/talel/data/sdk-multigate/sysroots/aarch64-poky-linux"
I specified the CFLAGS and CXXFLAGS as mentionned in Yocto document (part 5.2 Makefile-Based projects) : https://www.yoctoproject.org/docs/1.1.2/adt-manual/adt-manual.html
Now I have this error:


** Building dynamic library (debug, shared) /home/talel/Documents/macchina.io/samples/LinuxThermalSimple/bin/Linux/x86_64/io.macchina.linux-thermal-simpled.so
aarch64-poky-linux-g++ -shared -Wl,-soname,io.macchina.linux-thermal-simpled.so -o /home/talel/Documents/macchina.io/samples/LinuxThermalSimple/bin/Linux/x86_64/io.macchina.linux-thermal-simpled.so  /home/talel/Documents/macchina.io/samples/LinuxThermalSimple/obj/Linux/x86_64/debug_shared/LinuxThermalSensor.o /home/talel/Documents/macchina.io/samples/LinuxThermalSimple/obj/Linux/x86_64/debug_shared/BundleActivator.o -L/home/talel/Documents/macchina.io/lib/Linux/x86_64 -L/home/talel/Documents/macchina.io/platform/lib/Linux/x86_64  -lIoTDevicesd -lPocoRemotingNGd -lPocoOSPd -lPocoUtild -lPocoXMLd -lPocoFoundationd  -lpthread -ldl -lrt
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find crti.o: No such file or directory
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find crtbeginS.o: No such file or directory
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lIoTDevicesd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoRemotingNGd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoOSPd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoUtild
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoXMLd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoFoundationd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lpthread
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -ldl
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lrt
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lstdc++
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lm
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lgcc_s
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lc
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lgcc_s
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find crtendS.o: No such file or directory
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
/home/talel/Documents/macchina.io/platform/build/rules/dylib:54: recipe for target '/home/talel/Documents/macchina.io/samples/LinuxThermalSimple/bin/Linux/x86_64/io.macchina.linux-thermal-simpled.so' failed
make: *** [/home/talel/Documents/macchina.io/samples/LinuxThermalSimple/bin/Linux/x86_64/io.macchina.linux-thermal-simpled.so] Error 1

I need help.
Thanks, Talel


Khem Raj
 

On 10/27/20 2:52 AM, Bel Hadj Salem Talel wrote:
Hi All,
I have an SDK populated from an image.
After sourcing the SDK env file, I try to run make on a project with this command :
make CC="$CC" LD="$LD" CFLAGS="${CFLAGS}
--sysroot=/media/talel/data/sdk-multigate/sysroots/aarch64-poky-linux"
CXXFLAGS="${CXXFLAGS}
--sysroot=/media/talel/data/sdk-multigate/sysroots/aarch64-poky-linux"
I specified the CFLAGS and CXXFLAGS as mentionned in Yocto document (part 5.2 Makefile-Based projects) : https://www.yoctoproject.org/docs/1.1.2/adt-manual/adt-manual.html
Now I have this error:
** Building dynamic library (debug, shared) /home/talel/Documents/macchina.io/samples/LinuxThermalSimple/bin/Linux/x86_64/io.macchina.linux-thermal-simpled.so
aarch64-poky-linux-g++ -shared -Wl,-soname,io.macchina.linux-thermal-simpled.so -o /home/talel/Documents/macchina.io/samples/LinuxThermalSimple/bin/Linux/x86_64/io.macchina.linux-thermal-simpled.so /home/talel/Documents/macchina.io/samples/LinuxThermalSimple/obj/Linux/x86_64/debug_shared/LinuxThermalSensor.o /home/talel/Documents/macchina.io/samples/LinuxThermalSimple/obj/Linux/x86_64/debug_shared/BundleActivator.o -L/home/talel/Documents/macchina.io/lib/Linux/x86_64 -L/home/talel/Documents/macchina.io/platform/lib/Linux/x86_64 -lIoTDevicesd -lPocoRemotingNGd -lPocoOSPd -lPocoUtild -lPocoXMLd -lPocoFoundationd  -lpthread -ldl -lrt
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find crti.o: No such file or directory
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find crtbeginS.o: No such file or directory
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lIoTDevicesd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoRemotingNGd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoOSPd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoUtild
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoXMLd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lPocoFoundationd
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lpthread
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -ldl
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lrt
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lstdc++
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lm
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lgcc_s
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lc
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find -lgcc_s
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find crtendS.o: No such file or directory
/media/talel/data/sdk-multigate/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.2.0/real-ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
/home/talel/Documents/macchina.io/platform/build/rules/dylib:54: recipe for target '/home/talel/Documents/macchina.io/samples/LinuxThermalSimple/bin/Linux/x86_64/io.macchina.linux-thermal-simpled.so' failed
make: *** [/home/talel/Documents/macchina.io/samples/LinuxThermalSimple/bin/Linux/x86_64/io.macchina.linux-thermal-simpled.so] Error 1
I need help.
I see that your linker is not using proper sysroot perhaps using LD=${CC} might help.

Thanks, Talel


Bel Hadj Salem Talel
 

Hi,

Thanks for the reply.
Setting LD to $CC didn't work as well.


Khem Raj
 

On Tue, Oct 27, 2020 at 9:41 AM Bel Hadj Salem Talel <bhstalel@gmail.com> wrote:

Hi,

Thanks for the reply.
Setting LD to $CC didn't work as well.
Pass LDFLAGS as CLFAGS as well, you need to use --syroot option during
link as well



Bel Hadj Salem Talel
 

Hi,

Actually the Yocto SDK sets LD variable correctly : here is its value :
aarch64-poky-linux-ld --sysroot=/media/talel/data/sdk-multigate/sysroots/aarch64-poky-linux

Now I'm stuck with linking,
Please help me.
Thansk, Talel