Alfredo Miranda
Alfredo Miranda

Reputation: 108

Cross-Compile using Shared Libraries

I'm noob to embedded systems. I'm working with a kit, TS-7390, which uses an ARM9. I managed to compile an application for it. My question is how I compile using shared libraries. I need to have the library on the host?

Upvotes: 1

Views: 2834

Answers (3)

Ottavio Campana
Ottavio Campana

Reputation: 4188

In brief: yes.

Let me explain why. When you setup a cross compiling environment, you need to have both the header files and the libraries available, because at linking the compiler checks that all symbols are resolved.

As you can imagine, a cross-compiler is not enough as soon as your program is not using only the libc. In this case you also need a place where you have all the necessary files (headers, libraries and so on). Since dealing with all the dependencies can be time consuming, it is often preferable using some kind of tool or distro that do it for you.

For example, I use OpenEmbedded, which requires a bit of time to be learned, but can help you a lot when you have to deal with libraries.

Upvotes: 2

Barun Parichha
Barun Parichha

Reputation: 166

You also need to cross compile the shared library before cross compiling the application.

Upvotes: 2

ldav1s
ldav1s

Reputation: 16315

It depends on how the shared library is used. If the application is compiled with the library as if the shared library is linked all the time, yes you'll need it on the host. If the shared library is loaded dynamically via dlopen you won't need it on the host. In both instances you'll need that library on the target also.

Upvotes: 3

Related Questions