Jump to content
  • 0

Building Applications in Vitis for Petalinux


RyanW

Question

Hello everyone, I'm having some difficulty getting applications to compile in Vitis for deployment on embedded Linux. I thought the way I setup the platform project was correct because the included header files were found by Vitis. However, when I compile the program it seems to fail. The weird thing is that it actually did compile and run on my Cora Z7-10 when I hadn't populated all the fields for the platform project. So I believe I may be doing something incorrectly here. How am I supposed to setup the Vitis project properly to get applications for Linux to compile on them?

 

platform_setup_vitis.thumb.png.3e5f6d6d71606d0d1999196d93a54d50.png

Above is how I setup my platform project in Vitis with (what I think is) the relevant petalinux directory information.

Building target: HelloWorldApp.elf
Invoking: ARM v7 Linux gcc linker
arm-linux-gnueabihf-gcc -L/home/bryan/Vivado/Tutorials/Linux_UIO/Vitis/LinuxUIOPlat/export/LinuxUIOPlat/sw/LinuxUIOPlat/linux_domain/sysroot/cortexa9t2hf-neon-xilinx-linux-gnueabi/lib -L/home/bryan/Vivado/Tutorials/Linux_UIO/Vitis/LinuxUIOPlat/export/LinuxUIOPlat/sw/LinuxUIOPlat/linux_domain/sysroot/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/lib -o "HelloWorldApp.elf"  ./src/helloworld.o   --sysroot=/home/bryan/Vivado/Tutorials/Linux_UIO/Vitis/LinuxUIOPlat/export/LinuxUIOPlat/sw/LinuxUIOPlat/linux_domain/sysroot/cortexa9t2hf-neon-xilinx-linux-gnueabi -Wl,-rpath-link=/home/bryan/Vivado/Tutorials/Linux_UIO/Vitis/LinuxUIOPlat/export/LinuxUIOPlat/sw/LinuxUIOPlat/linux_domain/sysroot/cortexa9t2hf-neon-xilinx-linux-gnueabi/lib -Wl,-rpath-link=/home/bryan/Vivado/Tutorials/Linux_UIO/Vitis/LinuxUIOPlat/export/LinuxUIOPlat/sw/LinuxUIOPlat/linux_domain/sysroot/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/lib
/tools/Xilinx/Vitis/2021.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/x86_64-petalinux-linux/usr/bin/arm-xilinx-linux-gnueabi/arm-xilinx-linux-gnueabi-ld.real: cannot find crtbeginS.o: No such file or directory
/tools/Xilinx/Vitis/2021.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/x86_64-petalinux-linux/usr/bin/arm-xilinx-linux-gnueabi/arm-xilinx-linux-gnueabi-ld.real: cannot find -lgcc
/tools/Xilinx/Vitis/2021.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/x86_64-petalinux-linux/usr/bin/arm-xilinx-linux-gnueabi/arm-xilinx-linux-gnueabi-ld.real: cannot find -lgcc
collect2.real: error: ld returned 1 exit status
make: *** [makefile:38: HelloWorldApp.elf] Error 1

Above is the error I'm getting when attempting to compile in Vitis. Seems like maybe I'm setting up the settings for the compiler or the sysroot wrong?

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

Seams like you sysroot is missing some files
How was the sysroot generated?

run following command in sysroot directory and check if the file is really missing : find ./ -iname "crtbeginS.o"

Edited by Ionel
Link to comment
Share on other sites

  • 0

I made made the sysroot by running the 2 commands after I had setup and built the base project:

petalinux-build--sdk
petalinux-package --sysroot

 

When running this command:

5 hours ago, Ionel said:

find ./ -iname "crtbeginS.o"

I see that the file does exist, only it seems to exist in a sub-folder right under where the path specified in the error message pointed to. The output is shown below.

./images/linux/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/lib/arm-xilinx-linux-gnueabi/11.2.0/crtbeginS.o

EDIT: Slight mistake in the section above, this is being run inside the project folder, not the /tools/Xilinx/Vitis/2021.2 directory as specified in the error message. However, similar results were obtained as shown below

./gnu/aarch32/lin/gcc-arm-linux-gnueabi/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/lib/arm-xilinx-linux-gnueabi/10.2.0/crtbeginS.o

 

 

There were a couple of other things I should note/have questions about. When I packaged the sysroot, this message below popped up. How can I run this inside of Vitis? It seems important, but when I source this file from the terminal and then subsequently launch Vitis from that environment, it still fails to compile.

SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /home/bryan/Vivado/Testing/LinuxTest/pLinux/images/linux/sdk/environment-setup-cortexa9t2hf-neon-xilinx-linux-gnueabi

 

There is also this message I see when I compile the project platform in Vitis. I can't figure out why it does not want to copy; when I check the file, I see that it is owned by me.

Copying the sysroot data, this may take few minutes...
WARNING: Failed to copy boost::filesystem::copy_file: Permission denied: "/home/bryan/Vivado/Testing/LinuxTest/pLinux/images/linux/sdk/sysroots/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/bin/sudo", "/home/bryan/Vivado/Testing/LinuxTest/Vitis/LinuxPlat/export/LinuxPlat/sw/LinuxPlat/linux_domain/sysroot/cortexa9t2hf-neon-xilinx-linux-gnueabi/usr/bin/sudo"

 

Note:  the project path is slightly different than in the original question because I eventually deleted that whole project directory, but this one is setup just the same, it only has slightly different names.

Edited by RyanW
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...