* [Buildroot] [PATCH] berkeleydb: fix static linking issues
@ 2016-12-04 17:39 Waldemar Brodkorb
2016-12-04 20:56 ` Thomas Petazzoni
0 siblings, 1 reply; 5+ messages in thread
From: Waldemar Brodkorb @ 2016-12-04 17:39 UTC (permalink / raw)
To: buildroot
Libtool by default drops -static, so force libtool with -all-static
to do static linking.
Fixes:
http://autobuild.buildroot.net/results/f0a96f671644d9f9efcf245b354affdc84f7d7da
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
package/berkeleydb/berkeleydb.mk | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/package/berkeleydb/berkeleydb.mk b/package/berkeleydb/berkeleydb.mk
index e5c11bd..d09bece 100644
--- a/package/berkeleydb/berkeleydb.mk
+++ b/package/berkeleydb/berkeleydb.mk
@@ -44,6 +44,10 @@ define BERKELEYDB_CONFIGURE_CMDS
)
endef
+ifeq ($(BR2_STATIC_LIBS),y)
+BERKELEYDB_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -all-static"
+endif
+
ifneq ($(BR2_PACKAGE_BERKELEYDB_TOOLS),y)
define BERKELEYDB_REMOVE_TOOLS
@@ -60,4 +64,8 @@ endef
BERKELEYDB_POST_INSTALL_TARGET_HOOKS += BERKELEYDB_REMOVE_DOCS
+define BERKELEYDB_BUILD_CMDS
+ $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_ARGS) $(MAKE) $(BERKELEYDB_CONF_ENV) -C $(@D)/build_unix
+endef
+
$(eval $(autotools-package))
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] berkeleydb: fix static linking issues
2016-12-04 17:39 [Buildroot] [PATCH] berkeleydb: fix static linking issues Waldemar Brodkorb
@ 2016-12-04 20:56 ` Thomas Petazzoni
2016-12-05 3:46 ` Waldemar Brodkorb
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2016-12-04 20:56 UTC (permalink / raw)
To: buildroot
Hello,
On Sun, 4 Dec 2016 18:39:24 +0100, Waldemar Brodkorb wrote:
> Libtool by default drops -static, so force libtool with -all-static
> to do static linking.
This needs a little bit more details, because libtool is used by a
large fraction of our packages, we pass -static only, and it just works.
Why do we have a different situation here? I thought this undefined
reference to `dl_iterate_phdr' issue was more a toolchain problem.
It's affecting a number of different packages, and is apparently a new
problem, so a fix at the package level looks a bit odd.
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] berkeleydb: fix static linking issues
2016-12-04 20:56 ` Thomas Petazzoni
@ 2016-12-05 3:46 ` Waldemar Brodkorb
2016-12-05 18:22 ` Arnout Vandecappelle
0 siblings, 1 reply; 5+ messages in thread
From: Waldemar Brodkorb @ 2016-12-05 3:46 UTC (permalink / raw)
To: buildroot
Hi Thomas,
Thomas Petazzoni wrote,
> Hello,
>
> On Sun, 4 Dec 2016 18:39:24 +0100, Waldemar Brodkorb wrote:
> > Libtool by default drops -static, so force libtool with -all-static
> > to do static linking.
>
> This needs a little bit more details, because libtool is used by a
> large fraction of our packages, we pass -static only, and it just works.
>
> Why do we have a different situation here? I thought this undefined
> reference to `dl_iterate_phdr' issue was more a toolchain problem.
It is not a toolchain problem, it is more likely a change in
toolchain behaviour with uClibc-ng >= 1.0.18.
We can not avoid the circular dependency between libc and libgcc, so
every static compiled package must use -static while linking.
> It's affecting a number of different packages, and is apparently a new
> problem, so a fix at the package level looks a bit odd.
In this case it is similar to autossh a package level problem.
All the libtool packages are working out-of-the box in buildroot with
-static, because LIBTOOL_PATCH_HOOK patches libtool to behave like
-all-static.
In this case the hook isn't working correctly, because ltmain.sh
isn't found:
ESC[3m>>> berkeleydb 5.3.28 Patching libtoolESC[23m
for i in `find /home/wbx/buildroot/output/build/berkeleydb-5.3.28/build_unix -name
ltmain.sh`; do ltmain_version=`sed -n '/^[ \t]*VERSION=/{s/^[
\t]*VERSION=//;p;q;}' $i | sed -e 's/\([0-9]*\.[0-9]*\).*/\1/' -e
's/\"//'`; ltmain_patchlevel=`sed -n '/^[ \t]*VERSION=/{s/^[
\t]*VERSION=//;p;q;}' $i | sed -e
's/\([0-9]*\.[0-9]*\.*\)\([0-9]*\).*/\2/' -e 's/\"//'`; if test
${ltmain_version} = '1.5'; then patch -i
support/libtool/buildroot-libtool-v1.5.patch ${i}; elif test
${ltmain_version} = "2.2"; then patch -i
support/libtool/buildroot-libtool-v2.2.patch ${i}; elif test
${ltmain_version} = "2.4"; then if test ${ltmain_patchlevel:-0} -gt
2; then patch -i support/libtool/buildroot-libtool-v2.4.4.patch
${i}; else patch -i support/libtool/buildroot-libtool-v2.4.patch
${i}; fi fi done
touch
wbx at helium:~/buildroot $ find /home/wbx/buildroot/output/build/berkeleydb-5.3.28/ -name ltmain.sh
/home/wbx/buildroot/output/build/berkeleydb-5.3.28/dist/ltmain.sh
/home/wbx/buildroot/output/build/berkeleydb-5.3.28/lang/sql/jdbc/ltmain.sh
/home/wbx/buildroot/output/build/berkeleydb-5.3.28/lang/sql/odbc/ltmain.sh
/home/wbx/buildroot/output/build/berkeleydb-5.3.28/lang/sql/sqlite/ltmain.sh
The hook searches in
/home/wbx/buildroot/output/build/berkeleydb-5.3.28/build_unix, but
it seems berkeley db provides ltmain.sh in
/home/wbx/buildroot/output/build/berkeleydb-5.3.28/dist/.
best regards
Waldemar
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] berkeleydb: fix static linking issues
2016-12-05 3:46 ` Waldemar Brodkorb
@ 2016-12-05 18:22 ` Arnout Vandecappelle
2016-12-05 21:21 ` Thomas Petazzoni
0 siblings, 1 reply; 5+ messages in thread
From: Arnout Vandecappelle @ 2016-12-05 18:22 UTC (permalink / raw)
To: buildroot
On 05-12-16 04:46, Waldemar Brodkorb wrote:
> Hi Thomas,
> Thomas Petazzoni wrote,
>
>> Hello,
>>
>> On Sun, 4 Dec 2016 18:39:24 +0100, Waldemar Brodkorb wrote:
>>> Libtool by default drops -static, so force libtool with -all-static
>>> to do static linking.
>>
>> This needs a little bit more details, because libtool is used by a
>> large fraction of our packages, we pass -static only, and it just works.
>>
>> Why do we have a different situation here? I thought this undefined
>> reference to `dl_iterate_phdr' issue was more a toolchain problem.
>
> It is not a toolchain problem, it is more likely a change in
> toolchain behaviour with uClibc-ng >= 1.0.18.
> We can not avoid the circular dependency between libc and libgcc, so
> every static compiled package must use -static while linking.
Perhaps add -static in the toolchain wrapper? Which might make it possible to
remove it from the libtool patch as well.
>> It's affecting a number of different packages, and is apparently a new
>> problem, so a fix at the package level looks a bit odd.
>
> In this case it is similar to autossh a package level problem.
>
> All the libtool packages are working out-of-the box in buildroot with
> -static, because LIBTOOL_PATCH_HOOK patches libtool to behave like
> -all-static.
>
> In this case the hook isn't working correctly, because ltmain.sh
> isn't found:
>
> ESC[3m>>> berkeleydb 5.3.28 Patching libtoolESC[23m
> for i in `find /home/wbx/buildroot/output/build/berkeleydb-5.3.28/build_unix -name
> ltmain.sh`; do ltmain_version=`sed -n '/^[ \t]*VERSION=/{s/^[
> \t]*VERSION=//;p;q;}' $i | sed -e 's/\([0-9]*\.[0-9]*\).*/\1/' -e
> 's/\"//'`; ltmain_patchlevel=`sed -n '/^[ \t]*VERSION=/{s/^[
> \t]*VERSION=//;p;q;}' $i | sed -e
> 's/\([0-9]*\.[0-9]*\.*\)\([0-9]*\).*/\2/' -e 's/\"//'`; if test
> ${ltmain_version} = '1.5'; then patch -i
> support/libtool/buildroot-libtool-v1.5.patch ${i}; elif test
> ${ltmain_version} = "2.2"; then patch -i
> support/libtool/buildroot-libtool-v2.2.patch ${i}; elif test
> ${ltmain_version} = "2.4"; then if test ${ltmain_patchlevel:-0} -gt
> 2; then patch -i support/libtool/buildroot-libtool-v2.4.4.patch
> ${i}; else patch -i support/libtool/buildroot-libtool-v2.4.patch
> ${i}; fi fi done
> touch
>
> wbx at helium:~/buildroot $ find /home/wbx/buildroot/output/build/berkeleydb-5.3.28/ -name ltmain.sh
> /home/wbx/buildroot/output/build/berkeleydb-5.3.28/dist/ltmain.sh
> /home/wbx/buildroot/output/build/berkeleydb-5.3.28/lang/sql/jdbc/ltmain.sh
> /home/wbx/buildroot/output/build/berkeleydb-5.3.28/lang/sql/odbc/ltmain.sh
> /home/wbx/buildroot/output/build/berkeleydb-5.3.28/lang/sql/sqlite/ltmain.sh
>
> The hook searches in
> /home/wbx/buildroot/output/build/berkeleydb-5.3.28/build_unix, but
> it seems berkeley db provides ltmain.sh in
> /home/wbx/buildroot/output/build/berkeleydb-5.3.28/dist/.
Perhaps libtool patching should be done in $($(PKG)_DIR) instead of
$($(PKG)_SRCDIR), then we wouldn't have this issue. OTOH, only berkeleydb has
this problem. Well, gcc also but that's only a host package, and glibc also but
I guess glibc doesn't need any of the patching we do.
Regards,
Arnout
>
> best regards
> Waldemar
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH] berkeleydb: fix static linking issues
2016-12-05 18:22 ` Arnout Vandecappelle
@ 2016-12-05 21:21 ` Thomas Petazzoni
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2016-12-05 21:21 UTC (permalink / raw)
To: buildroot
Hello,
On Mon, 5 Dec 2016 19:22:44 +0100, Arnout Vandecappelle wrote:
> Perhaps libtool patching should be done in $($(PKG)_DIR) instead of
> $($(PKG)_SRCDIR), then we wouldn't have this issue. OTOH, only berkeleydb has
> this problem.
I like this solution, it's actually the right thing to do. In fact
$(PKG)_SRCDIR is badly named, because the "source directory" really is
$(PKG)_DIR. $(PKG)_SRCDIR merely points to the sub-directory that
contains the configure script.
I've tested changing PKG_SRCDIR to PKG_DIR, and indeed, the libtool
patch gets properly applied to the various ltmain.sh in berkeleydb. I
have not verified if it fixes the build, though.
>>> berkeleydb 5.3.28 Extracting
gzip -d -c /home/thomas/dl/db-5.3.28.NC.tar.gz | tar --strip-components=1 -C /home/thomas/projets/buildroot/output/build/berkeleydb-5.3.28 -xf -
>>> berkeleydb 5.3.28 Patching
>>> berkeleydb 5.3.28 Updating config.sub and config.guess
for file in config.guess config.sub; do for i in $(find /home/thomas/projets/buildroot/output/build/berkeleydb-5.3.28 -name $file); do cp support/gnuconfig/$file $i; done; done
>>> berkeleydb 5.3.28 Patching libtool
patching file /home/thomas/projets/buildroot/output/build/berkeleydb-5.3.28/dist/ltmain.sh
Hunk #1 succeeded at 1416 (offset -1 lines).
Hunk #2 succeeded at 2962 (offset -1 lines).
Hunk #3 succeeded at 5167 (offset -12 lines).
Hunk #4 succeeded at 5177 (offset -12 lines).
Hunk #5 succeeded at 5459 (offset -12 lines).
Hunk #6 succeeded at 5740 (offset -13 lines).
Hunk #7 succeeded at 6682 (offset -14 lines).
Hunk #8 succeeded at 9256 (offset -18 lines).
patching file /home/thomas/projets/buildroot/output/build/berkeleydb-5.3.28/lang/sql/jdbc/ltmain.sh
Hunk #1 succeeded at 1048 (offset -166 lines).
Hunk #2 succeeded at 2018 (offset -221 lines).
Hunk #3 succeeded at 4117 (offset -315 lines).
Hunk #4 succeeded at 4127 (offset -315 lines).
Hunk #5 succeeded at 4404 (offset -320 lines).
Hunk #6 succeeded at 4669 (offset -325 lines).
Hunk #7 succeeded at 5411 (offset -327 lines).
Hunk #8 succeeded at 5569 (offset -327 lines).
Hunk #9 succeeded at 8057 (offset -321 lines).
patching file /home/thomas/projets/buildroot/output/build/berkeleydb-5.3.28/lang/sql/odbc/ltmain.sh
Hunk #1 succeeded at 283 (offset 57 lines).
Hunk #2 succeeded at 419 (offset 171 lines).
Hunk #3 succeeded at 1471 (offset 227 lines).
Hunk #4 succeeded at 2441 with fuzz 2 (offset 288 lines).
Hunk #5 succeeded at 2587 with fuzz 1 (offset 302 lines).
Hunk #6 succeeded at 5654 (offset 472 lines).
Hunk #7 succeeded at 5979 (offset 475 lines).
patching file /home/thomas/projets/buildroot/output/build/berkeleydb-5.3.28/lang/sql/sqlite/ltmain.sh
Hunk #1 succeeded at 1055 (offset -159 lines).
Hunk #2 succeeded at 2025 (offset -214 lines).
Hunk #3 succeeded at 4124 (offset -308 lines).
Hunk #4 succeeded at 4134 (offset -308 lines).
Hunk #5 succeeded at 4411 (offset -313 lines).
Hunk #6 succeeded at 4676 (offset -318 lines).
Hunk #7 succeeded at 5418 (offset -320 lines).
Hunk #8 succeeded at 5576 (offset -320 lines).
Hunk #9 succeeded at 8064 (offset -314 lines).
Waldemar, can you test this solution, and see if it works?
diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
index d1cdb89..7e9eed4 100644
--- a/package/pkg-autotools.mk
+++ b/package/pkg-autotools.mk
@@ -59,7 +59,7 @@ endef
#
define LIBTOOL_PATCH_HOOK
@$(call MESSAGE,"Patching libtool")
- $(Q)for i in `find $($(PKG)_SRCDIR) -name ltmain.sh`; do \
+ $(Q)for i in `find $($(PKG)_DIR) -name ltmain.sh`; do \
ltmain_version=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $$i | \
sed -e 's/\([0-9]*\.[0-9]*\).*/\1/' -e 's/\"//'`; \
ltmain_patchlevel=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $$i | \
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-12-05 21:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-04 17:39 [Buildroot] [PATCH] berkeleydb: fix static linking issues Waldemar Brodkorb
2016-12-04 20:56 ` Thomas Petazzoni
2016-12-05 3:46 ` Waldemar Brodkorb
2016-12-05 18:22 ` Arnout Vandecappelle
2016-12-05 21:21 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox