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

John Frankish john.frankish at outlook.com
Thu Jan 4 14:29:42 CET 2018


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


More information about the Alsa-devel mailing list