All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/alsa-lib: build with versioned symbols
@ 2020-05-15 18:33 Joseph Kogut
  2020-05-15 19:46 ` Thomas Petazzoni
  2020-05-18  5:11 ` [Buildroot] [PATCH v2 1/1] package/alsa-lib: disable versioned symbols only when unsupported Joseph Kogut
  0 siblings, 2 replies; 4+ messages in thread
From: Joseph Kogut @ 2020-05-15 18:33 UTC (permalink / raw)
  To: buildroot

Some libraries such as CEF depend on versioned symbols from alsa-lib,
and the build fails during linking with versioning disabled.

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
CEF is linked to versioned symbols defined by libasound.

$ readelf -Ws libcef.so | grep snd_mixer_selem_id_set_index
  260: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND snd_mixer_selem_id_set_index at ALSA_0.9 (8)

Buildroot's alsa-lib package is currently configured with
--without-versiond, which disables symbol versioning.

$ readelf output/target/usr/lib/libasound.so | grep snd_mixer_selem_id_set_index
  1332: 0000000000052b0c    56 FUNC    GLOBAL DEFAULT   11 snd_mixer_selem_id_set_index

Building alsa-lib with unversioned symbols results in unresolved symbols
during linking.

   <snip>/output/host/bin/aarch64-linux-gcc -o subprocess subprocess.o  -L<snip>/output/target/usr/lib/ -lcef -lX11 -lpython3.8 -lcrypt -lpthread -ldl  -lpthread -lutil -lm -Xlinker -export-dynamic
    <snip>/output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-buildroot-linux-gnu/9.3.0/../../../../aarch64-buildroot-linux-gnu/bin/ld: <snip>/output/target/usr/lib/libcef.so: undefined reference to `snd_mixer_selem_id_set_index at ALSA_0.9'

Configuring alsa-lib without the --without-versioned flag fixes this
issue.

$ readelf -Ws buildroot/output/target/usr/lib/libasound.so | grep snd_mixer_selem_id_set_index
  1173: 000000000004be18    56 FUNC    GLOBAL DEFAULT   12 snd_mixer_selem_id_set_index@@ALSA_0.9

Is there a reason to leave --without-versioned in the package, or make
it an optional config? I can't imagine the size difference is all that
great.

 package/alsa-lib/alsa-lib.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/alsa-lib/alsa-lib.mk b/package/alsa-lib/alsa-lib.mk
index 1855eb3d08..1f1d95c177 100644
--- a/package/alsa-lib/alsa-lib.mk
+++ b/package/alsa-lib/alsa-lib.mk
@@ -15,8 +15,7 @@ ALSA_LIB_AUTORECONF = YES
 ALSA_LIB_CONF_OPTS = \
 	--with-alsa-devdir=$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_DEVDIR)) \
 	--with-pcm-plugins="$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_PCM_PLUGINS))" \
-	--with-ctl-plugins="$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_CTL_PLUGINS))" \
-	--without-versioned
+	--with-ctl-plugins="$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_CTL_PLUGINS))"
 
 # Can't build with static & shared at the same time (1.0.25+)
 ifeq ($(BR2_STATIC_LIBS),y)
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 1/1] package/alsa-lib: build with versioned symbols
  2020-05-15 18:33 [Buildroot] [PATCH 1/1] package/alsa-lib: build with versioned symbols Joseph Kogut
@ 2020-05-15 19:46 ` Thomas Petazzoni
  2020-05-18  5:11 ` [Buildroot] [PATCH v2 1/1] package/alsa-lib: disable versioned symbols only when unsupported Joseph Kogut
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2020-05-15 19:46 UTC (permalink / raw)
  To: buildroot

Hello,

+Max Filippov

On Fri, 15 May 2020 11:33:53 -0700
Joseph Kogut <joseph.kogut@gmail.com> wrote:

> Is there a reason to leave --without-versioned in the package, or make
> it an optional config? I can't imagine the size difference is all that
> great.

This --without-versioned was added in commit
e90a4bf4af3b6466b2a2d8df12cfe84f5d364cca back in February 2009 (wow, 11
years ago). This commit, from Peter Korsgaard, says:

commit e90a4bf4af3b6466b2a2d8df12cfe84f5d364cca
Author: Peter Korsgaard <jacmet@sunsite.dk>
Date:   Mon Feb 23 13:01:26 2009 +0000

    alsa-lib: don't use versioned symbols
    
    As reported by Dirk Vermaak and Daniel Mack. Fixes runtime issues with
    alsa-lib, see
    http://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/014999.html
    for details.

The mailing list thread pointed by this link contains an interesting
explanation:
https://mailman.alsa-project.org/pipermail/alsa-devel/2009-February/015031.html,
i.e it wasn't working with uClibc because uClibc doesn't support
versioned symbols.

Interestingly, in 2015, the fact that uClibc doesn't support versioned
symbol also caused some issue with elfutils, as was reported by Max
Filippov at:

https://lists.fedorahosted.org/archives/list/elfutils-devel at lists.fedorahosted.org/thread/XIK5GQRWKOMOZ4FVBRWTPOH57DUYFNZV/

So it seems like this problem still exists.

Also, in 2017, Alexey Brokdin also reminded about this in his talk on
uClibc, see
https://elinux.org/images/9/9f/Uclibc-still-makes-sense-brodkin-elce2017_0.pdf

So, we unfortunately can't apply your patch as-is. Perhaps we should
make that conditional on uClibc ? Indeed, I assume that CEF will never
work with uClibc anyway :-)

I am puzzled though: if alsa-lib is built without symbol versioning,
how can CEF "know" about such versioning ? It is hardcoded into the CEF
source code ?

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2 1/1] package/alsa-lib: disable versioned symbols only when unsupported
  2020-05-15 18:33 [Buildroot] [PATCH 1/1] package/alsa-lib: build with versioned symbols Joseph Kogut
  2020-05-15 19:46 ` Thomas Petazzoni
@ 2020-05-18  5:11 ` Joseph Kogut
  2022-01-08 10:04   ` Thomas Petazzoni
  1 sibling, 1 reply; 4+ messages in thread
From: Joseph Kogut @ 2020-05-18  5:11 UTC (permalink / raw)
  To: buildroot

Some libraries such as CEF depend on versioned symbols from alsa-lib,
and the build fails during linking with versioning disabled.

Symbol versioning was originally disabled because some C libraries, such
as uClibc, don't support versioned symbols.

This patch conditionally disables versioned symbols when unsupported by
the toolchain, leaving them enabled otherwise.

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
 package/alsa-lib/alsa-lib.mk | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/package/alsa-lib/alsa-lib.mk b/package/alsa-lib/alsa-lib.mk
index 1855eb3d08..b718b1eb68 100644
--- a/package/alsa-lib/alsa-lib.mk
+++ b/package/alsa-lib/alsa-lib.mk
@@ -15,8 +15,11 @@ ALSA_LIB_AUTORECONF = YES
 ALSA_LIB_CONF_OPTS = \
 	--with-alsa-devdir=$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_DEVDIR)) \
 	--with-pcm-plugins="$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_PCM_PLUGINS))" \
-	--with-ctl-plugins="$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_CTL_PLUGINS))" \
-	--without-versioned
+	--with-ctl-plugins="$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_CTL_PLUGINS))"
+
+ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
+ALSA_LIB_CONF_OPTS += --without-versioned
+endif
 
 # Can't build with static & shared at the same time (1.0.25+)
 ifeq ($(BR2_STATIC_LIBS),y)
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH v2 1/1] package/alsa-lib: disable versioned symbols only when unsupported
  2020-05-18  5:11 ` [Buildroot] [PATCH v2 1/1] package/alsa-lib: disable versioned symbols only when unsupported Joseph Kogut
@ 2022-01-08 10:04   ` Thomas Petazzoni
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2022-01-08 10:04 UTC (permalink / raw)
  To: Joseph Kogut; +Cc: Bernd Kuhls, buildroot

Hello Joseph,

On Sun, 17 May 2020 22:11:12 -0700
Joseph Kogut <joseph.kogut@gmail.com> wrote:

> Some libraries such as CEF depend on versioned symbols from alsa-lib,
> and the build fails during linking with versioning disabled.
> 
> Symbol versioning was originally disabled because some C libraries, such
> as uClibc, don't support versioned symbols.
> 
> This patch conditionally disables versioned symbols when unsupported by
> the toolchain, leaving them enabled otherwise.
> 
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> ---
>  package/alsa-lib/alsa-lib.mk | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Sorry for the delay. I have applied with a much more detailed commit
log, and also after enabling versioned symbols only with glibc
toolchains, as musl only has partial support for symbol versioning.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-08 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15 18:33 [Buildroot] [PATCH 1/1] package/alsa-lib: build with versioned symbols Joseph Kogut
2020-05-15 19:46 ` Thomas Petazzoni
2020-05-18  5:11 ` [Buildroot] [PATCH v2 1/1] package/alsa-lib: disable versioned symbols only when unsupported Joseph Kogut
2022-01-08 10:04   ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.