RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 722216 - GCC error while trying to statically link to libc.a
Summary: GCC error while trying to statically link to libc.a
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: glibc
Version: 6.1
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Andreas Schwab
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-14 16:22 UTC by josh.yggdrasil
Modified: 2016-11-24 16:13 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-15 06:26:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description josh.yggdrasil 2011-07-14 16:22:48 UTC
Description of problem:
GCC (ld) error while passing -static flag for compilation


Version-Release number of selected component (if applicable):
$ gcc --version
gcc (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ld --version
GNU ld version 2.20.51.0.2-5.20.el6 20091009
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.


How reproducible:
Every time


Steps to Reproduce:
1.  Make a very simple program, with few or no deps other than libc, this one works;

$ cat hello.c 
#include <stdio.h>

int main(void) 
{
	printf("hello, world.\n");
	return 0;
}

2.  Try to compile the program
$ gcc -static -o hello hello.c


Actual results:
$ gcc -static -o hello hello.c
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
(and no binary is produced)


Expected results:
$ gcc -static -o hello hello.c
$ ldd hello
        not a dynamic executable
$ ./hello
hello, world.


Additional info:
-libc.a is not in /usr/lib64, but libc_nonshared.a is, as is libc.so

-tried yum whatprovides /usr/lib64/libc.a, but no packages matched

-tried a sym link, from libc.a to libc_shared.a, but that just produced a different linking error...

-this works on prior versions of RH

Comment 2 Andreas Schwab 2011-07-15 06:26:41 UTC
Install glibc-static.


Note You need to log in before you can comment on or make changes to this bug.