Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
libdl seems not linked when using ulibc ARM stage3
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
destroyedlolo
l33t
l33t


Joined: 17 Jun 2011
Posts: 846
Location: Close to Annecy (France)

PostPosted: Mon Sep 21, 2015 8:55 am    Post subject: libdl seems not linked when using ulibc ARM stage3 Reply with quote

Hello,

I'm installing Gentoo on a AllWinner A13 powered tablet.

I did 2 images, both containing the same packages. One using the standard "glibc" stage3-armv7a_hardfp image, another one using stage3-armv7a_hardfp-uclibc-vanilla.

I don't have any trouble with glibc one, but some packages are falling to build on uLibc one, because it seems dl library is not linked by default.

As example, Lua is falling with following error :
Code:
libtool --quiet --tag=CC --mode=link armv7a-hardfloat-linux-uclibceabi-gcc -export-dynamic -Wl,-O1 -Wl,--as-needed -o lua lua.lo liblua.la -lreadline
libtool --quiet --tag=CC --mode=link armv7a-hardfloat-linux-uclibceabi-gcc -static -export-dynamic -Wl,-O1 -Wl,--as-needed -o lua_test lua.lo liblua.la -lreadline
./.libs/liblua.so: undefined reference to `dlerror'
./.libs/liblua.so: undefined reference to `dlclose'
./.libs/liblua.so: undefined reference to `dlopen'
./.libs/liblua.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
Makefile:201: recipe for target 'lua' failed


Why this difference, and what is the correct way to correct this issue ?

Thanks

Laurent
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Thu Nov 26, 2015 6:29 pm    Post subject: Reply with quote

Quote:
I don't have any trouble with glibc one, but some packages are falling to build on uLibc one, because it seems dl library is not linked by default.

If your analysis is correct, then this is a bug in the upstream (build-system for the) software; though it can be worked-round by adding -ldl to LDFLAGS in the ebuild.
In general, what flag to use would be checked-for by the configure script, usually autoconf-generated.
Code:
<mira> µClibc can do libdl, not sure whether -ldl is required.

Your example, lua, has a very simple build-system, afair.

For a quick workaround, you would use package.env to add the value to LDFLAGS for whichever packages required it; then you would be in a position to report a bug for those, stating that adding -ldl to LDFLAGS fixes the issue at your end, so the maintainer can look at the specific build-system and feed a minor patch upstream.

So check if adding -ldl to LDFLAGS for lua works first:
/etc/portage/env/ldl.conf
Code:
LDFLAGS="$LDFLAGS -ldl"

/etc/portage/package.env
Code:
dev-lang/lua  ldl.conf


HTH,
steveL
Back to top
View user's profile Send private message
destroyedlolo
l33t
l33t


Joined: 17 Jun 2011
Posts: 846
Location: Close to Annecy (France)

PostPosted: Fri Nov 27, 2015 10:55 am    Post subject: Reply with quote

Hello,

I solved the issue by adding -ldl directly in make.conf

Quote:
If your analysis is correct, then this is a bug in the upstream (build-system for the) software; though it can be worked-round by adding -ldl to LDFLAGS in the ebuild.
In general, what flag to use would be checked-for by the configure script, usually autoconf-generated.

In this case, why it's working when I'm not using ulibc environment ?

Bye

Laurent
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Fri Nov 27, 2015 4:19 pm    Post subject: Reply with quote

steveL wrote:
If your analysis is correct, then this is a bug in the upstream (build-system for the) software; though it can be worked-round by adding -ldl to LDFLAGS in the ebuild.

destroyedlolo wrote:
I solved the issue by adding -ldl directly in make.conf

Cool.
Quote:
In general, what flag to use would be checked-for by the configure script, usually autoconf-generated.

Quote:
In this case, why it's working when I'm not using ulibc environment ?

Because it is not always needed, depending on the platform, which may not support dlsym at all; ergo it gets sorted out in configure.ac.

POSIX does not mandate -ldl, so strictly speaking it should not be required on a POSIX-compliant system. cf: man c99
So glibc provides it in libc, which is always searched, but may be specified early.

Nonetheless, that is precisely the role of a configure script: to establish what is supported, and whether eg: -ldl needs to be added, or not, or its functionality is unsupported.
Back to top
View user's profile Send private message
destroyedlolo
l33t
l33t


Joined: 17 Jun 2011
Posts: 846
Location: Close to Annecy (France)

PostPosted: Sat Nov 28, 2015 4:41 pm    Post subject: Reply with quote

Ok, thanks for your explanation.

Next time I'll update my tablet, I'll note failing packages and open ticket for them.

Bye

Laurent
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sun Nov 29, 2015 3:51 pm    Post subject: Reply with quote

destroyedlolo wrote:
Ok, thanks for your explanation.

Next time I'll update my tablet, I'll note failing packages and open ticket for them.

You're welcome :-)

That's all anyone could ask, so thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum