Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 59709 - ghc-6.2.1-r1.ebuild: -fno-stack-protector option breaks PPC compile
Summary: ghc-6.2.1-r1.ebuild: -fno-stack-protector option breaks PPC compile
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: PPC Linux
: High normal (vote)
Assignee: Gentoo's Haskell Language team
Depends on:
Blocks: cflags 59753
  Show dependency tree
Reported: 2004-08-07 09:25 UTC by David Brown
Modified: 2004-10-26 06:51 UTC (History)
3 users (show)

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

Fix ebuild to build for PPC. (ghc-6.2.1-r1.ebuild.diff,1.23 KB, patch)
2004-08-08 01:22 UTC, David Brown
Details | Diff
Modified "hardened" patch for ppc. (ghc-6.2.hardened-ppc.patch.bz2,337 bytes, patch)
2004-08-08 01:23 UTC, David Brown
Details | Diff
Patch to apply in dev-lang/ghc (ghc-6.2.1-r1.diff,1.64 KB, patch)
2004-09-25 04:33 UTC, Matthieu Sozeau (RETIRED)
Details | Diff
The new patch (ghc-6.2.1-r1.ebuild.patch,2.26 KB, patch)
2004-09-25 11:56 UTC, Matthieu Sozeau (RETIRED)
Details | Diff
Reworked hardened patch to allow dynamic setting of the -optc-f options. (ghc-6.2.1-hardened.patch,525 bytes, patch)
2004-09-25 11:57 UTC, Matthieu Sozeau (RETIRED)
Details | Diff
patch for ghc-6.2.2.ebuild (ghc-6.2.2.patch,309 bytes, patch)
2004-10-19 04:37 UTC, Andres Loeh (RETIRED)
Details | Diff
patch for ghc-6.2.2.ebuild (new) (ghc-6.2.2.patch,1.43 KB, patch)
2004-10-19 10:39 UTC, Andres Loeh (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Brown 2004-08-07 09:25:06 UTC
gcc on ppc doesn't recognize the -fno-stack-protector option.  This is appears both in the ghc-6.2.hardened.patch.bz2 patch as well as inserted into by the src_compile function.

Reproducible: Always
Steps to Reproduce:
1.  ACCEPT_KEYWORDS="~ppc" emerge dev-lang/ghc
Actual Results:  
gcc reports an unrecognized option -fno-stack-protector.

I'll try and get this working.  Once I have a working ebuild, I'll attach it.
Comment 1 David Brown 2004-08-08 01:22:50 UTC
Created attachment 37004 [details, diff]
Fix ebuild to build for PPC.

I'm not sure if the modified hardened patch is needed.	When I get more time,
I'll test without it.  With this change and the modified patch, I can build on
PPC, and have build a few test programs with ghc.
Comment 2 David Brown 2004-08-08 01:23:24 UTC
Created attachment 37005 [details, diff]
Modified "hardened" patch for ppc.
Comment 3 Pieter Van den Abeele (RETIRED) gentoo-dev 2004-09-22 15:52:38 UTC
cc'ing hardened on this for advice.
Comment 4 Pieter Van den Abeele (RETIRED) gentoo-dev 2004-09-24 15:11:38 UTC
Please cc ppc again when something needs testing.
Comment 5 solar (RETIRED) gentoo-dev 2004-09-24 16:37:33 UTC
I don't use ghc and I can't confirm this one for hardened. But why it would fail on ppc and not others baffles me.
Comment 6 David Brown 2004-09-24 17:03:20 UTC
I think ppc is fairly far behind in gcc, and it doesn't have the -fno-stack-protector option.
Comment 7 Andres Loeh (RETIRED) gentoo-dev 2004-09-25 01:27:44 UTC
I can't test on ppc, although this change looks reasonable. 
mattam, you have committed ppc changes to ghc in the past.
If it works for you, could you commit it?

Comment 8 Matthieu Sozeau (RETIRED) gentoo-dev 2004-09-25 04:24:17 UTC
Not all ppc gcc's support -fstack-protector as you discovered, so we have to find out if the one used to build ghc does (and accepts -fno-stack-protector). Please tell us, david, if applying the patch i attach works (didn't touch the hardened things, so if it fails try to check if it's not their fault).
Comment 9 Matthieu Sozeau (RETIRED) gentoo-dev 2004-09-25 04:33:19 UTC
Created attachment 40366 [details, diff]
Patch to apply in dev-lang/ghc 

Doesn't touch the hardened patch, so you may have to modify the two scripts
modified, although it's unlikely (the patch is not applied unless
stack-protector options are accepted).
Comment 10 David Brown 2004-09-25 10:38:25 UTC
The patch fails to unpack:
tg4 ghc # ebuild ghc-6.2.1-r1.ebuild unpack
>>> md5 src_uri ;-) ghc-6.2.1-src.tar.bz2
>>> Unpacking source...
>>> Unpacking ghc-6.2.1-src.tar.bz2 to /var/tmp/portage/ghc-6.2.1-r1/work
/usr/sbin/ line 76: has_spp: command not found
/usr/sbin/ line 81: pushd: ghc/compiler/ghci: No such file or directory
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|--- Linker.orig.lhs    2004-06-15 10:06:03.955035728 +0200
|+++ Linker.lhs 2004-06-15 10:08:53.446269144 +0200
File to patch:  
Comment 11 Matthieu Sozeau (RETIRED) gentoo-dev 2004-09-25 11:05:01 UTC
First, sorry, the line "cd ${S}" has to remain outside the 'if has_spp'. 
Second, sorry again, the 'has_spp' not found error may come from the fact that it's not exported by the flag-o-matic eclass (and my portage has no problems with that but not yours). I will attach a fixed patch in a minute.
Comment 12 Matthieu Sozeau (RETIRED) gentoo-dev 2004-09-25 11:56:44 UTC
Created attachment 40402 [details, diff]
The new patch

Same thing, apply the patch on the original version, not the already patched
It should get rid of all the previous errors. Don't forget to get the new
hardened patch before anything else.
Comment 13 Matthieu Sozeau (RETIRED) gentoo-dev 2004-09-25 11:57:51 UTC
Created attachment 40403 [details, diff]
Reworked hardened patch to allow dynamic setting of the -optc-f options.

The new hardened patch.
Comment 14 Andres Loeh (RETIRED) gentoo-dev 2004-10-18 10:47:39 UTC
I've heard no complaints, and since it does seem to work for mattam 
and does not make things worse for me, I have included the changes
into ghc-6.2.1-r1 and the new ghc-6.2.2 ...

I'd be interested in feedback -- can we close this bug?
Comment 15 Matthieu Sozeau (RETIRED) gentoo-dev 2004-10-19 00:54:18 UTC
I'm perfectly fine with it now, you can close it.
Comment 16 Peter Simons 2004-10-19 04:12:14 UTC
I have a comment which might as well go to this PR rather than opening a new one: 
The use of the -fno-pic option has been discouraged by the hardened team because it does not only disable PIE building, but PIC building altogether.

The correct way to disable the hardened features is:

  -optc-nopie -optc-fno-stack-protector -optc-fno-stack-protector-all

Thought I should let you know, since I suggested the incorrect flags in the first place. :-)
Comment 17 Andres Loeh (RETIRED) gentoo-dev 2004-10-19 04:37:03 UTC
Created attachment 42158 [details, diff]
patch for ghc-6.2.2.ebuild

So -- using the example of ghc-6.2.2, you're proposing this patch to the

I'm currently testing it, and am willing to do it. Any reference to a place
what you just said is written down as a reference?

Comment 18 Peter Simons 2004-10-19 04:41:19 UTC
Be careful: The flag is "-nopie", not "-fno-pie". It strays from the usual naming scheme. You'll find it described here:
Comment 19 Andres Loeh (RETIRED) gentoo-dev 2004-10-19 10:39:45 UTC
Created attachment 42190 [details, diff]
patch for ghc-6.2.2.ebuild (new)

Ok, thanks for the link. The wrong flag caused me to discover
that mattam's flag-test-routine seems to work unreliably under
certain circumstances.

I rewrote it and now it seems to work fine -- at least for me.
I am running another test, now using the attached patch for

Comment 20 Andres Loeh (RETIRED) gentoo-dev 2004-10-26 06:51:17 UTC
I have committed the fix -- closing the bug, please test ...