I'm trying to build a very simple binary for powerpc-unknown-linux-gnu. The rustc book says it links against libc 2.17 (here, specifically).
However, when I build my binary with: cargo build --release --target powerpc-unknown-linux-gnu
And then deploy it onto the powerpc system, and try to run it, I get an error: ./benchmark: /lib/libc.so.6: version GLIBC_2.18' not found (required by ./benchmark)`
Is the book incorrect? Why is my binary trying to look for GLIBC_2.18?
I am not sure what versions in notes column actually mean, but from my experience with deploying for older libc, it's minimum supported versions, while the actual version linked against would be whatever is present on the machine you're building on.
@HJVT is correct. When linking the linker will look at the glibc version you have installed and set that version as the minimum version the executable will run at. If you want to be able to run the executable on a system with glibc 2.17, you will have to link it with a toolchain which uses glibc 2.17 or older (in this case exactly 2.17 as rustc doesn't support any older version). The reason it works this way is because glibc exports many functions in multiple versions. When linking the linker will look at the latest version of the function exported by the local glibc version and embeds this version in the executable. At runtime glibc will then dynamically link your executable against exactly the version it requested. This way glibc can make breaking changes to functions without risking breaking executable that have been linked against an older version of glibc.