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: 
Explorer
Explorer
10,866 Views
Registered: ‎07-09-2012

Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

Hello,

 

I've just received the Zynq development board and Xilinx tool set.  I've built the C++ Hello World App, ported it to the dev board and run it successfully.  So, it looks like the basic Xilinx SDK tool chain is working correctly.

 

Now for the real work...  I'm porting an application from a previous Eclipse development environment and ARM target to the Zynq.  That application uses a shared library.  I have so far been unsuccessful in configuring a project in the SDK to generate a shared library (*.so).  I was able to compile the sources into a Xilinx ARM Linux Static Library (*.a) but that's not what I need.

 

I notice that the only time the New Project dialog will show Shared Library as an option is if I uncheck the "Show project types and toolchains only if they are supported on the platform" check box.  Does this mean that shared libraries are not supported on the Linux running on the Zynq?

 

Another mystery that I'm trying to solve is with the static library that I was able to build.   As I mentioned, I successfully compiled the shared library sources into a static library.  When I tried to build the application that uses this library and link it in statically, the linker generates the error " cannot find -lUtils.a" where the static library libUtils.a was the output from the static library build.  The libUtils.a library is there.  I added the library reference to the linker for the target application that uses the library.  Whatever I try, I still get the "cannot find ..." message when it tries to link.  I've tried absolute paths and relative paths.  I've tried using the full name libUtils.a and the base name Utils.a to no avail.   Any ideas would be appreciated.

 

I'm running the Xilinx Software Development Kit.  Release 14.1 Build SDK_P.15xf  on Windows XP Pro SP2 in a VM on Windows 7.

 

Thanks in advance.

 

- Dave

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
15,027 Views
Registered: ‎07-13-2012

Re: Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

Hi Dave,

 

Glad this worked and you were able to create a shared library.

 

The project wizard is missing definition data required to enable creation of a shared Linux library for Zynq

with the Xilinx ARM toolchain. This data specifies the supported toolchain and defines how

it would appear in the wizard. Aside from creating the library, it needs to be copied to the target

Linux filesystem and the library search path updated. The remote ARM launch configuration

currently available can copy the ELF but is not aware of shared libraries.

 

I can forward this discussion thread to the development team for review.

  

Regards,

 

Tom

0 Kudos
8 Replies
Xilinx Employee
Xilinx Employee
10,833 Views
Registered: ‎07-13-2012

Re: Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

Hi Dave,

 

Regarding linking the static library with your application, I'm assuming you are using

managed builds (SDK creates the makefile for the application and static library).

 

Try the following and see if it helps resolve the linker error:

 

1. In the Project Explorer view, right click on the application project and select "C/C++ Build Settings"

2. Select C/C++ General > Paths and Symbols and click on the References tab

3. Confirm that the static library project is checked (if not, click on the box and Apply the settings)

4. If the build doesn't start, right click on the application project and select Build Project

 

Regards,

 

Tom

0 Kudos
Xilinx Employee
Xilinx Employee
10,828 Views
Registered: ‎07-13-2012

Re: Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

Regarding the creation of shared libraries, when the C/C++ source is compiled -fPIC needs to be added

and during linking -shared. The GNU toolchain included with SDK should support these options.

 

The SDK GUI doesn't have pre-defined definitions for a shared library project, but you could

try the following as a workaround:

 

1. In the New Project dialog, uncheck the "Show project types and toolchains only if they are supported on the platform" check box

2. Select a Shared Library project and a toolchain, e.g. Linux GCC (this will be changed later to the correct toolchain)

3. In the Project Explorer view, right click on the library project and select C/C++ Build Settings

4. Click on C/C++ Build > Tool Chain Editor

5. Uncheck "Display compatible toolchains only" and from the "Current toolchain" dropdown, select "Xilinx ARM GNU/Linux Toolchain" and click on Apply

6. Click on C/C++ Build > Settings

7. Click on ARM Linux gcc compiler > Miscellaneous and in "Other flags" add the option -fPIC and click on Apply

8. Click on ARM Linux gcc linker > Miscellaneous and in "Linker Flags" add the option -shared and click on Apply

9. Click on OK to dismiss the dialog

10. Add source files and build the project

 

The link below includes useful general information on shared libraries

http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

 

Regards,

 

Tom

0 Kudos
Explorer
Explorer
10,809 Views
Registered: ‎07-09-2012

Re: Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

Indeed I am using the managed build for the application and static library.  

 

The application project does reference the static library as you describe yet it still will  not link.  Same error.  "ld.exe:cannot find -libUser.a"

 

 

- Dave

0 Kudos
Explorer
Explorer
10,784 Views
Registered: ‎07-09-2012

Re: Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

Thanks Tom,

 

Those instructions allowed me to build the shared library.  I still don't understand why a shared library is not an option for the ARM/Linux toolchain however.

 

- Dave 

0 Kudos
Xilinx Employee
Xilinx Employee
10,769 Views
Registered: ‎07-13-2012

Re: Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

Hi Dave,

 

Were you able to link eventually? Perhaps you could confirm that the library option was specified

correctly to the linker. If the library name is libUser.a, check if -lUser was specified or something else.

 

Regards,

 

Tom

0 Kudos
Xilinx Employee
Xilinx Employee
15,028 Views
Registered: ‎07-13-2012

Re: Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

Hi Dave,

 

Glad this worked and you were able to create a shared library.

 

The project wizard is missing definition data required to enable creation of a shared Linux library for Zynq

with the Xilinx ARM toolchain. This data specifies the supported toolchain and defines how

it would appear in the wizard. Aside from creating the library, it needs to be copied to the target

Linux filesystem and the library search path updated. The remote ARM launch configuration

currently available can copy the ELF but is not aware of shared libraries.

 

I can forward this discussion thread to the development team for review.

  

Regards,

 

Tom

0 Kudos
Observer bswimley
Observer
10,023 Views
Registered: ‎01-20-2012

Re: Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

Has there been any more development in the area of support for shared library creation?  Our desired application really will benefit from shared library creation and debugger awareness of the shared libraries.

 

 

Best Regards,

 

Brett Swimley

0 Kudos
Adventurer
Adventurer
9,901 Views
Registered: ‎12-12-2012

Re: Shared Library Creation from Xilinx SDK for Zynq?

Jump to solution

I'd like to chime in as well and say that I think that this would be an incredibly useful addition. We have approximately a dozen dlls from a windows C++ framework that we have ported to Arm/Linux for use on the Zynq platform, but have not taken the time to research converting them from static libs to what they should be (shared libs)..

 

 

0 Kudos