Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 621774 - dev-haskell/readline-1.0.3.0 : collect2: error: ld returned 1 exit status
Summary: dev-haskell/readline-1.0.3.0 : collect2: error: ld returned 1 exit status
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords:
: 621766 621838 621852 622116 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-14 17:55 UTC by Toralf Förster
Modified: 2018-01-15 09:41 UTC (History)
4 users (show)

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


Attachments
emerge-info.txt (emerge-info.txt,8.76 KB, text/plain)
2017-06-14 17:55 UTC, Toralf Förster
Details
dev-haskell:readline-1.0.3.0:20170614-134255.log (dev-haskell:readline-1.0.3.0:20170614-134255.log,7.35 KB, text/plain)
2017-06-14 17:55 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,192.31 KB, text/plain)
2017-06-14 17:55 UTC, Toralf Förster
Details
environment (environment,106.02 KB, text/plain)
2017-06-14 17:56 UTC, Toralf Förster
Details
etc.portage.tbz2 (etc.portage.tbz2,28.55 KB, application/x-bzip)
2017-06-14 17:56 UTC, Toralf Förster
Details
logs.tbz2 (logs.tbz2,3.75 KB, application/x-bzip)
2017-06-14 17:56 UTC, Toralf Förster
Details
temp.tbz2 (temp.tbz2,26.69 KB, application/x-bzip)
2017-06-14 17:56 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2017-06-14 17:55:50 UTC
    Please use spaces instead.
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status
`x86_64-pc-linux-gnu-gcc' failed in phase `Linker'. (Exit code: 1)
 * ERROR: dev-haskell/readline-1.0.3.0::gentoo failed (compile phase):
 *   setup build failed

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.0-desktop_20170610-230638

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-6.3.0 *

Available Python interpreters, in order of preference:
  [1]   python3.4
  [2]   python2.7 (fallback)
  [3]   jython2.7 (fallback)
Available Ruby profiles:
  [1]   ruby21 (with Rubygems)
  [2]   ruby22 (with Rubygems) *
java-config:
The following VMs are available for generation-2:
*)	IcedTea JDK 3.4.0 [icedtea-bin-8]
Available Java Virtual Machines:
  [1]   icedtea-bin-8  system-vm
Comment 1 Toralf Förster gentoo-dev 2017-06-14 17:55:53 UTC
Created attachment 476436 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2017-06-14 17:55:56 UTC
Created attachment 476438 [details]
dev-haskell:readline-1.0.3.0:20170614-134255.log
Comment 3 Toralf Förster gentoo-dev 2017-06-14 17:55:59 UTC
Created attachment 476440 [details]
emerge-history.txt
Comment 4 Toralf Förster gentoo-dev 2017-06-14 17:56:02 UTC
Created attachment 476442 [details]
environment
Comment 5 Toralf Förster gentoo-dev 2017-06-14 17:56:05 UTC
Created attachment 476444 [details]
etc.portage.tbz2
Comment 6 Toralf Förster gentoo-dev 2017-06-14 17:56:08 UTC
Created attachment 476446 [details]
logs.tbz2
Comment 7 Toralf Förster gentoo-dev 2017-06-14 17:56:11 UTC
Created attachment 476448 [details]
temp.tbz2
Comment 8 Sergei Trofimovich gentoo-dev 2017-06-14 19:56:19 UTC
Was the ghc built on USE=pie gcc? ghc does build-tile detection of -pie flag support from gcc. 

$ ghc --info | grep pie
 ,("C compiler supports -no-pie","YES")

If it's not what gets reported you would need to rebuild ghc.
Comment 9 Sergei Trofimovich gentoo-dev 2017-06-14 19:56:54 UTC
*** Bug 621766 has been marked as a duplicate of this bug. ***
Comment 10 Toralf Förster gentoo-dev 2017-06-14 20:59:25 UTC
(In reply to Sergei Trofimovich from comment #8)
it is 17.0 profile : 17.0-desktop_20170610-230638, so, yes, it is pie related, or ?
Comment 11 Sergei Trofimovich gentoo-dev 2017-06-15 20:10:42 UTC
*** Bug 621838 has been marked as a duplicate of this bug. ***
Comment 12 Sergei Trofimovich gentoo-dev 2017-06-15 20:16:43 UTC
(In reply to Toralf Förster from comment #10)
> (In reply to Sergei Trofimovich from comment #8)
> it is 17.0 profile : 17.0-desktop_20170610-230638, so, yes, it is pie
> related, or ?

It's likely pie related.

AFAIU your dev-lang/ghc is build with gcc-5.4.0 (with pie disabled).
You need to build dev-lang/ghc against gcc-6.3.0 (pie enabled).
Comment 13 Toralf Förster gentoo-dev 2017-06-15 20:20:51 UTC
(In reply to Sergei Trofimovich from comment #12)
I'd disagree - please look at the attached emerge-history. GCC is almost the first thing which is upgraded at a tinderbox image (and the old GCC will be unmerged after that)
Comment 14 Sergei Trofimovich gentoo-dev 2017-06-15 20:23:20 UTC
*** Bug 621852 has been marked as a duplicate of this bug. ***
Comment 15 Sergei Trofimovich gentoo-dev 2017-06-15 20:25:06 UTC
(In reply to Toralf Förster from comment #13)
> (In reply to Sergei Trofimovich from comment #12)
> I'd disagree - please look at the attached emerge-history. GCC is almost the
> first thing which is upgraded at a tinderbox image (and the old GCC will be
> unmerged after that)

Are those all packages installed from sources or built binpkgs?
I (incorrectly?) assumed binpkgs.

Can you provide output of
$ ghc --info | grep pie
after package build fails?
Comment 16 Toralf Förster gentoo-dev 2017-06-15 20:31:19 UTC
(In reply to Sergei Trofimovich from comment #15)
tinderbox@mr-fox ~ $ scw run/17.0-desktop_20170610-230638
mr-fox / #  ghc --info | grep pie
 ,("C compiler supports -no-pie","NO")
Comment 17 Sergei Trofimovich gentoo-dev 2017-06-18 16:48:41 UTC
*** Bug 622116 has been marked as a duplicate of this bug. ***
Comment 18 Gleb 2017-12-04 08:21:39 UTC
I had similar issue but with dev-haskell/hslua (there's a duplicate bug) and dev-lang/ghc[binary] after I updated to GCC 6.4.0 and switched profile to 17.0.

Rebuilding GHC 8.0.2 without binary flag solved the issue.
Comment 19 Paul Tobias 2018-01-09 07:24:56 UTC
I do not have a binary flag. After switching to profile 17.0 and reemerging world had these 3 packages failing with the same "ld: -r and -pie may not be used together" error message :
dev-haskell/curl-1.3.8
dev-haskell/hslua-0.3.6.1 (bug #621852 which is duplicate of this bug)
dev-haskell/hackage-security-0.5.2

Fixed all 3 of them by adding flag-o-matic to inherit and the following to src_compile:
  append-ldflags -no-pie
Comment 20 Sergei Trofimovich gentoo-dev 2018-01-09 07:48:44 UTC
(In reply to Paul Tobias from comment #19)
> I do not have a binary flag. After switching to profile 17.0 and reemerging
> world had these 3 packages failing with the same "ld: -r and -pie may not be
> used together" error message :
> dev-haskell/curl-1.3.8
> dev-haskell/hslua-0.3.6.1 (bug #621852 which is duplicate of this bug)
> dev-haskell/hackage-security-0.5.2
> 
> Fixed all 3 of them by adding flag-o-matic to inherit and the following to
> src_compile:
>   append-ldflags -no-pie

You need to rebuild ghc after you have switched gcc to USE=pie. No need to patch any haskell packages.
Comment 21 Paul Tobias 2018-01-09 09:31:59 UTC
> You need to rebuild ghc after you have switched gcc to USE=pie. No need to
> patch any haskell packages.

Hmm, I did rebuild ghc as part of the "emerge -e world". Now I've rebuilt it again. But the ghc ebuild sets "-no-pie". For example this shows up when building ghc:

>>> Configuring source in /tmp/portage/dev-lang/ghc-7.10.3/work/ghc-7.10.3 ...
 * Final mk/build.mk:
# Gentoo changes
docdir = /usr/share/doc/ghc-7.10.3
htmldir = /usr/share/doc/ghc-7.10.3
SRC_HC_OPTS+=  -optc-march=haswell -opta-march=haswell -optl-Wl,-O1 -optl-Wl,--as-needed -optc-no-pie -optl-no-pie
SRC_CC_OPTS+=-O2 -pipe -march=haswell -march=haswell -march=haswell -no-pie
SRC_LD_OPTS+=-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed -no-pie

And it can also be see at the end of `emerge --info dev-lang/ghc`:

dev-lang/ghc-7.10.3::gentoo was built with the following:
USE="gmp -binary -doc -ghcbootstrap -ghcmakebinary" ABI_X86="(64)"
CFLAGS="-O2 -pipe -march=haswell -march=haswell -march=haswell -no-pie"
CXXFLAGS="-O2 -pipe -march=haswell"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed -no-pie"

(I'm using ghc-7.10.3 here because of app-emulation/ganeti, but the ebuilds for ghc-8* seems to do the same.)

So I'm seeing a different bug, just with the same "ld: -r and -pie may not be used together" error message? Or what else can I do if rebuilding GHC doesn't help?
Comment 22 Zentoo 2018-01-11 08:20:19 UTC
(In reply to Paul Tobias from comment #21)
> 
> (I'm using ghc-7.10.3 here because of app-emulation/ganeti, but the ebuilds
> for ghc-8* seems to do the same.)

I got actually the exact same problem here.
Even with LDFLAGS=-no-pie to fix these haskell libraries I can't emerge ganeti.
Did you find a way to achieve it ? (need I to open a new bug to keep this one clean ?)
Comment 23 Martin Wegner 2018-01-15 09:41:41 UTC
Ran into the same issue with dev-lang/ghc-8.0.2[binary] . Will there be a binary build of ghc with pie enabled since the non-17.0 profiles are now deprecated?