Article 5T1D4 /bin/ld: cannot find -lc++

/bin/ld: cannot find -lc++

by
hmarzooq
from LinuxQuestions.org on (#5T1D4)
Hello!

I'm facing a problem where a make file is throwing below error:

Code:/bin/ld: cannot find -lc++The shared library in error (lc++) is part of libc++ which I've build and installed. However, the make file is not able to find this library. Therefore, I'm assuming this is an issue of a linker (ld) not able to search the lc++ lib in the search path.

Assuming the actual error i.e. Quote:
/bin/ld: cannot find -lc++
means that linker (ld) cannot find lc++ in the search path, I did investigate below (RPATH issue) and fixed the "not found" issue and re-run make clean & make after removing/creating build dir.

Code:ldd /usr/local/lib/x86_64-unknown-linux/libc++.so.1.0
linux-vdso.so.1 (0x00007ffe49d33000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fec62477000)
libc.so.6 => /lib64/libc.so.6 (0x00007fec620cc000)
libm.so.6 => /lib64/libm.so.6 (0x00007fec61d8c000)
librt.so.1 => /lib64/librt.so.1 (0x00007fec61b84000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fec6196e000)
libatomic.so.1 => /lib64/libatomic.so.1 (0x00007fec61766000)
/lib64/ld-linux-x86-64.so.2 (0x00007fec62966000)
libc++abi.so.1 => not foundfixing it by export Code:LD_LIBRARY_PATH=/usr/local/lib/x86_64-unknown-linux/Verifying:

Code:ldd /usr/local/lib/x86_64-unknown-linux/libc++.so.1.0
linux-vdso.so.1 (0x00007ffce078e000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fefd6ae0000)
libc.so.6 => /lib64/libc.so.6 (0x00007fefd6735000)
libm.so.6 => /lib64/libm.so.6 (0x00007fefd63f5000)
librt.so.1 => /lib64/librt.so.1 (0x00007fefd61ed000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fefd5fd7000)
libatomic.so.1 => /lib64/libatomic.so.1 (0x00007fefd5dcf000)
libc++abi.so.1 => /usr/local/lib/x86_64-unknown-linux/libc++abi.so.1 (0x00007fefd5b8e000)
/lib64/ld-linux-x86-64.so.2 (0x00007fefd6fcf000)landed with same error Code:/bin/ld: cannot find -lc++
some more info:

Code:# pwd
/usr/local/lib/x86_64-unknown-linux
[root@ip-1-1-0-1 x86_64-unknown-linux]# ls -ltrh
total 4.0M
-rw-r--r-- 1 root root 1.9M Dec 13 02:47 libc++.a
-rwxr-xr-x 1 root root 1.1M Dec 13 02:47 libc++.so.1.0
-rw-r--r-- 1 root root 28 Dec 13 02:47 libc++.so
-rw-r--r-- 1 root root 13K Dec 13 02:47 libc++experimental.a
-rwxr-xr-x 1 root root 358K Dec 13 02:47 libc++abi.so.1.0
-rw-r--r-- 1 root root 665K Dec 13 02:47 libc++abi.a
lrwxrwxrwx 1 root root 13 Dec 13 07:00 libc++.so.1 -> libc++.so.1.0
lrwxrwxrwx 1 root root 16 Dec 13 07:00 libc++abi.so.1 -> libc++abi.so.1.0
lrwxrwxrwx 1 root root 14 Dec 13 07:00 libc++abi.so -> libc++abi.so.1
[root@ip-10-3-0-165 x86_64-unknown-linux]#Code:# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf

# pwd
/etc/ld.so.conf.d

# ls
bind-export-x86_64.conf dyninst-x86_64.conf llvm5.0-x86_64.conf mariadb-x86_64.conf

grep -rnw . -e "linux"
#machine info: Amazon Linux 2
Code:cat /proc/version
Linux version 4.14.252-195.483.amzn2.x86_64 (mockbuild@ip-1-0-1-1) (gcc version 7.3.1 20180712 (Red Hat 7.3.1-13) (GCC))I've been struggling with this problem from last few days and kind of stuck at the moment. Therefore, any help or guidance is highly appreciated!

Thanks!latest?d=yIl2AUoC8zA latest?i=rvhBqPsWmrI:_ko7N7w2eTk:F7zBnMy latest?i=rvhBqPsWmrI:_ko7N7w2eTk:V_sGLiP latest?d=qj6IDK7rITs latest?i=rvhBqPsWmrI:_ko7N7w2eTk:gIN9vFw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments