Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 106979 - Emerge and compile crashes with error "ld: -f may not be used without -shared"
Summary: Emerge and compile crashes with error "ld: -f may not be used without -shared"
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-23 04:29 UTC by Yev
Modified: 2005-09-27 12:36 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Output of 'gcc -dumpspecs' (log,4.63 KB, text/plain)
2005-09-23 09:10 UTC, Yev
Details
Output of 'gcc -dumpspecs' after deleting specs file (log2,4.63 KB, text/plain)
2005-09-23 10:57 UTC, Yev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yev 2005-09-23 04:29:19 UTC
When i try to emerge any package, make menuconfig on the kernel or compile even 
a test program with gcc i get this ld error:
"/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/../../../../i686-pc-linux-
gnu/bin/ld: -f may not be used without -shared
collect2: ld returned 1 exit status"

Some packages crash with a different error:
"checking for C compiler default output... configure: error: C compiler cannot 
create executables"

But if i check the config.log of the package i can see that it crashed because 
of the previous error:
"/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/../../../../i686-pc-linux-
gnu/bin/ld: -f may not be used without -shared
collect2: ld returned 1 exit status
configure:2056: $? = 1
configure: failed program was:
#line 2033 "configure"
#include "confdefs.h"

int
main ()
{

  ;
  return 0;
}
configure:2083: error: C compiler cannot create executables
check `config.log' for details.
"

I'm not using LDFLAGS and I havent changed a thing be fore it happened. Now i 
cant emerge or update anything nor compile my kernel.


Reproducible: Always
Steps to Reproduce:
emerge any package, run #make menuconfig, compile something with gcc

Actual Results:  
emerge/gcc crashed with the error specified in details field.

Expected Results:  
Compile package/source correctly.

Emerge --info:
Portage 2.0.51.22-r2 (default-linux/x86/2005.1, gcc-3.3.5, glibc-2.3.5-r0, 2.6.
12-gentoo-r6 i686)
=================================================================
System uname: 2.6.12-gentoo-r6 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz
Gentoo Base System version 1.6.13
ccache version 2.3 [disabled]
dev-lang/python:     2.3.5
sys-apps/sandbox:    1.2.11
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/
share/config /usr/kde/3.3/shutdown /usr/kde/3.4/env /usr/kde/3.4/share/config /
usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config 
/var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.tu-clausthal.de/pub/linux/gentoo/"
LANG="en_US.UTF-8"
LINGUAS="he"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X X509 aac acl alsa apm arts avi berkdb bitmap-fonts browserplugin cdr 
crypt cups curl divx4linux doc dvd dvdread eds emboss encode examples fam 
foomaticdb fortran gd gdbm gif gpm gstreamer gtk2 icq imagemagick imlib java 
javascript jpeg kde ldap libg++ libwww mad mikmod motif mozilla mp3 mpeg msn 
ncurses nls nvidia ogg oggvorbis opengl oss pam pdflib perl png python qt 
quicktime readline samba sdl smartcard spell ssl tcpd tiff truetype truetype-
fonts type1-fonts unicode usb vcd videos vorbis xine xml2 xmms xv xvid zlib 
linguas_he userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LC_ALL, LDFLAGS, PORTDIR_OVERLAY

==========

gcc version: 3.3.5-20050130
ld version: 2.15.92.0.2 20040927
Comment 1 SpanKY gentoo-dev 2005-09-23 08:14:54 UTC
try this:
echo 'int main(){}' > test.c
gcc test.c

see if that works
Comment 2 Yev 2005-09-23 08:55:58 UTC
(In reply to comment #1)
> try this:
> echo 'int main(){}' > test.c
> gcc test.c
> 
> see if that works

Nope, same thing:
root ~ # echo 'int main(){}' > test.c
root ~ # gcc test.c
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/../../../../i686-pc-linux-gnu/
bin/ld: -f may not be used without -shared
collect2: ld returned 1 exit status
Comment 3 SpanKY gentoo-dev 2005-09-23 08:58:19 UTC
run `gcc -dumpspecs > log` and post the log file as an attachment

then try running:
rm /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/specs
unset GCC_SPECS
gcc test.c
Comment 4 Yev 2005-09-23 09:10:26 UTC
Created attachment 69086 [details]
Output of 'gcc -dumpspecs'
Comment 5 Yev 2005-09-23 09:11:13 UTC
It worked!

I attached the log as you asked.

Could you please explain what the problem was and how deleting the specs file 
fixed it?

Thank you!
Comment 6 SpanKY gentoo-dev 2005-09-23 10:53:48 UTC
now that you've deleted the specs file, can you again run `gcc -dumpspecs >
log2` and then post log2 as an attachment see we can find the differences ?
Comment 7 Yev 2005-09-23 10:57:42 UTC
Created attachment 69093 [details]
Output of 'gcc -dumpspecs' after deleting specs file

Here is the output of #gcc -dumpspecs after deleting the specs file.
Comment 8 Kevin F. Quinn (RETIRED) gentoo-dev 2005-09-24 08:49:18 UTC
Spanky: gcc -dumpspecs always shows exactly and _only_ the specs built-in to the
compiler.  In particular it takes _no_ account of any specs files whether
specified by GCC_SPECS, -specs or the file in the default location in the
filesystem.  So unfortunately the two logs are identical, and don't prove anything.
Comment 9 SpanKY gentoo-dev 2005-09-24 16:54:49 UTC
ah, i thought -dumpspecs would output the active specs

oh well ;)

Yev: can you re-emerge gcc and see if it works ?  it sounds like some corruption
damaged your specs file ...
Comment 10 Yev 2005-09-27 12:08:24 UTC
But it works without having to re-emerge gcc.
After i deleted the specs file and unset GCC_SPECS it started working again.

Anyway, i will update the gcc version anyway in few days so if you want me to 
check/post anything else i'll be glad to.
Comment 11 SpanKY gentoo-dev 2005-09-27 12:36:05 UTC
right ... i just wanted to make sure your machine worked properly even after
rebuilding gcc (that way we're pretty sure that it isnt the gcc ebuild which is
broken)

please post the results when you get a chance to re-emerge gcc