How is rpath referenced in cross compilation?

I'm having trouble confirming my understanding of how the rpath link works when cross-compiling with the specific tool chain I use (although I think this is a general question that applies to cross-compilation in general).

When I look at what flags are passed to the compiler and linker when creating libraries and applications, I see the following passed to the linker:

-Wl,-rpath-link,/home/Dev/env/sys/crosscompiletoolchain/armle-v7/lib/ 

So this is the path that is built into the shared libraries that are created for the target device on my development machine. This makes sense because I will be making the final binding on the development machine before deployment to the device. When I finally deploy to the device (i.e., shared libs + application), will these shared libraries not have a useless rpath link?

Built-in libraries and applications seem to work fine on the target side, and if I have to guess that I will say it because the application has an environment provided by the device’s operating system, which has / lib / as one of its default library search paths ( rpath-link defines only the first set of search engines). Is it correct?

+6
source share
1 answer

Check out "Using LD, the GNU Linker - Options - GNU Project Archive" ( ftp.gnu.org/pub/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html ):

The difference between -rpath and -rpath-link is that the directories specified by the -rpath parameters are included in the executable file and used at run time, while the -rpath-link option is effective only during communication.

+13
source

Source: https://habr.com/ru/post/947880/


All Articles