From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] package.snappy: fix static builds
Date: Sun, 02 Oct 2016 21:19:40 +0200 [thread overview]
Message-ID: <87intapnhv.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <1475348688-1805-1-git-send-email-yann.morin.1998@free.fr> (Yann E. MORIN's message of "Sat, 1 Oct 2016 21:04:47 +0200")
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> For some toolchains, libstdc++ uses pthread symbols:
> .../lib/libstdc++.a(eh_alloc.o): In function `__gnu_cxx::__mutex::lock()':
> eh_alloc.cc:(.text._ZN9__gnu_cxx7__mutex4lockEv[_ZN9__gnu_cxx7__mutex4lockEv]+0x2):
> undefined reference to `pthread_mutex_lock'
> and a lot of other pthread symbols...
> However, when doing a static build, there is no way for the linker what
> library to link in, so the build fails miserably if -pthread is not
> specified at link time.
> Fixes:
> http://autobuild.buildroot.org/results/15e/15ecaa23f0116e8120b3d62e553c838f0303df35/
> http://autobuild.buildroot.org/results/f0a/f0abe301816e39eb4ae26d3e8cd42d90901d5ac5/
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
> Note: snappy's buildsystem uses libtool, and libsnappy.la does have the
> necessary -pthread listed as a "dependency":
> 16 # Linker flags that cannot go in dependency_libs.
> 17 inherited_linker_flags=' -pthread'
> But that is not picked-up by libtool, and I don't know why...
This is arguably a toolchain bug and the thing that fails to link is
just a unit test, so we could also disable it - But OK.
> ---
> package/snappy/snappy.mk | 8 ++++++++
> 1 file changed, 8 insertions(+)
> diff --git a/package/snappy/snappy.mk b/package/snappy/snappy.mk
> index b00dddf..3e8d603 100644
> --- a/package/snappy/snappy.mk
> +++ b/package/snappy/snappy.mk
> @@ -16,4 +16,12 @@ SNAPPY_INSTALL_STAGING = YES
> # Disable tests
> SNAPPY_CONF_OPTS = --disable-gtest
> +# libsnappy links with libstdc++. libstdc++ uses pthread symbols. libstdc++
> +# does not have a .pc file, and its .la file does not mention -pthread.
> +# So, static links to libstdc++ will fail if -pthread is not explicity
> +# linked to. Only do that for static builds.
> +ifeq ($(BR2_STATIC_LIBS),y)
> +SNAPPY_CONF_OPTS += LIBS=-pthread
> +endif
Snappy doesn't depend on threads, so this should only be done if
BR2_TOOLCHAIN_HAS_THREADS.
Committed with that fixed, thanks.
--
Bye, Peter Korsgaard
prev parent reply other threads:[~2016-10-02 19:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-01 19:04 [Buildroot] [PATCH 1/2] package.snappy: fix static builds Yann E. MORIN
2016-10-01 19:04 ` [Buildroot] [PATCH 2/2] package/snappy: bump version Yann E. MORIN
2016-10-02 19:31 ` Peter Korsgaard
2016-10-02 19:44 ` Yann E. MORIN
2016-10-02 19:52 ` Peter Korsgaard
2016-10-02 19:19 ` Peter Korsgaard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87intapnhv.fsf@dell.be.48ers.dk \
--to=peter@korsgaard.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox