Gentoo Logo
Gentoo Spaceship

Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-alt
Lists: gentoo-alt: < Prev By Thread Next > < Prev By Date Next >
To: gentoo-alt@g.o
From: Fabian Groffen <grobian@g.o>
Subject: [PREFIX] Solaris && GNU ld 2.22
Date: Fri, 17 Feb 2012 23:06:53 +0100

I just ran into this problem myself on all of my Solaris Prefixes.

Problem: after upgrading GNU binutils to 2.22, compiling starts to fail

On x86-based Solaris, any compilation fails with an ld error like this:
  ld: target elf32-i386 not found
sparc-based systems fail when linking against libraries that GNU linker
scripts exist for (e.g. libpcre, or libz) with a similar error.

Cause: starting from GNU ld 2.21 a targets for Solaris were introduced,
*_sol2, that strictly match the Solaris 2 ABI.  In GNU ld 2.22 these
targets are the only ones that work.  GCC 4.5 knows about this, and
targets the *_sol2 targets at configure time.

If you upgrade GNU binutils to 2.22, your system hence breaks when your
GCC wasn't compiled when GNU binutils 2.21 was around on your system.

On sparc-based systems, the problem can be remedied quite easily,
fortunately, by just fixing the GNU ld-scripts to reference the right
target, like so for a 32-bits environment:
  sed -i -e 's/^OUTPUT_FORMAT ( elf32-sparc )$/OUTPUT_FORMAT ( elf32-sparc-sol2 )/' $EPREFIX/usr/lib/lib*.so
or likewise for a 64-bits environment:
  sed -i -e 's/^OUTPUT_FORMAT ( elf64-sparc )$/OUTPUT_FORMAT ( elf64-sparc-sol2 )/' $EPREFIX/usr/lib/lib*.so

Because of a different setup in the GCC spec-file for x86-based systems,
the fix there is much more complicated.  If possible, recompile gcc
before upgrading binutils.  GCC now has a patch that makes it behave
on x86 like sparc, such that the damage is reduced.

Like on sparc, we need to fix the GNU ld-scripts, for 32-bits
  sed -i -e 's/^OUTPUT_FORMAT ( elf32-i386 )$/OUTPUT_FORMAT ( elf32-i386-sol2 )/' $EPREFIX/usr/lib/lib*.so
or for a 64-bits environment:
  sed -i -e 's/^OUTPUT_FORMAT ( elf64-x86-64 )$/OUTPUT_FORMAT ( elf64-x86-64-sol2 )/' $EPREFIX/usr/lib/lib*.so

With the broken interaction of the compiler with the linker, we have to
hack around it by using a GCC spec-file that won't omit a (wrong) target
when calling the linker.

  gcc -dumpspecs | sed 's/!m64:/m32/' > /var/tmp/specs
  env CC="gcc -specs=/var/tmp/specs" emerge -1 gcc

After this you should have a working compiler again.

Fabian Groffen
Gentoo on a different level
signature.asc (Digital signature)
Lists: gentoo-alt: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
sparc mysql-5.5.20
Next by thread:
prefix X11 clients hang on Mac OS X 10.6
Previous by date:
Re: alias repos: gentoo_prefix to gentoo
Next by date:
prefix X11 clients hang on Mac OS X 10.6

Updated Jun 18, 2012

Summary: Archive of the gentoo-alt mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.