I am trying to use Ninja to generate an AARCH64 application in my x86_64 Linux machine. The cmake compile + generation proceeds fine. This seems to be a cross-compilation issue.
But when I run ninja install
it throws this error:
[98/1000] Linking CXX executable
/aarch64-linux-gnu/bin/ld: warning: myLibrary.so.39, needed by /home/project/astrosky/lib/astrosky.so, not found (try using -rpath or -rpath-link)
myLibrary.so.39
has a symbolic link to myLibrary.so.39.3
. Both libraries exist in the same directory + the symbolic link is not broken. The architecture of these *.so files are AARCH64.
Things I've done.
- Verified that both libraries exist and are where I expect them to be:
/home/project/deps/
- Specify to use the ldconfig for AARHC64.
- Created my own
/etc/ld.so.conf.d/aarch-linux-gnu.conf
file so it points to the directory that has the *.so files. I deleted the ld cache & re-generated the cache for ldconfig. - Double-check that
ldconfig -p
sees myLibrary.so.39 and is symlink'd to myLibrary.so.39.3. It also sees all the other libraries in/home/project/deps/
. - Set env var:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/project/deps
Resources I've looked at but did not fix the issue:
- /usr/bin/ld cannot find shared library
- /usr/bin/ld cannot find library
- /usr/bin/ld cannot find library
I am trying to use Ninja to generate an AARCH64 application in my x86_64 Linux machine. The cmake compile + generation proceeds fine. This seems to be a cross-compilation issue.
But when I run ninja install
it throws this error:
[98/1000] Linking CXX executable
/aarch64-linux-gnu/bin/ld: warning: myLibrary.so.39, needed by /home/project/astrosky/lib/astrosky.so, not found (try using -rpath or -rpath-link)
myLibrary.so.39
has a symbolic link to myLibrary.so.39.3
. Both libraries exist in the same directory + the symbolic link is not broken. The architecture of these *.so files are AARCH64.
Things I've done.
- Verified that both libraries exist and are where I expect them to be:
/home/project/deps/
- Specify to use the ldconfig for AARHC64.
- Created my own
/etc/ld.so.conf.d/aarch-linux-gnu.conf
file so it points to the directory that has the *.so files. I deleted the ld cache & re-generated the cache for ldconfig. - Double-check that
ldconfig -p
sees myLibrary.so.39 and is symlink'd to myLibrary.so.39.3. It also sees all the other libraries in/home/project/deps/
. - Set env var:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/project/deps
Resources I've looked at but did not fix the issue:
- /usr/bin/ld cannot find shared library
- /usr/bin/ld cannot find library
- /usr/bin/ld cannot find library
- Edit your question with the full link command that's failing. – Stephen Newell Commented Mar 14 at 19:25
1 Answer
Reset to default 02 things
passing search paths to ld
afaict, it is not the runtime linker (which is configured with LD_LIBRARY_PATH
resp /etc/ld.so.conf.d/*.conf
, but your link editor (aka ld
)
You can tell your link editor where to look for dynamic libraries by using the -L
flag (aka -L/path/to/mlib -lmyLibrary
library names
telling the link editor to link a library with the -l
flag, will really (only) make it search for libraries that are prefixed with lib
. that is -lmyLibrary
will require a file libmyLibrary.so
to exist in the search paths.
if you library lacks the lib
prefix (e.g. myLibrary.so
, as you indicated in your Q), I think you need to pass the full path to the linker (e.g. /path/to/myLibrary.so
, without any -L
or -l
flags)