07-09-2012 04:08 PM
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.
Solved! Go to Solution.
07-13-2012 12:09 PM
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
07-13-2012 12:51 PM
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
07-16-2012 10:17 AM
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"
07-18-2012 08:52 AM
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.
07-23-2012 12:03 PM
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.
07-23-2012 12:46 PM
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.