UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer ralphkw1
Observer
3,801 Views
Registered: ‎10-15-2015

Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

I have created apps, but now I need to create a shared library that also copies API header files to sysroot for use by all of my applications. I have not been able to find any documentation references nor have I been able to find any tutorials. Can someone provide any links or examples for a shared library recipe.

Thanks,

Ralph

11 Replies
Scholar hbucher
Scholar
3,786 Views
Registered: ‎03-22-2016

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

@ralphkw1 

Check out this wiki link:

http://www.wiki.xilinx.com/Build+Kernel

 

More specifically to your case,  see step 3 here

http://www.wiki.xilinx.com/Build+and+Modify+a+Rootfs

 

If you are asking about how to build a shared library in linux in general, here is a good tutorial

http://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html

 

If you want to cross compile for the ARM 

http://xilinx.wikidot.com/zynq-app-debug

 

The ARM cross compiler is included in your Vivado install at

D:\xilinx\Windows\SDK\2017.2\gnu\aarch32\nt\gcc-arm-none-eabi\bin

 

Hope this helps

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Observer ralphkw1
Observer
3,699 Views
Registered: ‎10-15-2015

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

Thanks for the response, but none of these are examples of petalinux/yocto recipes for shared library, which is what I need. I already have the apps and shared libraries working in petalinux 15.4. Just need to figure out how to compile/install them in PL17.2 which appears to be a totally different animal.
BR,
Ralph
0 Kudos
Observer ralphkw1
Observer
3,648 Views
Registered: ‎10-15-2015

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

Really nobody has a shared library recipe? Even Xilinx folks?

0 Kudos
Scholar hbucher
Scholar
3,633 Views
Registered: ‎03-22-2016

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

@ralphkw1

Well this by no means is specific to petalinux or yocto. Unless I did not understand your question

http://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html

 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
0 Kudos
Explorer
Explorer
3,627 Views
Registered: ‎10-14-2015

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

which library is it? have you checked if already exists a recipe in the yocto git repository?

0 Kudos
Explorer
Explorer
3,621 Views
Registered: ‎10-14-2015

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

I have added library to my build in 2 different ways:  1)cloning an existing recipe in my yocto source directory; 2)cross-compling a library through petalinux.

let me explain it with examples,

 

1)Installing AppArmor.

searching on google I have found out that a recipe for Apparmor_2.11 exists in yocto/meta-security layer.

-So I have cloned the meta-security layer in <petalinux_source_dir>/components/yocto/source/arm/layers/

- I have downloaded the zip archive Apparmor_2.11.gz in <petalinux_source_dir>/components/yocto/downloads

-I have modified <petalinux_source_dir>/components/yocto/source/arm/lconf/bblayers.conf file and added the meta-security layer so it will permanently see the layer

- in project-spec/meta-user/recipes-core/images/petalinux-image.bbappend i have added

IMAGE_INSTALL_append = " apparmor"

and enable it petalinux-config -c rootfs->user packages->apparmor

 

2)Installing ArpOn

there is no recipe for ArpOn, so I have to cross compiled it in my petalinux project

-I have create a petalinux app with autoconf template

-I have copied the source files in project-spec/meta-user/recipes-apps/ArpOn/files

-now Arpon is complied with cmake, so in ArpOn.bb I have specified all include paths, library paths and dependencies needed

CMAKE_INCLUDE_PATH = "${D}/usr/include"
CMAKE_INCLUDE_PATH += "${D}/usr/local/include"
CMAKE_INCLUDE_PATH += "${D}/usr/local/include/libnet11"
CMAKE_INCLUDE_PATH += "${D}/usr/local/include/libnet-1.1"
CMAKE_LIBRARY_PATH = "${D}/usr/lib"
CMAKE_LIBRARY_PATH += "${D}/lib"
CMAKE_LIBRARY_PATH += "${D}/usr/lib32"
CMAKE_LIBRARY_PATH += "${D}/usr/lib34"
CMAKE_LIBRARY_PATH += "${D}/usr/local/lib"
CMAKE_LIBRARY_PATH += "${D}/usr/local/lib32"
CMAKE_LIBRARY_PATH += "${D}/usr/local/lib64"
CMAKE_LIBRARY_PATH += "${D}/usr/local/lib/libnet11"
CMAKE_LIBRARY_PATH += "${D}/usr/local/libnet-1.1"


DEPENDS = "libdnet"
RDEPENDS_${PN} += "libdnet"
RDEPENDS_${PN} += "libnet"

inherit cmake

 (note the "inherit cmake" and the absence of do_install)

 

and that's it!

 

2b) if your library is compile with make, the procedure is the same but you have to :

- in your .bb files you have to add the EXTRA_OECONF parameters needed by autoconf for your library and probably also CFLAGS_prepend and library flags as well

-edit the auto-generated Makefile.in in order to see all the files needed  and compile them in right order

 

I hope this will help

 

 

0 Kudos
Observer ralphkw1
Observer
3,591 Views
Registered: ‎10-15-2015

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

Since it will be locate in "project-spec/meta-user/recipes-apps/", it is very yocto/petalinux specific. I know how to program shared libraries in linux, in fact the library already exists in Petalinux 15.4, I am just trying to move it to 17.2 but the petalinux reference documentation only describes how to petalinux-create for apps and modules, not shared libraries.
0 Kudos
Observer ralphkw1
Observer
3,590 Views
Registered: ‎10-15-2015

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

This is a custom shared libarary I use for interprocess communication between my linux applications. It does not already exist in yocto git repo...
0 Kudos
Observer ralphkw1
Observer
3,587 Views
Registered: ‎10-15-2015

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

I don't know how to generate the .bb file and makefile in the first place. So general statements about EXTRA_OECONF and CFLAGS_prepend don't really help me. The library already exists and it is not an autoconf project. I am looking for a simple example .bb and makefile for shared library. I gather that for 16.4 there was a petalinux-create template for this, but it was removed after that. Not sure why.
0 Kudos
Highlighted
Visitor eatnafou
Visitor
1,718 Views
Registered: ‎10-25-2017

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

Were you ever to find something equivalent to petalinux-create -t libs for 2017.2.  I am trying to do a similar thing as I port my stuff from 2016.2 to a the yocto based 2017.2

0 Kudos
Moderator
Moderator
1,685 Views
Registered: ‎04-24-2017

Re: Just getting started with Petalinux 2017.2, need more documentation for shared library compiling, installation

Refer http://www.wiki.xilinx.com/PetaLinux+Yocto+Tips to create libraries using yocto. If you have any questions let me know.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos