cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mariano_severi
Adventurer
Adventurer
4,161 Views
Registered: ‎09-15-2008

Develop Linux app with Xilinx XSDK and Petalinux 2018.2 rootfs

Jump to solution

Hi,

I tried to develop Linux app with Xilinx SDK and Petalinux rootfs following instructions here : https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842346/Linux+Applications+with+Petalinux+Libraries

I'm using 2018.2.

Unfortunately I get errors for missing libraries (libc.so.6, for example) but I checked the sysroot folder and libraries are there.

I read in the forum that this may be related to different toolchain, not sure if this is my case as well. I tried to set the petalinux toolchain in XSDK when creating the app (hello world from template) but nothing changed

Any suggestion?

Thanks.

  Mariano

0 Kudos
Reply
1 Solution

Accepted Solutions
mariano_severi
Adventurer
Adventurer
3,915 Views
Registered: ‎09-15-2008
Hi,
it seems that the problem is with the libraries path that XSDK automatically adds, that is:
<project_dir>/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi/lib
<project_dir>/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi/usr/lib
It should be:
<project_dir>/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi
By changing the settings. it works, the linker finds the requested libraries and compilation successfully ends.
Regards,
Mariano

View solution in original post

0 Kudos
Reply
10 Replies
shabbirk
Moderator
Moderator
4,139 Views
Registered: ‎12-04-2016

Hi @mariano_severi

 

May I know the exact error that you are seeing?

 

Also, see if this forum post helps you

https://forums.xilinx.com/t5/Embedded-Linux/PetaLinux-2017-4-Cross-Compiler-requires-libc-so-6-GLIBC-2-4/td-p/844282

 

 

Best Regards

Shabbir

0 Kudos
Reply
sandeepg
Moderator
Moderator
4,115 Views
Registered: ‎04-24-2017

Hi @mariano_severi,

 

I assume you are experiencing this issue. Refer this AR https://www.xilinx.com/support/answers/69159.html

 

Note: Do not use Windows XSDK for developing linux app using Petalinux sysroot instead use Linux XSDK.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
mariano_severi
Adventurer
Adventurer
4,061 Views
Registered: ‎09-15-2008

Hi,

here it is the XSDK console log when building the app :

 

"make all
Building target: helloworld_petalinux.elf
Invoking: ARM v7 Linux gcc linker
arm-linux-gnueabihf-gcc -L"/home/mariano/Work/Xilinx/boards/zedboard/project_01/petalinux/test_01/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi/lib" -L"/home/mariano/Work/Xilinx/boards/zedboard/project_01/petalinux/test_01/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi/usr/lib" -Xlinker --sysroot=/home/mariano/Work/Xilinx/boards/zedboard/project_01/petalinux/test_01/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi -o "helloworld_petalinux.elf"  ./src/helloworld.o  
/opt/pkg/petalinux-v2018.2/tools/linux-i386/gcc-arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabihf/7.2.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/libc.so.6
makefile:36: recipe for target 'helloworld_petalinux.elf' failed
/opt/pkg/petalinux-v2018.2/tools/linux-i386/gcc-arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabihf/7.2.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find /usr/lib/libc_nonshared.a
/opt/pkg/petalinux-v2018.2/tools/linux-i386/gcc-arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabihf/7.2.1/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/ld-linux-armhf.so.3
collect2: error: ld returned 1 exit status
make: *** [helloworld_petalinux.elf] Error 1"

 

I'm using Linux XSDK  (running in virtual machine).

There's no uppercase letter in application name.

I added the following to the Linker miscellaneous settings: --sysroot=/home/mariano/Work/Xilinx/boards/zedboard/project_01/petalinux/test_01/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi

 

I tried using both the petalinux and Xilinx toolchain, but I get the same error.

 

Any idea? Thanks

 

  Mariano

0 Kudos
Reply
sandeepg
Moderator
Moderator
4,045 Views
Registered: ‎04-24-2017

Hi @mariano_severi,

 

Did you tried the AR solution?

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Reply
stephenm
Moderator
Moderator
4,036 Views
Registered: ‎09-12-2007
0 Kudos
Reply
mariano_severi
Adventurer
Adventurer
4,022 Views
Registered: ‎09-15-2008

Hi,

 

sorry but I'm really confused.

 

If I run (and this is what I was doing so far):

- petalinux-build --sdk

- petalinux-package --sysroot

the tool create the directory images/linux/sdk/cortexa9hf-neon-xilinx-linux-gnueabi

If I use it as sysroot, I get errors for libraries missing.

 

Instead if I run :

- petalinux-build -c rootfs

the tool create the directories:

-/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/petalinux-user-image/1.0-r0/recipe-sysroot-native -/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/petalinux-user-image/1.0-r0/rootfs

Now :

- if I use the former as sysroot, I can compile (and run on the target) simple hello world program. However if I try to add xml2 library as suggested in https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842346/Linux+Applications+with+Petalinux+Libraries . I get the following error : lib/libxml2.so: file not recognized: File format not recognized. 

- if I use the latter (rootfs) as sysroot, I still can compile the hello world program but, when adding xml2 library, I get the error  cannot find -lxml2. Indeed, I find that rootfs/usr/lib contains libxml2.s0.2 and not libxml2.so and rootfs/user/include is completely empty

 

What shall I do?

 

  Mariano

 

0 Kudos
Reply
mariano_severi
Adventurer
Adventurer
3,916 Views
Registered: ‎09-15-2008
Hi,
it seems that the problem is with the libraries path that XSDK automatically adds, that is:
<project_dir>/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi/lib
<project_dir>/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi/usr/lib
It should be:
<project_dir>/images/linux/sdk/sysroots/cortexa9hf-neon-xilinx-linux-gnueabi
By changing the settings. it works, the linker finds the requested libraries and compilation successfully ends.
Regards,
Mariano

View solution in original post

0 Kudos
Reply
jannik.mahr
Observer
Observer
3,789 Views
Registered: ‎02-07-2018
Thank you! Had the same issue and this did the trick.

Petalinux really should have a better integration of the XSDK. There should be some kind of Petalinux command that lets you create a Petalinux app which automatically sets up a XSDK workspace and project.
0 Kudos
Reply
jannik.mahr
Observer
Observer
3,777 Views
Registered: ‎02-07-2018

I have to revert my previous answer, the trick did work but caused other problems.

The real solution was following this AR: https://www.xilinx.com/support/answers/69159.html which @sandeepg posted.

0 Kudos
Reply
mariano_severi
Adventurer
Adventurer
3,767 Views
Registered: ‎09-15-2008

Hi

in my case, the directory indicated in the suggested AR is not populated. Is that applicable also for 2018.2?

Btw, I did add the --sysroot linker flag as well, sorry  I didn't mention it

  Mariano

0 Kudos
Reply