Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 411185 - games-puzzle/gfifteen-0.10.2 fails to compile
Summary: games-puzzle/gfifteen-0.10.2 fails to compile
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-07 19:56 UTC by Hans
Modified: 2012-04-18 19:20 UTC (History)
1 user (show)

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


Attachments
build log (build.log,5.31 KB, text/plain)
2012-04-07 19:56 UTC, Hans
Details
emerge --info (emerge.info,3.37 KB, text/plain)
2012-04-07 19:57 UTC, Hans
Details
gfifteen-1.0.2.ebuild (UPDATED EBUILD) (gfifteen-1.0.2.ebuild,804 bytes, text/plain)
2012-04-18 19:00 UTC, Christopher Howard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans 2012-04-07 19:56:51 UTC
Created attachment 308151 [details]
build log

games-puzzle/gfifteen-0.10.2 fails to compile with the following error:

[...]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/../../../../x86_64-pc-linux-gnu/bin/ld: randboard.o: relocation R_X86_64_32S against `gf_bsquare_values' can not be used when making a shared object; recompile with -fPIC
randboard.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [gfifteen] Error 1
[...]
Comment 1 Hans 2012-04-07 19:57:27 UTC
Created attachment 308153 [details]
emerge --info
Comment 2 Hans 2012-04-11 20:16:03 UTC
gfifteen 1.0 fails the same way.
Both work fine with x86_64-pc-linux-gnu-4.6.2-hardenednopie, though.
Comment 3 Christopher Howard 2012-04-18 19:00:43 UTC
Created attachment 309445 [details]
gfifteen-1.0.2.ebuild (UPDATED EBUILD)

The cause of this bug is that the software uses hand-crafted amd64 assembly sources (for optimization) which are not PIC-friendly. Hardened-gentoo requires that object code be PIC.

It should be possible to adjust the assembly sources to be PIC-friendly; however, it is a bit of work and is not a high priority at the moment because this software is just a game that doesn't consume much resources anyway. Instead, the upstream code has been adjusted to allow the use of a "--disable-assembly" configure flag, which disables use of the assembly sources (reverting to the more generic code). The source package is available from the project homepage at <https://frigidcode.com/code/gfifteen/gfifteen-1.0.2.tar.gz>.

I wasn't quite sure of the proper way to handle this on the Gentoo level. However, I saw that there are several packages in portage which use the "pic" USE flag, such as app-arch/gzip. This flag's description is:

  disable optimized assembly code that is not PIC friendly

So my thought is that we could add the pic flag (disabled by default, but presumably enabled on hardened) to the ebuild. If the pic flag is enabled, then econf uses --disable-assembly. I have attached an ebuild I have tested that does this.
Comment 4 Christopher Howard 2012-04-18 19:14:54 UTC
Important note:

I just noticed that the new ebuild does not properly configure the package to install as a game. (In the correct directory, etc.) Please have the Gentoo games group adjust the src_configure() so that it does this properly.
Comment 5 Mr. Bones. (RETIRED) gentoo-dev 2012-04-18 19:20:30 UTC
bah, over-engineering.  assembly optimization is pointless in this application so I just turned it off unconditionally.