"readelf -d main | grep TEXTREL" returns the same text on both musl and glibc containers:
0x0000000000000016 (TEXTREL) 0x0
0x000000000000001e (FLAGS) TEXTREL
"gcc -no-pie" is another workaround for musl container like Rich said. But I think that 'set(CMAKE_EXE_LINKER_FLAGS "-static")' will be best cross platform solution. As I know "-static" implies "no-pie".
> i'm also surprised that it was only a warning, i think gcc default pie toolchain passes -z text nowadays exactly to make this a link time failure. this is probably a gentoo toolchain bug.
What do you mean "-z text"? We can report improvement for gentoo.