official-stockfish / Stockfish

A free and strong UCI chess engine
https://stockfishchess.org/
GNU General Public License v3.0
11.64k stars 2.29k forks source link

Statically link to libstdc++ helps many users on various linux distributions. #5596

Open ruffianeo opened 2 months ago

ruffianeo commented 2 months ago

Describe the issue

After downloading stockfish 17 avx2 on my debian bullseye system, it won't run, because:

./stockfish-17-ubuntu-x86-64-avx2: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by ./stockfish-17-ubuntu-x86-64-avx2)
./stockfish-17-ubuntu-x86-64-avx2: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by ./stockfish-17-ubuntu-x86-64-avx2)

Expected behavior

If you opt for statically linked standard libraries (on linux), this would not happen and the program would be usable out of the box on many more systems.

Steps to reproduce

./stockfish-17-ubuntu-x86-64-avx2: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by ./stockfish-17-ubuntu-x86-64-avx2)
./stockfish-17-ubuntu-x86-64-avx2: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by ./stockfish-17-ubuntu-x86-64-avx2)

Anything else?

The compiler option you might want to use to fix this is: -static-libstdc++.

Operating system

All

Stockfish version

Stockfish 17 as of the time of this issue post.

Disservin commented 2 months ago

see https://github.com/official-stockfish/Stockfish/issues/4026 for some previous talk about this, there are also some other aspects of why static linking on linux is not recommended.

https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html Apparently gcc 10 is the default for debian 11.. quite old tbh given that it just became LTS. GCC 11.1.0: GLIBCXX_3.4.29, CXXABI_1.3.13 are you able to easily install gcc 11.1?

R-Goc commented 2 months ago

Out of curiosity what is stockfish currently linking to on linux? On windows ldd output is:

        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffcf4510000)
        KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ffcf3180000)
        KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffcf1890000)
Disservin commented 2 months ago
linux-vdso.so.1 (0x00007fff4af3d000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f033e704000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f033e61d000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f033e5fd000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f033e3d4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f03435b0000

windows has static linking, due to the nature of libraries generally missing there

vondele commented 2 months ago

On linux package maintainers do a fairly good job at tracking the most recent releases.

https://packages.debian.org/search?keywords=stockfish https://packages.fedoraproject.org/pkgs/stockfish/stockfish/ (already at 17) https://launchpad.net/ubuntu/+source/stockfish ...