I'm trying to compile mini_sendmail as described here. But I'm getting the following error after tying the make command:
gcc -O -c mini_sendmail.c
gcc -O -s -static mini_sendmail.o -o mini_sendmail
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make: *** [mini_sendmail] Error 1
How do I fix this problem under RHEL 6?
You need to install the glibc-static package. It contains the C library static libraries for -static linking. You don't need these, unless you link statically, which is highly discouraged. But mini_sendmail is specially used for chrooted setup. To install this login as root and type the following command:
# yum install glibc-static
Sample outputs:
Loaded plugins: rhnplugin Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package glibc-static.x86_64 0:2.12-1.7.el6_0.5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================================================================= Installing: glibc-static x86_64 2.12-1.7.el6_0.5 rhel-x86_64-server-optional-6 1.4 M Transaction Summary ============================================================================================================================================================================================================================================= Install 1 Package(s) Upgrade 0 Package(s) Total download size: 1.4 M Installed size: 0 Is this ok [y/N]: y Downloading Packages: glibc-static-2.12-1.7.el6_0.5.x86_64.rpm | 1.4 MB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : glibc-static-2.12-1.7.el6_0.5.x86_64 1/1 Installed: glibc-static.x86_64 0:2.12-1.7.el6_0.5 Complete!
Now, you can compile mini_sendmail without any problem under RHEL 6. Please note that RHEL v5 and earlier included static lib in glibc-devel itself.
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop





![RHEL / CentOS Yum Command: Blacklist Packages [ Disable Certain Packages ]](http://s0.cyberciti.org/images/rp/1/13.jpg)







{ 6 comments… read them below or add one }
I had this some days ago when compilin some lib, i needed to install “zlib1g-dev” – so it is not always this ;)
Hi ,
I am facing problem while installing some commercial softwares
the error i get is
/usr/bin/ld: cannot find -lXm
Kindly help me
Regards
I ran into this exact problem, and I went to follow your instructions. It seems that RHEL has dropped glibc-static from its repos though. Do you know anything about this? Is it in some other repo somewhere? Can I download it and install it manually from somewhere?
I am installing a program, and I have following problems, errors:
/usr/bin/ld: cannot find -lpdb
/usr/bin/ld: cannot find -lpml
/usr/bin/ld: cannot find -lscore
/usr/bin/ld: cannot find -lXGF
/usr/bin/ld: cannot find -lXGC
Kindly help me
Regards
thnks buddy!!! it worked fine..!!!
Thanks for that, my RHEL-fu was weak … I was trying to build runit and had provided glibc-devel … hadn’t realised it was looking for the static version until I strace’d the failing ld command :-) And your post filled in the last piece after a couple of seconds googling …