N
N
nckma2021-01-21 20:56:52
GCC
nckma, 2021-01-21 20:56:52

What should be the -L options for the gcc linker if the sysroot option is used?

I need to cross compile a C++ project.
For gcc, the --sysroot=/home/me/mysysroot/ parameter is passed.
But there are also -L parameters that tell the linker the path to individual libraries.
So the question is -L should the path be the full path in my host machine where cross compilation is performed or the path relative to the path specified in the sysroot parameter?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2021-01-22
@jcmvbkbc

-L must the path be the full path on my host machine where the cross compilation is being done, or a path relative to the path specified in the sysroot parameter?

The path can be a full path on the host machine, or if it starts with a character =or a string $SYSROOT($SYSROOT must not be interpreted by the shell and must be in the compiler arguments as such), it is interpreted relative to sysroot.
See https://gcc.gnu.org/onlinedocs/gcc/Directory-Optio... and https://man7.org/linux/man-pages/man1/ld.1.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question