Linking error: selective static linking of libm.a in GCC
问题 I want to selectively link libm.a statically, all the other libraries ( libc.so included) dinamically. But if I use the math functions from math.h , it almost always fails to link correctly. Why? And why does it work sometimes? (For example if I only use sqrt , fabs or, strangely, tanh , it seems to link correctly) myscript.sh: #!/bin/bash for i in sqrt tanh sin tan do echo "-----$i----------" sed "s/ciao/$i/" prova.c >provat.c gcc provat.c -fno-builtin -l:libm.a [[ $? -eq 0 ]] && { echo -n "