Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 236823 - media-sound/fluidsynth-1.0.8 won't cross-compile (libtool confused by presence of *.la files in SYSROOT)
Summary: media-sound/fluidsynth-1.0.8 won't cross-compile (libtool confused by presenc...
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Sound Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-05 23:21 UTC by Rupert Mazzucco
Modified: 2008-09-09 13:26 UTC (History)
1 user (show)

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


Attachments
/var/tmp/portage/media-sound/fluidsynth-1.0.8/temp/build.log (build.log,60.58 KB, text/plain)
2008-09-05 23:26 UTC, Rupert Mazzucco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rupert Mazzucco 2008-09-05 23:21:30 UTC
I'm following the steps in the Embedded Handbook to build a i486-pc-linux-uclibc system for audio on my main box. I had crossdev-0.9.18 create a toolchain and used it together with two tiny wrapper scripts to emerge a uclibc/busybox based system which boots fine and has working ALSA support. The attempt to emerge fluidsynth fails at the link stage. (Cross-build works if ALSA is disabled, native build works fine.) 

Reproducible: Always

Steps to Reproduce:
0. The setup is like this:

> export SYSROOT=/usr/i486-pc-linux-uclibc
> export PKG_CONFIG=/root/i486-pc-linux-uclibc-pkg-config
> cat ./xmerge
#! /bin/sh

export ac_cv_func_calloc_0_nonnull=yes   # skip some tests where uclibc results
export ac_cv_func_malloc_0_nonnull=yes   # might confuse configure
export gl_cv_func_malloc_0_nonnull=yes
export ac_cv_func_realloc_0_nonnull=yes
export ac_cv_func_memcmp_working=yes
export ac_cv_func_strnlen_working=yes

export CBUILD=$(portageq envvar CHOST)
export PORTAGE_CONFIGROOT=${SYSROOT}
if [ "$1" = "--root" ] ; then
        export ROOT=$2
        shift 2
else
        export ROOT=${SYSROOT}
fi
exec emerge "$@"
> cat /root/i486-pc-linux-uclibc-pkg-config
#! /bin/sh
export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/pkgconfig"
unset PKG_CONFIG_PATH PKG_CONFIG_ALLOW_SYSTEM_CFLAGS PKG_CONFIG_ALLOW_SYSTEM_LIBS
exec pkg-config "$@"

> ./xmerge --search alsa-lib
Searching...   
[ Results for search key : alsa-lib ]
[ Applications found : 1 ]
 
*  media-libs/alsa-lib
      Latest version available: 1.0.16-r1
      Latest version installed: 1.0.16-r1
      ...

1. > ./xmerge fluidsynth
 
2. Wait for offending command:
...
i486-pc-linux-uclibc-gcc -march=c3 -mmmx -m3dnow -O3 -fomit-frame-pointer -ffast-math -DNDEBUG -pipe -Wall -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused -Winline -Wl,-O1 -o .libs/fluidsynth fluidsynth-fluidsynth.o  ./.libs/libfluidsynth.so -lpthread 
./.libs/libfluidsynth.so: undefined reference to `snd_pcm_sw_params_sizeof@ALSA_0.9'
./.libs/libfluidsynth.so: undefined reference to `snd_seq_poll_descriptors@ALSA_0.9'
./.libs/libfluidsynth.so: undefined reference to `snd_seq_port_info_set_type@ALSA_0.9'
./.libs/libfluidsynth.so: undefined reference to `snd_pcm_wait@ALSA_0.9'
...
(and many more symbols from libasound)


Actual Results:  
* ERROR: media-sound/fluidsynth-1.0.8 failed.


Expected Results:  
>>> media-sound/fluidsynth-1.0.8 merged.

>>> Using system located in ROOT tree /usr/i486-pc-linux-uclibc/


> ./xmerge --info
Portage 2.1.4.4 (uclibc/x86, gcc-4.2.4, unavailable, 2.6.23-gentoo-r9 i686)
=================================================================
System uname: 2.6.23-gentoo-r9 i686 Intel(R) Core(TM)2 CPU 6420 @ 2.13GHz
Timestamp of tree: Fri, 05 Sep 2008 20:18:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r2
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=c3 -mmmx -m3dnow -O3 -fomit-frame-pointer -ffast-math -DNDEBUG -pipe"
CHOST="i486-pc-linux-uclibc"
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/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=c3 -mmmx -m3dnow -O3 -fomit-frame-pointer -ffast-math -DNDEBUG -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks metadata-transfer nodoc noinfo noman sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gd.tuwien.ac.at/opsys/linux/gentoo/ "
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LDFLAGS="-Wl,-O1"
LINGUAS="de en"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow alsa bluetooth cli cracklib crypt dri ieee1394 jack midi mmap mmx mmxext mudflap ncurses openmp pcre posix readline reflection rtc session sharedmem spl ssl sysfs syslog tcpd threads uclibc unix98 usb x86 xorg zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="uclibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de en" USERLAND="GNU" VIDEO_CARDS="via"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Rupert Mazzucco 2008-09-05 23:26:06 UTC
Created attachment 164664 [details]
/var/tmp/portage/media-sound/fluidsynth-1.0.8/temp/build.log
Comment 2 Alexis Ballier gentoo-dev 2008-09-07 20:13:13 UTC
/bin/sh ../libtool --tag=CC   --mode=link i486-pc-linux-uclibc-gcc  -march=c3 -mmmx -m3dnow -O3 -fomit-frame-pointer -ffast-math -DNDEBUG -pipe -Wall  -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused -Winline -version-info 2:2:1 -export-dynamic  -Wl,-O1 -o libfluidsynth.la -rpath /usr/lib libfluidsynth_la-fluid_alsa.lo  libfluidsynth_la-fluid_jack.lo    libfluidsynth_la-fluid_adriver.lo libfluidsynth_la-fluid_chan.lo libfluidsynth_la-fluid_chorus.lo libfluidsynth_la-fluid_cmd.lo libfluidsynth_la-fluid_conv.lo libfluidsynth_la-fluid_defsfont.lo libfluidsynth_la-fluid_dsp_float.lo libfluidsynth_la-fluid_event.lo libfluidsynth_la-fluid_gen.lo libfluidsynth_la-fluid_hash.lo libfluidsynth_la-fluid_io.lo libfluidsynth_la-fluid_ladspa.lo libfluidsynth_la-fluid_list.lo libfluidsynth_la-fluid_mdriver.lo libfluidsynth_la-fluid_midi.lo libfluidsynth_la-fluid_midi_router.lo libfluidsynth_la-fluid_midishare.lo libfluidsynth_la-fluid_mod.lo libfluidsynth_la-fluid_ramsfont.lo libfluidsynth_la-fluid_rev.lo libfluidsynth_la-fluid_seqbind.lo libfluidsynth_la-fluid_seq.lo libfluidsynth_la-fluid_settings.lo libfluidsynth_la-fluid_synth.lo libfluidsynth_la-fluid_sys.lo libfluidsynth_la-fluid_tuning.lo libfluidsynth_la-fluid_voice.lo libfluidsynth_la-fluid_aufile.lo -lm   -lreadline -lncurses  -ljack -lpthread   -lasound   -lpthread 
i486-pc-linux-uclibc-gcc -shared  .libs/libfluidsynth_la-fluid_alsa.o .libs/libfluidsynth_la-fluid_jack.o .libs/libfluidsynth_la-fluid_adriver.o .libs/libfluidsynth_la-fluid_chan.o .libs/libfluidsynth_la-fluid_chorus.o .libs/libfluidsynth_la-fluid_cmd.o .libs/libfluidsynth_la-fluid_conv.o .libs/libfluidsynth_la-fluid_defsfont.o .libs/libfluidsynth_la-fluid_dsp_float.o .libs/libfluidsynth_la-fluid_event.o .libs/libfluidsynth_la-fluid_gen.o .libs/libfluidsynth_la-fluid_hash.o .libs/libfluidsynth_la-fluid_io.o .libs/libfluidsynth_la-fluid_ladspa.o .libs/libfluidsynth_la-fluid_list.o .libs/libfluidsynth_la-fluid_mdriver.o .libs/libfluidsynth_la-fluid_midi.o .libs/libfluidsynth_la-fluid_midi_router.o .libs/libfluidsynth_la-fluid_midishare.o .libs/libfluidsynth_la-fluid_mod.o .libs/libfluidsynth_la-fluid_ramsfont.o .libs/libfluidsynth_la-fluid_rev.o .libs/libfluidsynth_la-fluid_seqbind.o .libs/libfluidsynth_la-fluid_seq.o .libs/libfluidsynth_la-fluid_settings.o .libs/libfluidsynth_la-fluid_synth.o .libs/libfluidsynth_la-fluid_sys.o .libs/libfluidsynth_la-fluid_tuning.o .libs/libfluidsynth_la-fluid_voice.o .libs/libfluidsynth_la-fluid_aufile.o  -lm -lreadline -lncurses /usr/lib/libjack.so /usr/lib/libasound.so -lpthread  -march=c3 -mmmx -m3dnow -Wl,-O1 -Wl,-soname -Wl,libfluidsynth.so.1 -o .libs/libfluidsynth.so.1.1.2


These are libfluidynth link lines. I see no -L/prefix or something. Also your setup doesn't seem exactly the same as the one in '5.e. Helper: pkg-config' of the handbook, and fluidsynth uses pkgconfig to discover alsa libs. Here it seems to link to your system libs instead.

@embedded/solar: why removing yourself from cc there? this *really* seems more a misconfiguration than an ebuild/build system problem.
Comment 3 Rupert Mazzucco 2008-09-07 20:58:50 UTC
> ...
> -lreadline -lncurses /usr/lib/libjack.so /usr/lib/libasound.so -lpthread 

I should have noticed that yesterday, but I think that might the problem right there. There should be "-ljack -lasound", but for some reason it has a hardcoded path to the system libs. Where does that come from?  PKG_CONFIG says "-ljack -lpthread" and "-lasound".

> I see no -L/prefix or something. Also your

No need, crossdev builds the cross compiler/linker with --with-sysroot, so it knows where to find the libraries:

$ i486-pc-linux-uclibc-gcc -v
Using built-in specs.
Target: i486-pc-linux-uclibc
Configured with: ... --with-sysroot=/usr/i486-pc-linux-uclibc --disable-bootstrap --disable-libgomp --disable-__cxa_atexit --enable-target-optspace --enable-clocale=uclibc
Thread model: posix
gcc version 4.2.4 (Gentoo 4.2.4 p1.0)

> setup doesn't seem exactly the same as the one in '5.e. Helper: pkg-config' of
> the handbook, and fluidsynth uses pkgconfig to discover alsa libs.

No, I modified it a bit to work around some other problem with some other package I can't remember right now, but here it does the same thing as long as SYSROOT is also the prefix of *-pkg-config, as in my case. And it wouldn't matter anyway because also the system alsa.pc tells to use -lasound. 

$ pkg-config --libs alsa
-lasound  
$ /root/i486-pc-linux-uclibc-pkg-config --libs alsa
-lasound  

I have a hunch that pkgconfig output is not really used to make up the one line above, although it should.
Comment 4 Alexis Ballier gentoo-dev 2008-09-07 21:16:34 UTC
(In reply to comment #3)
> > ...
> > -lreadline -lncurses /usr/lib/libjack.so /usr/lib/libasound.so -lpthread 
> 
> I should have noticed that yesterday, but I think that might the problem right
> there. There should be "-ljack -lasound", but for some reason it has a
> hardcoded path to the system libs. Where does that come from?  PKG_CONFIG says
> "-ljack -lpthread" and "-lasound".

libtool tends to expand the -lfoo to what it thinks better when there is libfoo.la afaik
Comment 5 Rupert Mazzucco 2008-09-07 21:25:14 UTC
(In reply to comment #4)

> libtool tends to expand the -lfoo to what it thinks better when there is
> libfoo.la afaik

I'm sorry, it turns out you are right. Went back and tried with the original *-pkg-config as per the embedded handbook and it works. So apparently ebuild unsets SYSROOT somewhere along the way, then the wrong pkg-config gets called, and then libtool looks at /usr/lib/libasound.la and decides to put in the full path because this is now a non-standard path for *-ld. Got it. (Have to figure out now what this other package was and what went wrong there.) Thanks for your help and time.

Comment 6 Rupert Mazzucco 2008-09-07 21:59:36 UTC
(In reply to comment #5)
> and it works.

Well, kind of. It didn't find ALSA and JACK anymore and compiled without. But now I found the root problem and this can actually be seen as a minor bug in the Embedded Handbook, section 5.e.: "... so in those cases you will need to export the PKG_CONFIG variable to the wrapper script." If PKG_CONFIG is set to some path, however - as I do - then the script in listing 5.1 won't work as advertised because CTARGET=${0%-pkg-config} still contains the full path, and SYSROOT will be invalid and things go down from there. THis is a bit annoying as it will just silently not find things and build without support for components you thought you had installed. 

Needs something like
SCRIPTNAME=$(basename $0)
CTARGET=${SCRIPTNAME%-pkg-config}
...

I reopen this bug with severity "trivial" and suggest to reassign it to the Embedded people. Maybe someone wants to make this script idiot-proof.
Comment 7 Alexis Ballier gentoo-dev 2008-09-07 22:21:40 UTC
(In reply to comment #6)

> I reopen this bug with severity "trivial" and suggest to reassign it to the
> Embedded people. Maybe someone wants to make this script idiot-proof.



maybe you want to rename the bug summary to something that matches this then ;)
Comment 8 Rupert Mazzucco 2008-09-07 22:24:36 UTC
Arrgh!  Now it doesn't build anymore, same problem as above, back to base one.  It is just wrong to use the path from libasound.la, because the tree is not installed in its final location yet. It needs to use -lasound and -ljack and rely on the linker to figure out where to find the libraries. I hate libtool. Wasn't this thing supposed to SOLVE linking problems?

Or, if libtool is right, then this whole approach of the Embedded Handbook,

> 5.b. Filesystem Setup
>
> Cross-compiling a system generally involves two directory trees. The first is > where all development files are normally installed. This is your sysroot. The > other tree is where only your runtime files are installed. You emerge all of 
> your fun packages into your sysroot (without trimming down any files), and 
> then either install via binary packages or copying files by hand all the stuff > you need in your runtime tree. 

doesn't work.
Comment 9 Rupert Mazzucco 2008-09-08 19:01:36 UTC
(In reply to comment #3)
> > ...
> > -lreadline -lncurses /usr/lib/libjack.so /usr/lib/libasound.so -lpthread 
> 
> I should have noticed that yesterday, but I think that might the problem right
> there. There should be "-ljack -lasound",

Just to confirm that if I issue this command manually with the paths replaced by -lasound -ljack, the build continues just fine and produces a fluidsynth binary which appears to be linked correctly.
Comment 10 Rupert Mazzucco 2008-09-08 19:29:08 UTC
Thus a temporary workaround: Remove lib{asound,jack}.la from $ROOT/usr/lib prior to building. I'm leaving this open because I don't think this is a real fix. There appears to be something fundamentally wrong with the Embedded Handbook idea of emerging stuff into a ROOT directory and then using this ROOT as a SYSROOT for future builds; because the *.la files will be off unless $ROOT="/". Although it seems to work surprisingly well in many cases.
Comment 11 solar (RETIRED) gentoo-dev 2008-09-08 21:17:09 UTC
this really should not be assigned to embedded@. But...

Rupert,

Chances are newer versions of crossdev will include pkg-config wrappers which 
fix up the *.la files in ROOT. You will find the same problems in many of 
packages.
Comment 12 Alexis Ballier gentoo-dev 2008-09-09 13:26:49 UTC
(In reply to comment #11)
> this really should not be assigned to embedded@. But...

and even less to sound@ ...

> Chances are newer versions of crossdev will include pkg-config wrappers which 
> fix up the *.la files in ROOT. You will find the same problems in many of 
> packages.

Then what's the point of re-assigning this back to sound ?

As I have better things to do than playing the reassigning game forever, I'm closing as cantfix then, fluidsynth does not seem at fault here -> nothing I can do.

Rupert, if you want this fixed, please file a new bug asking for .la files fixups when compiling under SYSROOT/ROOT.