Bug 190324 - www-apache/mod_python-3.3.1 fails due to strange LDFLAG issue
Bug#: 190324 Product:  Gentoo Linux Version: 2007.0 Platform: All
OS/Version: Linux Status: RESOLVED Severity: trivial Priority: P2
Resolution: UPSTREAM Assigned To: apache-bugs@gentoo.org Reported By: hetfield666@gmail.com
Component: Ebuilds
URL: 
Summary: www-apache/mod_python-3.3.1 fails due to strange LDFLAG issue
Keywords:  
Status Whiteboard: 
Opened: 2007-08-26 18:14 0000
Description:   Opened: 2007-08-26 18:14 0000
finfoobject.c:278: warning: 'intargfunc' is deprecated
finfoobject.c:278: warning: initialization from incompatible pointer type
/usr/bin/libtool --silent --mode=link x86_64-pc-linux-gnu-gcc -o mod_python.la 
-rpath /usr/lib64/apache2/modules -module -avoid-version    finfoobject.lo
hlistobject.lo hlist.lo filterobject.lo connobject.lo serverobject.lo util.lo
tableobject.lo requestobject.lo _apachemodule.lo mod_python.lo -Wl,-O1
-Wl,--sort-common -Wl,--enable-new-dtags -Wl,--as-needed -Wl,--hash-style=both
-L/usr/lib64/python2.5/config -Xlinker -export-dynamic -Wl,-O1
-Wl,--sort-common -Wl,--enable-new-dtags -Wl,--as-needed -Wl,--hash-style -lm
-lpython2.5 -lpthread -ldl -lutil -lm
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../x86_64-pc-linux-gnu/bin/ld:
invalid hash style `-soname'
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make[1]: *** [mod_python.so] Error 1
make[1]: Leaving directory
`/mnt/Dati/Gentoo/tmp/portage/www-apache/mod_python-3.3.1/work/mod_python-3.3.1/src'
make: *** [do_dso] Error 2

Portage 2.1.3.7 (default-linux/amd64/2007.0, gcc-4.1.2, glibc-2.6.1-r0,
2.6.22.5 x86_64)
=================================================================
System uname: 2.6.22.5 x86_64 Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz
Gentoo Base System release 1.12.10
Timestamp of tree: Sun, 26 Aug 2007 17:30:01 +0000
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632)
[disabled]
ccache version 2.4 [disabled]
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r5, 2.5.1-r2
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.10-r4
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61-r1
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.50.0.18
sys-devel/gcc-config: 1.4.0
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.22-r2
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -pipe -march=nocona -mtune=nocona -fomit-frame-pointer -mmmx -msse
-msse2 -msse3 -mfpmath=sse"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/mail/dspam /opt/openjms/config /usr/kde/3.5/env
/usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib/mozilla/defaults/pref
/usr/share/X11/xkb /usr/share/config /var/run/dspam"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/eselect/compiler
/etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/
/etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo
/etc/texmf/web2c"
CXXFLAGS="-O3 -pipe -march=nocona -mtune=nocona -fomit-frame-pointer -mmmx
-msse -msse2 -msse3 -mfpmath=sse"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages metadata-transfer parallel-fetch sandbox
sfperms strict unmerge-orphans"
GENTOO_MIRRORS="http://distfiles.gentoo.org
http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="39"
LC_ALL="it_IT.utf8"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--enable-new-dtags -Wl,--as-needed
-Wl,--hash-style=both"
LINGUAS="it"
MAKEOPTS="-j4"
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="/mnt/Dati/Gentoo/tmp/"
PORTDIR="/mnt/Dati/Gentoo/portage/"
PORTDIR_OVERLAY="/usr/local/portage/myportage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="64bit 7zip X X509 Xaw3d a52 aac aalib accessibility ace acl acpi
activefilter adns aiglx aio alsa amd amd64 amr amrr amuled ao aoss apache2 arj
asf aspnet2 async atk audacious audiofile authfile automount bash-completion
berkdb bidi binary-drivers bitmap-fonts bittorrent bootsplash browserplugin
bzip2 cairo calendar caps cdda cddb cdio cdparanoia cdr cgi charconv chardet
chroot ciao clamav clearcase cli client codecs corba cracklib crypt cscope css
ctype cups curl cvs daemon dar64 dba dbus depth32 dga dhcp dio directfb diskio
divx djbfft dmi dri dvd dvdr dvdread edl encode ethereal exif expat extraengine
faac faad fam fastbuild fbcon ffmpeg fftw firefox flac flash foreign-package
fortran ftp gcj gd gdbm geometry ggi gif gimp gimpprint glibc-omitfp glitz glut
glx gnokii gnome gnutls gphoto2 gpm graphviz gs gtk gtk2 gtkhtml guile h264 hal
hddtemp iconv idea idn imagemagick imap innodb ipod ipv6 irda irmc isdnlog jack
java java5 javamail javascript jikes jit joystick jpeg jpeg2k junit justify kde
kdeenablefinal kdehiddenvisibility kerberos kqemu lame lcd lcms ldap libcaca
libclamav libgda libusb lirc live lm_sensors lua lzo mad mailwrapper matroska
md5sum mdb mhash midi mikmod mime mmx mmx2 mmxext mng mono mozcalendar
mozdevelop mozilla mozsvg mozxmlterm mp3 mp4 mp4live mpeg mpeg2 mpeg4 mplayer
mpm-prefork msn msnextras mudflap musepack mysql mysqli mythtv nagios-dns
nagios-ntp nagios-ping nagios-ssh ncurses neXt network ngui nls nntp no_wxgtk1
nobsh nopie nossp noxalan nptl nptlonly nsplugin nv nvidia oav odbc ogg openal
opengl openmp openssl operanom2 pam pcre pda pdf pdo pear perl php pmu png pnp
postgres pppd pthreads pulseaudio python qemu-fast qhull qt3 qt4 quicktime
quotas readline reflection rrdtool rtc ruby samba scanner sdl server session
sftplogging sguil slang slp smp snortsam soap sockets socks5 softmmu softquota
spamassassin speex spell spl sqlite3 sse sse2 sse3 ssl ssse3 subject-rewrite
svg tao tcltk tcpd tetex tga theora tiff tokenizer truetype truetype-fonts
trusted type1-fonts unicode usb userlocales vorbis wma wmf wmv wsconvert
wxwindows x264 xanim xchatdccserver xchattext xcomposite xine xinerama xml xml2
xmlrpc xorg xosd xpm xprint xsl xv xvid xvm xvmc zlib" ALSA_CARDS="hda-intel"
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 evdev"
KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001
mtxorb ncurses text" LINGUAS="it" USERLAND="GNU" VIDEO_CARDS="fbdev vesa vga nv
nvidia"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_COMPRESS,
PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

------- Comment #1 From Tiziano Müller 2007-08-26 19:28:47 0000 -------
Sanitize your LDFLAGS, retry, if it still fails then and if it's
python-related, re-CC us.

------- Comment #2 From Patrizio Bassi 2007-08-26 21:38:30 0000 -------
LDFLAGS are a bit bleeding edge but safe. whole world is safely merged with
those.

the point is not if the flag is leading to linking issues or whatever...

the problem is that a part of my LDFLAGS gets somehow stripped out...and this
should not happen...

------- Comment #3 From Jon 2007-09-07 20:06:53 0000 -------
I get the same error with the latest version in portage. I set up my
/etc/portage/env/www-apache/mod_python file with the most basic of CFLAGS and
no LDFLAGS and it still fails. There is an error in the configuration somewhere
that sets up a LDFLAG that this package cannot handle.

------- Comment #4 From Jon 2007-09-07 20:59:21 0000 -------
Created an attachment (id=130287) [details]
src/makefile patch

I did some investigation and I found that after ./configure is run, this line
appears in src/makefile:
LDFLAGS= -L/usr/lib/python2.5/config  -Xlinker -export-dynamic   -Wl,-O1
-Wl,--hash-style 
So, I wrote a patch that takes out the --has-style. I use the new binutils
where --hash-style needs to be followed by '={something}', so it was taking on
a value that it doesn't support: -soname. I did a search though all the files
and profiles but I could not figure out where in the world --hash-styles was
added at. Whereever it is being added at, would be a good place to take it out
and replace it with --hash-style=gnu for those with the new binutils or more
things might start breaking, if portage adds it. If the configure scripts for
mod_python add it, I don't know where, so someone needs to find that and write
a patch to take it out there. My patch only works if you have python 2.5, so
it's best to sed it out, but I am not good at using sed, so I have no idea how
to remove --hash-style after configure with sed, this patch works for me as a
temp solution. Something more permanent needs to be done.

Hope this helps. :) Let's get this fixed in portage somehow better than my
solution. :P

Cheers.

------- Comment #5 From Jon 2007-09-07 21:29:09 0000 -------
Okay, forget the patch, I wrote a sed line that works. :)

I have this in my ebuild now:
src_compile() {
        econf --with-apxs=${APXS2} || die "econf failed"
        sed -i 's/ -Wl,--hash-style//' src/Makefile
        emake OPT="`apxs2 -q CFLAGS` -fPIC" || die "econf failed"
}

Cheers.

------- Comment #6 From Benedikt Böhm 2007-09-09 11:28:14 0000 -------
in cvs

------- Comment #7 From Jon 2007-09-10 17:08:35 0000 -------
I don't have the option to reopen this bug, but it needs to be.

I looked in the new ebuild to find:
src_unpack() {
        unpack ${A}
        cd "${S}"

        # Remove optimisations, we do that outside Portage
        sed -i -e 's:--optimize 2:--no-compile:' dist/Makefile.in
        sed -i -e 's/ -Wl,--hash-style//' src/Makefile
}

The new sed line is in src_unpack. This won't do since src/Makefile does not
even exist until econf or ./configure is run, so this fix does not work. :( It
needs to go right after the econf statement in src_compile like my previous
example. I have looked all over the source and I cannot find where --hash-value
is being added. Something with the configure process is putting it in the
makefile. There must be a global variable or something in the system adding it.
I will hunt some more, but it both running econf and ./configure manually adds
that LD Flag.

Is there any way to test if it is a global variable of some type? That sed line
does fix the issue when it is in scr_compile, but it is not the true fix. The
true cause needs to be found, but I have no idea how to test for that.

Thanks.

------- Comment #8 From Patrizio Bassi 2007-09-10 20:08:44 0000 -------
you're right...and actually it's still failing...

------- Comment #9 From Benedikt Böhm 2007-09-10 20:23:38 0000 -------
oops :) fixed now

------- Comment #10 From Patrizio Bassi 2007-09-19 17:08:34 0000 -------
not really..

/usr/bin/libtool --silent --mode=link x86_64-pc-linux-gnu-gcc -o mod_python.la 
-rpath /usr/lib64/apache2/modules -module -avoid-version    finfoobject.lo
hlistobject.lo hlist.lo filterobject.lo connobject.lo serverobject.lo util.lo
tableobject.lo requestobject.lo _apachemodule.lo mod_python.lo -Wl,-O1
-Wl,--sort-common -Wl,--enable-new-dtags -Wl,--as-needed=both
-L/usr/lib64/python2.5/config -Xlinker -export-dynamic -Wl,-O1
-Wl,--sort-common -Wl,--enable-new-dtags -Wl,--as-needed -Wl,--hash-style -lm
-lpython2.5 -lpthread -ldl -lutil -lm
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../x86_64-pc-linux-gnu/bin/ld:
unrecognized option '--as-needed=both'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../x86_64-pc-linux-gnu/bin/ld:
use the --help option for usage information
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536

------- Comment #11 From Patrizio Bassi 2007-10-03 08:53:29 0000 -------
what's going on with the filter here?

------- Comment #12 From Jakub Moc (RETIRED) 2007-11-20 21:14:02 0000 -------
Nothing really; submit this upstream if you want it fixed.