Bug 165523 - [fPIC] games-fps/quakeforge doesn't build on amd64
Bug#: 165523 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: CLOSED Severity: normal Priority: P2
Resolution: NEEDINFO Assigned To: games@gentoo.org Reported By: luke-jr+gentoobugs@utopios.org
Component: Games
URL: 
Summary: [fPIC] games-fps/quakeforge doesn't build on amd64
Keywords:  
Status Whiteboard: 
Opened: 2007-02-05 22:12 0000
Description:   Opened: 2007-02-05 22:12 0000
r_screen.Tpo"; exit 1; fi
 x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include
-I../../../include -O2 -march=k8 -pipe -ftracer -pipe -Wall -fno-common -MT
r_screen.lo -MD -MP -MF .deps/r_screen.Tpo -c r_screen.c  -fPIC -DPIC -o
.libs/r_screen.o
 x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include
-I../../../include -O2 -march=k8 -pipe -ftracer -pipe -Wall -fno-common -MT
r_screen.lo -MD -MP -MF .deps/r_screen.Tpo -c r_screen.c -o r_screen.o
>/dev/null 2>&1
/bin/sh ../../../libtool --mode=link x86_64-pc-linux-gnu-gcc  -O2 -march=k8
-pipe -ftracer -pipe -Wall -fno-common  -Wl,-O1 -o libQFrenderer_sw.la 
-version-info 1:0:0 -rpath /usr/games/lib64 r_cvar.lo r_efrag.lo r_ent.lo
r_graph.lo r_light.lo r_main.lo r_part.lo r_progs.lo r_screen.lo sw/libsw.la
-lm
x86_64-pc-linux-gnu-gcc -shared  .libs/r_cvar.o .libs/r_efrag.o .libs/r_ent.o
.libs/r_graph.o .libs/r_light.o .libs/r_main.o .libs/r_part.o .libs/r_progs.o
.libs/r_screen.o -Wl,--whole-archive sw/.libs/libsw.a -Wl,--no-whole-archive 
-lm  -march=k8 -Wl,-O1 -Wl,-soname -Wl,libQFrenderer_sw.so.1 -o
.libs/libQFrenderer_sw.so.1.0.0
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/../../../../x86_64-pc-linux-gnu/bin/ld:
sw/.libs/libsw.a(d_edge.o): relocation R_X86_64_32 against
`transformed_modelorg' can not be used when making a shared object; recompile
with -fPIC
sw/.libs/libsw.a(d_edge.o): could not read symbols: Bad value
collect2: ld returned 1 exit status
make[4]: *** [libQFrenderer_sw.la] Error 1
make[4]: Leaving directory
`/var/tmp/portage/quakeforge-0.5.5-r1/work/quakeforge-0.5.5/libs/video/renderer'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/var/tmp/portage/quakeforge-0.5.5-r1/work/quakeforge-0.5.5/libs/video/renderer'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/var/tmp/portage/quakeforge-0.5.5-r1/work/quakeforge-0.5.5/libs/video'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
`/var/tmp/portage/quakeforge-0.5.5-r1/work/quakeforge-0.5.5/libs'
make: *** [all-recursive] Error 1

!!! ERROR: games-fps/quakeforge-0.5.5-r1 failed.
Call stack:
  ebuild.sh, line 1546:   Called dyn_compile
  ebuild.sh, line 937:   Called src_compile
  quakeforge-0.5.5-r1.ebuild, line 105:   Called die

------- Comment #1 From Jakub Moc (RETIRED) 2007-02-05 22:22:50 0000 -------
Not keyworded for amd64 at all.

------- Comment #2 From Luke-Jr 2007-02-05 22:24:18 0000 -------
How is that relevant? Isn't an improper lack of -fPIC a bug on all platforms,
even if only a compile error on amd64?

------- Comment #3 From Luke-Jr 2007-02-06 16:30:07 0000 -------
reopening since bug is still valid, even if not as
apparent/visible/in-your-face on other platforms

------- Comment #4 From Luke-Jr 2007-02-06 16:38:08 0000 -------
see "Case 3" from
http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3
    "This is the most common case. It is a real bug in the build system and
should be fixed in the ebuild, preferably with a patch that is sent upstream."

------- Comment #5 From Chris Gianelloni (RETIRED) 2007-02-20 16:59:47 0000 -------
Feel free to provide said patch.  ;]

------- Comment #6 From Luke-Jr 2007-02-20 17:11:42 0000 -------
http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/games/quakeforge/files/patch-libs__video__renderer__sw__Makefile.in?content-type=text/plain

------- Comment #7 From Flophouse Joe 2007-06-25 02:54:29 0000 -------
Created an attachment (id=123000) [details]
games-fps/quakeforge/quakeforge-0.5.5-r2.ebuild

------- Comment #8 From Flophouse Joe 2007-06-25 02:55:02 0000 -------
Created an attachment (id=123002) [details]
games-fps/quakeforge/files/quakeforge-0.5.5-fpic.patch

------- Comment #9 From Flophouse Joe 2007-06-25 02:55:37 0000 -------
I've tested the patch supplied in comment #6 and confirmed that it allows
quakeforge to build successfully for me on amd64 and x86.  I've also verified
that the client qw-client-sdl starts on each platform and displays the Quake
console without blowing up.

Since this patch works for me on each of x86 and amd64, I've created a new
ebuild quakeforge-0.5.5-r2.ebuild that includes the patch.

How do you guys feel about adding the new -r2 to portage for testing?

------- Comment #10 From Tupone Alfredo 2007-07-08 11:11:13 0000 -------
emerge --info please

and 

would you mind trying with at least

USE="X alsa ncurses opengl sdl vorbis xv zlib" emerge quakeforge

just to compare with my own build

amd64 does not build here

------- Comment #11 From Flophouse Joe 2007-07-08 15:20:32 0000 -------
(In reply to comment #10)
> emerge --info please

I tried building quakeforge-0.5.5 again today on AMD64 and it compiled
successfully.  Here is the "emerge --info" from the working system:

Portage 2.1.2.9 (default-linux/amd64/2007.0/desktop, gcc-4.1.2, glibc-2.5-r3,
2.6.20-gentoo-r8 x86_64)
=================================================================
System uname: 2.6.20-gentoo-r8 x86_64 Intel(R) Pentium(R) D CPU 3.20GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Sun, 08 Jul 2007 06:20:01 +0000
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=nocona"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config
/usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/revdep-rebuild
/etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=nocona"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo http://mirrors.tds.net/gentoo
"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress
--force --whole-file --delete --delete-after --stats --timeout=180
--exclude=/distfiles --exclude=/local --exclude=/packages
--filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://gentoo-rsync.halibutdepot.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 arts berkdb bitmap-fonts cairo cdr cli
cracklib crypt cups dbus dri dvd dvdr dvdread eds emboss encode esd evo fam
fame flac fortran gcj gdbm gif gnome gpm gstreamer gtk hal iconv imagemagick
isdnlog jpeg kde kerberos libg++ mad midi mikmod mmx mp3 mpeg mudflap ncurses
nls nptl nptlonly ogg opengl openmp oss pam pcre pdf perl png pppd python qt3
qt3support qt4 quicktime readline reflection sdl session spell spl sse sse2 ssl
svg tcpd theora tiff truetype truetype-fonts type1-fonts unicode vorbis xml
xorg xscreensaver xv xvid zlib" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm
alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa
lfloat linear meter mulaw multi null plug rate route share shm softvol"
ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad
cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU"
VIDEO_CARDS="fbdev vesa vga i810"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS,
LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS,
PORTDIR_OVERLAY

> would you mind trying with at least
> 
> USE="X alsa ncurses opengl sdl vorbis xv zlib" emerge quakeforge
> 
> just to compare with my own build
> 
> amd64 does not build here

After I added the "x86" keyword to package.keywords and tried using the exact
USE flags you recommended, quakeforge-0.5.5 *did* compile successfully for me. 
(This was using the same system whose "emerge --info" was shown above.)

I don't remember having been able to get quakeforge to compile on AMD64 without
using the patch from comment #7, so I tried rebuilding quakeforge-0.5.5 again
using usual USE flags I always use-- this also worked correctly.

The "usual" flags that I use to build quakeforge-- and the ones that work
correctly for me right now-- are these:

becky16 ~ # emerge -pv quakeforge

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] games-fps/quakeforge-0.5.5  USE="X alsa cdinstall ncurses
opengl oss sdl vorbis xv zlib (-3dfx) -debug -dga -fbcon -ipv6 (-svga)" 0 kB 

Total: 1 package (1 new), Size of downloads: 0 kB

I'll make every effort to be available for testing; please let me know how I
can help.

------- Comment #12 From Tupone Alfredo 2007-07-08 22:40:07 0000 -------
I had some difficulty trying to fix the Makefile.am and doing autoreconf the
whole tree, as the changes are not limited to the indicated directory, but span
on most of it. So I gave up. But changing only the Makefile.in as is in the
attached patch works. It is fixed now, but this patch is not a candidate for
upstream, IMHO.