Quick Fix to the Linker Error - ld: fatal: library -lgcc_s: not found
By Giri Mandalika on Dec 16, 2008
When building some of the open source applications like MySQL Cluster Carrier Grade Edition with the GCC compiler, the linking step may fail with the fatal error message
library -lgcc_s: not found despite the fact that the gcc_s library is available on the system and is in the linker search path -- for example,
LD_LIBRARY_PATH on Solaris.
Quick Fix / Workaround:
- Add the absolute path to the gcc_s library on the link line, OR
- (Recommended) If the library's filename has any major and minor version numbers appended to it, simply create a soft link to the library in the same location without the major and minor version numbers in the target filename.
On a Solaris 10 system, by default, the gcc_s library might be available under
/usr/sfw/lib (32-bit SPARC and x86 copy),
/usr/sfw/lib/sparcv9 (64-bit SPARC copy) and
/usr/sfw/lib/amd64 (64-bit x64 copy). If all you can find is the gcc_s library with the version number(s) in the filename like libgcc_s.so.1, simply run the command '
ln -s libgcc_s.so.1 libgcc_s.so' in the same directory where you found the libgcc_s.so.1.
Probably this particular error message may show up on any OS platform with any compiler, and the workaround mentioned in this post may work on all those failed cases. I cannot guarantee that, but I know for sure that it works on Solaris (both SPARC and x86/x64 versions).