Fedora

ldd 顯示 libstdc++ 未找到,但它可用,這怎麼可能?

  • October 4, 2021

我執行 Fedora 34,這怎麼可能(ldd 顯示 libstdc++ 未找到,但它可用):

$ ldd /opt/toolchains/gcc-rl78/bin/rl78-elf-gcc
        linux-gate.so.1 (0xf7f7d000)
        libstdc++.so.6 => not found
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7f50000)
        libc.so.6 => /lib/libc.so.6 (0xf7d90000)
        /lib/ld-linux.so.2 (0xf7f7f0000)
$ ldd /opt/toolchains/llvm-rl78/bin/clang
/opt/toolchains/llvm-rl78/bin/clang: /lib64/libtinfo.so.5: no version information available (required by /opt/toolchains/llvm-rlvm-rl78/bin/clang)
        linux-vdso.so.1 (0x00007ffdc9397000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4e3a062000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f4e3a057000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f4e3a050000)
        libtinfo.so.5 => /lib64/libtinfo.so.5 (0x000074e3a023000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f4e39edf000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f4e39cc0000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f4e39ca3000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f4e39ad4000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4e3a08e000)
$ ldconfig -v | grep libstd
ldconfig: Can't stat /libx32: No such file or directory
ldconfig: ath `/usr/lib' given more than once
(from <builtin>:0 and <builtin>:0)
ldconfig: ath `/usr/lib64' given more than once
(from <builtin>:0 and <builtin>:0)
ldconfig: Can't stat /libx32: No such file or directory
ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
       libstdc++.so.6 -> libstdc++.so.6.0.29

第一個二進制是 32 位二進制,第二個是 64 位二進制(看ld-linux.sos)。您有 64 位libstdc++但沒有 32 位版本。

安裝libstdc++.i686將解決此問題:

sudo dnf install libstdc++.i686

引用自:https://unix.stackexchange.com/questions/658569