Friday, September 7, 2012

/usr/bin/ld: cannot find -lm

I was updating some of my software to run on CentOS6 and I had an unexpected error:
/usr/bin/ld: cannot find -lm
collect2: ld returned 1 exit status

The tool I was building uses -static and it turns out that static libraries are no longer shipped in glibc-devel. They are in a new package called glibc-static.

yum install glibc-static
solved the problem. My program now compiles and thanks to puppet, glibc-static is now installed on all my systems.
package { 'glibc-static': ensure => present }


  1. John: You saved me. Omg, your explore program to get at the ext-3 files on my almost dead Seagate Drive were found today. All of it! You have no idea what you did. I have over three years worth of work that I would have lost. Seriously, I have been sick about it and up all night. I cannot thank you enough. I will go back to your website and pay you if you still frequent there. Unbelievable!

  2. Took me all day to break into the Black Armor NAS 110. Was really thinking it was gone... and went to a site mentioning your explore..You made my day, sir. Tax returns, legal stuff, etc etc.

  3. I got the same problem, so did as you mentioned. But I am getting

    Setting up Install Process
    No package glibc-static available.
    Nothing to do

    can you please guide me what to do ?

  4. Thanks. I told Google search my problem, it showed me your post. A minute later, problem solved. :)

  5. The information you shared is very helpful to us.