[alsa-devel] Compiling alsa-lib fails with lto

Takashi Iwai tiwai at suse.de
Thu Jan 4 15:41:29 CET 2018


On Thu, 04 Jan 2018 14:29:42 +0100,
John Frankish wrote:
> 
> Using gcc-7.2.0 and alsa-lib-1.1.5
> 
> Is there a way to compile alsa-lib with lto (the method below works with alsa-plugins and alsa-utils)?
> 
> Compiling alsa-lib like this works fine:
> 
> CC="gcc -mtune=generic -Os -pipe" CXX="g++ -mtune=generic -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --disable-static --localstatedir=/var --with-configdir=/usr/local/etc/alsa
> 
> ..but compiling with lto like this fails as per below:
> 
> CC=" gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe" CXX="g++ -flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --disable-static --localstatedir=/var --with-configdir=/usr/local/etc/alsa
> 
> libtool: link: gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe -o .libs/aserver aserver.o  ../src/.libs/libasound.so -lm -ldl -lpthread -lrt
> /tmp/ccoTf6DH.ltrans0.ltrans.o: In function `pcm_shm_cmd':
> <artificial>:(.text+0xe7a): undefined reference to `snd_pcm_forward'
> ../src/.libs/libasound.so: undefined reference to `snd_timer_params_set_filter'
> ../src/.libs/libasound.so: undefined reference to `snd_ctl_elem_info_get_dimension'
> ../src/.libs/libasound.so: undefined reference to `snd_ctl_elem_info_get_dimensions'
> collect2: error: ld returned 1 exit status
> make[1]: *** [Makefile:333: aserver] Error 1
> make[1]: Leaving directory '/usr/src/alsa-lib-1.1.5/aserver'
> make: *** [Makefile:338: all-recursive] Error 1
> Command exited with non-zero status 2

That's interesting.  These are basically fallouts of the internal
function calls, and they should have been called with INTERNAL()
wrapper for covering the versioned symbols.

I fixed the latest git tree, but still something doesn't work with
linkage in aserver.  I guess Makefile.am in aserver needs to be fixed
somehow, but I leave it as is for now, as you can work around it by
disabling via the configure option.


thanks,

Takashi


More information about the Alsa-devel mailing list