Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 616108 - =media-libs/alsa-lib-1.1.3 fails to build with LTO -- error: undefined reference to 'snd_timer_params_set_filter'
Summary: =media-libs/alsa-lib-1.1.3 fails to build with LTO -- error: undefined refere...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo ALSA team
URL:
Whiteboard:
Keywords:
: 638550 640834 (view as bug list)
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2017-04-20 11:20 UTC by Petross404(Petros S)
Modified: 2022-07-17 15:24 UTC (History)
4 users (show)

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


Attachments
build.log (media-libs:alsa-lib-1.1.3:20170420-111439.log,148.45 KB, text/x-log)
2017-04-20 11:20 UTC, Petross404(Petros S)
Details
emerge --info (info,23.22 KB, text/plain)
2017-04-20 11:21 UTC, Petross404(Petros S)
Details
build.log-GCC7 (media-libs:alsa-lib-1.1.3:20170509-131527.log,141.47 KB, text/x-log)
2017-05-09 20:21 UTC, Petross404(Petros S)
Details
emerge --info GCC7 (emerge-info,24.71 KB, text/plain)
2017-05-09 20:22 UTC, Petross404(Petros S)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petross404(Petros S) 2017-04-20 11:20:45 UTC
Created attachment 470468 [details]
build.log

I emerging @system to use LTO and alsa-lib failed to build : 

/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccjqiOsd.lto.o
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccjqiOsd.lto.o:<artificial>:function snd1_pcm_direct_prepare: error: undefined reference to 'snd_timer_params_set_filter'
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccjqiOsd.lto.o:<artificial>:function snd_pcm_hw_sw_params: error: undefined reference to 'snd_timer_params_set_filter
....
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:490: libasound.la] Error 1
make[2]: Leaving directory '/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3-abi_x86_32.x86/src'
make[1]: *** [Makefile:544: all-recursive] Error 1
make[1]: Leaving directory '/tmp/portage/media-libs/alsa-lib-1.1.3/work/alsa-lib-1.1.3-abi_x86_32.x86/src'
make: *** [Makefile:402: all-recursive] Error 1
Comment 1 Petross404(Petros S) 2017-04-20 11:21:12 UTC
Created attachment 470470 [details]
emerge --info
Comment 2 Petross404(Petros S) 2017-05-09 20:20:49 UTC
I get a different error with GCC7.1 and LTO. Please let me know if I should open a new report.

...
[LTRANS] Size of mmap'd section hsa: 0 bytes
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Assembler messages:
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Error: invalid attempt to declare external version name as default in symbol `snd_pcm_forward@@ALSA_0.9.0rc8'
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Error: invalid attempt to declare external version name as default in symbol `snd_pcm_hw_params_get_access@@ALSA_0.9.0rc4'
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Error: invalid attempt to declare external version name as default in symbol `snd_pcm_hw_params_set_access_first@@ALSA_0.9.0rc4'
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Error: invalid attempt to declare external version name as default in symbol `snd_pcm_hw_params_get_format@@ALSA_0.9.0rc4'
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Error: invalid attempt to declare external version name as default in symbol `snd_pcm_hw_params_get_channels@@ALSA_0.9.0rc4'
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Error: invalid attempt to declare external version name as default in symbol `snd_pcm_hw_params_get_rate@@ALSA_0.9.0rc4'
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Error: invalid attempt to declare external version name as default in symbol `snd_pcm_hw_params_get_period_size@@ALSA_0.9.0rc4'
/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Error: invalid attempt to declare external version name as default in symbol `snd_pcm_hw_params_get_buffer_size@@ALSA_0.9.0rc4'
make[3]: *** [/tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccsn8ism.mk:2: /tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccSv3S5Q.ltrans0.ltrans.o] Error 1
....
Comment 3 Petross404(Petros S) 2017-05-09 20:21:43 UTC
Created attachment 472164 [details]
build.log-GCC7
Comment 4 Petross404(Petros S) 2017-05-09 20:22:35 UTC
Created attachment 472166 [details]
emerge --info GCC7
Comment 5 Petross404(Petros S) 2017-06-16 14:17:33 UTC
(In reply to Petross404(Petros S) from comment #2)
> I get a different error with GCC7.1 and LTO. Please let me know if I should
> open a new report.
> 
> ...
> /tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Assembler messages:
> /tmp/portage/media-libs/alsa-lib-1.1.3/temp/ccoOdbbh.s: Error: invalid
> attempt to declare external version name as default in symbol
> `snd_pcm_forward@@ALSA_0.9.0rc8'

After using -flto-partition=none, I eliminated the assembler error due to wrong partitioning [1] and the first linker error (undefined reference) re-appeared.

Before using -flto-partition=none, I even tried to append __attribute__((used)) infront of :

a) snd_timer_params_set_filter (alsa-lib-1.1.4.1/include/pcm.h)
b) snd_timer_params_set_filter (alsa-lib-1.1.4.1/include/timer.h)
but it wouldn't cut it; assembler continued to fail.

So, is disabling LTO's partitioning, the way to go for LTO'ed alsa-lib? Can someone confirm this?

[1]http://marxin.github.io/posts/gentoo-linux-packages-with-gcc-4-dot-9-lto/ 
(#Assembly usage)
Comment 6 Petross404(Petros S) 2017-06-16 14:20:47 UTC
(In reply to Petross404(Petros S) from comment #5)
> a) snd_timer_params_set_filter (alsa-lib-1.1.4.1/include/pcm.h)

I meant snd_pcm_hw_params_get_format.
Comment 7 n05ph3r42 2018-04-06 13:03:19 UTC
can confirm, 

emerge --info '=media-libs/alsa-lib-1.1.6-r1::gentoo' :
https://paste.pound-python.org/show/R4n2OlIRQ0Ze6tQmRoIe/

emerge -pqv '=media-libs/alsa-lib-1.1.6-r1::gentoo'
https://paste.pound-python.org/show/fNsOhcdyDrjaBHY9qdOA/

The complete build log :
https://paste.pound-python.org/show/ZLOvVylcFyy4WzlQOBuk/
Comment 8 n05ph3r42 2018-04-06 13:03:30 UTC
can confirm, 

emerge --info '=media-libs/alsa-lib-1.1.6-r1::gentoo' :
https://paste.pound-python.org/show/R4n2OlIRQ0Ze6tQmRoIe/

emerge -pqv '=media-libs/alsa-lib-1.1.6-r1::gentoo'
https://paste.pound-python.org/show/fNsOhcdyDrjaBHY9qdOA/

The complete build log :
https://paste.pound-python.org/show/ZLOvVylcFyy4WzlQOBuk/
Comment 9 Pacho Ramos gentoo-dev 2019-06-30 11:06:12 UTC
*** Bug 638550 has been marked as a duplicate of this bug. ***
Comment 10 Pacho Ramos gentoo-dev 2019-06-30 11:06:29 UTC
*** Bug 640834 has been marked as a duplicate of this bug. ***
Comment 11 unhappy-ending 2021-06-03 00:23:37 UTC
setting -flto-partition=one allows alsa-lib to be compiled with lto.
Comment 12 Larry the Git Cow gentoo-dev 2022-06-18 15:19:53 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31c929441087eb65c4cdcfc61b29acb3a50cb954

commit 31c929441087eb65c4cdcfc61b29acb3a50cb954
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-06-18 15:19:42 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-18 15:19:47 +0000

    media-libs/alsa-lib: filter LTO
    
    It's unsafe to use with alsa-lib (fails to build, can work with a hack, but that hack
    implies other issues).
    
    Closes: https://bugs.gentoo.org/616108
    Closes: https://bugs.gentoo.org/669086
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/alsa-lib/alsa-lib-1.2.7.1.ebuild | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 13 Larry the Git Cow gentoo-dev 2022-07-17 15:24:48 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b380de62b52d318e12857c54a3d99c9c21e3b165

commit b380de62b52d318e12857c54a3d99c9c21e3b165
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-07-17 15:06:41 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-07-17 15:06:54 +0000

    media-libs/alsa-lib: use new filter-lto
    
    Bug: https://bugs.gentoo.org/616108
    Bug: https://bugs.gentoo.org/669086
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/alsa-lib/alsa-lib-1.2.7.2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)