NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Building a Linux .so file from Eclipse to use on the Zynq

Hi guys

I'm missing one simple step in the process of making a C++ extension in Eclipse and use this under the LabVIEW Real-Time module on my Zynq RIO.

I can compile and run everything as a regular Real-Time application from Eclipse on my 9068 (normal .o file)

I know how to get my .so file down on the RIO and use in from LabVIEW.

But I'm missing the step where I convert / compile my application for use as a shared library (.so file). I proberly have missed something simple but in this guide:

How Do I Debug Shared Libraries on Linux Real-Time Targets Using Eclipse/GDB?

http://digital.ni.com/public.nsf/allkb/7B050ED0DBE6B00A86257BBB004D9DF6

We are talking about how you can debug your .so file if you already have it and then it points to the regular guide for getting the .so file. But the only thing I can see there is how you build a normal application (.o file).

Anyone have a hint?

Best Regards

Anders Rohde

0 Kudos
Message 1 of 4
(6,865 Views)

Hey Anders,

Take a look at this Stack Overflow Question/Response:

     http://stackoverflow.com/questions/14884126/build-so-file-from-c-file-using-gcc-command-line

It as simple as passing the .o file into gcc with the --shared switch!

gcc -shared -o libhello.so -fPIC hello.c

where hello.c is:

#include <stdio.h>
void hello()
{
    printf
("Hello world!\n");
}

Hope that helps!

-TD

0 Kudos
Message 2 of 4
(4,328 Views)

In your Eclipse project, make sure that the project type is specified as a Shared Object/Library and not an application/binary (I don't know what phrasing they use). By simply changing the project type in Eclipse, it will automatically use the correct flags when calling gcc

0 Kudos
Message 3 of 4
(4,328 Views)

Thanks Brad

That was just what I was missing.

If I create a new project and select it to be a shared library then it works fine.!

Thanks for the quick answer.

Best Regards

Anders Rohde

0 Kudos
Message 4 of 4
(4,328 Views)