Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 593892 - dev-lang/ghc embeds -nopie CFLAG into wrapper on on gcc-spes-pie gcc, breaks on sys-devel/gcc-6.2.0: unrecognized command line option ‘-nopie’; did you mean ‘-no-pie’?
Summary: dev-lang/ghc embeds -nopie CFLAG into wrapper on on gcc-spes-pie gcc, breaks ...
Status: RESOLVED FIXED
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:
Depends on:
Blocks: gcc-6 582688
  Show dependency tree
 
Reported: 2016-09-15 16:58 UTC by jeremiah
Modified: 2017-09-27 15:29 UTC (History)
2 users (show)

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


Attachments
Complete build log for dev-haskell/dlist-0.8.0.2 (build.log,2.68 KB, text/plain)
2016-09-15 19:29 UTC, jeremiah
Details
config.log (config.log,11.42 KB, text/plain)
2017-02-28 08:40 UTC, eroen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jeremiah 2016-09-15 16:58:33 UTC
This line pretty much sums it all up:
x86_64-pc-linux-gnu-gcc: error: unrecognized command line option ‘-nopie’; did you mean ‘-no-pie’?

Apparently GCC 6 no longer allows "-nopie".

Got it with every attempted update or install of a dev-haskell/* package. Haskell overlay is present, but the error persisted when a package was forced with "::gentoo".
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2016-09-15 18:59:00 UTC
Can you post an example build.log for a faulty package?
Comment 2 jeremiah 2016-09-15 19:29:40 UTC
Created attachment 445866 [details]
Complete build log for dev-haskell/dlist-0.8.0.2
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2016-09-15 20:46:43 UTC
Can you post your

$ emerge --info sys-devel/gcc

I guess you are using USE=pie gcc.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2016-09-15 21:17:46 UTC
Basically the issue is:

gentoo-specific pardened patches added '-pie'/'-nopie' commandline flag
while upstream gcc-6 slightly changed flag name to '-pie'/'-no-pie'

Upstream issue is https://ghc.haskell.org/trac/ghc/ticket/11834
where ghc needs to learn to autodetect gcc -fPIC/-fno-PIC default.

Meanwhile in gentoo we can use test-flag-CC from flag-o-matic.eclass
to pick from '-no-pie' / '-nopie'.
Comment 5 jeremiah 2016-10-04 15:39:58 UTC
the error does not persist after upgrading to ghc-8.0.1 and cabal-1.24; however, this is not really a fix
Comment 6 eroen 2016-11-15 14:51:13 UTC
(In reply to jeremiah from comment #5)
> the error does not persist after upgrading to ghc-8.0.1 and cabal-1.24;
> however, this is not really a fix

But how? ghc ebuild still does 

    gcc-specs-pie && append-ghc-cflags persistent compile link -nopie

in src_prepare(). Fwiw, I at least still can't build ghc with gcc-6.

Please, could someone replace the line above (236 in ghc-8.0.1.ebuild) with something like

    if test-flags -nopie >/dev/null ; then
        gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
    else
        gcc-specs-pie && append-ghc-cflags persistent compile link -no-pie
    fi

flag-o-matic is already inherited by the ebuild. The same pattern is used by filter-flags() in flag-o-matic.eclass, an alternative would be to just use that in stead of embedding toolchain checks in the ebuild.
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2017-02-27 22:52:46 UTC
ghc-8.0.2 should handle -nopie/-no-pie better.
It will still require rebuilding ghc to get rid of -no-pie from wrapper.
Comment 8 eroen 2017-02-28 08:40:25 UTC
Created attachment 465496 [details]
config.log

checking target system type... x86_64-pc-linux-gnu
GHC build  : x86_64-unknown-linux
GHC host   : x86_64-unknown-linux
GHC target : x86_64-unknown-linux
configure: Building in-tree ghc-pwd
x86_64-pc-linux-gnu-gcc: error: unrecognized command line option '-nopie'; did you mean '-no-pie'?
configure: error: Building ghc-pwd failed

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/dev-lang/ghc-8.0.2/work/ghc-8.0.2/config.log
 * ERROR: dev-lang/ghc-8.0.2::haskell failed (configure phase):
 *   econf failed

Same with ghc from gentoo proper. This is with gcc-6.3.0.
Comment 9 eroen 2017-02-28 08:50:21 UTC
(In reply to eroen from comment #8)
Nevermind, this is because of USE=ghcbootstrap. Please disregard, sorry.