Skip to contentSkip to conversation

package.snappy: fix static builds

PATCH New Yann E. MORIN 2 participants 6 messages Oct 1, 2016 – Oct 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package.snappy: fix static builds

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/

---
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...

---
 package/snappy/snappy.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/snappy/snappy.mk +8 -0
index b00dddf..3e8d603 100644
@@ -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
+
 $(eval $(autotools-package))
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 package/snappy: bump version

---
 package/snappy/snappy.hash | 2 +-
 package/snappy/snappy.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/snappy/snappy.hash +1 -1
index fc979ae..bb7f104 100644
@@ -1,2 +1,2 @@
 # Locally calculated
-sha256 d64e434e2ddfe9ae942708747003d489e27f2bfddaa5e9e070da98cb00f660f2  snappy-1ff9be9b8fafc8528ca9e055646f5932aa5db9c4.tar.gz
+sha256 f50719c6dc7103d65df66882a3b4569d598eda251266463eca716928187dc12b  snappy-32d6d7d8a2ef328a2ee1dd40f072e21f4983ebda.tar.gz
package/snappy/snappy.mk +1 -1
index 3e8d603..f491f03 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-SNAPPY_VERSION = 1ff9be9b8fafc8528ca9e055646f5932aa5db9c4
+SNAPPY_VERSION = 32d6d7d8a2ef328a2ee1dd40f072e21f4983ebda
 SNAPPY_SITE = $(call github,google,snappy,$(SNAPPY_VERSION))
 SNAPPY_LICENSE = BSD-3c
 SNAPPY_LICENSE_FILES = COPYING
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 package/snappy: bump version

Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

For these bump-to-another-git-revision changes I would prefer some context / details. For bumps to a new release we at least know that the maintainer thinks the sw is ready to be used. With random git versions not so much.

E.G. has some important bugfix or new feature been added? Have you used it yourself? Is the new hash the latest commit in the repo or something else? ..

Anyway - Committed, thanks.

Quoted 37 lines
---
 package/snappy/snappy.hash | 2 +-
 package/snappy/snappy.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/snappy/snappy.hash +0 -1
index fc979ae..bb7f104 100644
@@ -1,2 +1,2 @@
 # Locally calculated
-sha256

d64e434e2ddfe9ae942708747003d489e27f2bfddaa5e9e070da98cb00f660f2 snappy-1ff9be9b8fafc8528ca9e055646f5932aa5db9c4.tar.gz +sha256 f50719c6dc7103d65df66882a3b4569d598eda251266463eca716928187dc12b snappy-32d6d7d8a2ef328a2ee1dd40f072e21f4983ebda.tar.gz

package/snappy/snappy.mk +1 -1
index 3e8d603..f491f03 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-SNAPPY_VERSION = 1ff9be9b8fafc8528ca9e055646f5932aa5db9c4
+SNAPPY_VERSION = 32d6d7d8a2ef328a2ee1dd40f072e21f4983ebda
 SNAPPY_SITE = $(call github,google,snappy,$(SNAPPY_VERSION))
 SNAPPY_LICENSE = BSD-3c
 SNAPPY_LICENSE_FILES = COPYING
Signature · 6 lines
2.7.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 2/2 package/snappy: bump version

Peter, All,

On 2016-10-02 21:31 +0200, Peter Korsgaard spake thusly:

Quoted 11 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

For these bump-to-another-git-revision changes I would prefer some context / details. For bumps to a new release we at least know that the maintainer thinks the sw is ready to be used. With random git versions not so much.

E.G. has some important bugfix or new feature been added? Have you used it yourself? Is the new hash the latest commit in the repo or something else? ..

Here's your commit log:

There's been a single release of snappy since the move from GoogleCode to Github; that release was more than a year ago. In that time frame, only 14 commits went in master, of which to merges, so about 1 real commit per month...

For a brief summary of additional stuff since the last release:
- provide snappy.pc
- a few generic bug fixes, as well as a few ARM-specific ones
- a few buildsystem fixes

Since we can't say releases are made on a timely cadence, let's just hop to the latest master from the git tree.

;-)

Quoted 1 line

Anyway - Committed, thanks.

Thanks!

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 2/2 package/snappy: bump version

Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Peter, All,
On 2016-10-02 21:31 +0200, Peter Korsgaard spake thusly:

Quoted 11 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

For these bump-to-another-git-revision changes I would prefer some context / details. For bumps to a new release we at least know that the maintainer thinks the sw is ready to be used. With random git versions not so much.

E.G. has some important bugfix or new feature been added? Have you used it yourself? Is the new hash the latest commit in the repo or something else? ..

Here's your commit log:

There's been a single release of snappy since the move from GoogleCode to Github; that release was more than a year ago. In that time frame, only 14 commits went in master, of which to merges, so about 1 real commit per month...

Quoted 7 lines

For a brief summary of additional stuff since the last release:
- provide snappy.pc
- a few generic bug fixes, as well as a few ARM-specific ones
- a few buildsystem fixes

Since we can't say releases are made on a timely cadence, let's just hop to the latest master from the git tree.

Great, please add this kind of info to the commit message next time, at least the .pc file could be interesting.

Signature · 2 lines
Venlig hilsen,
Peter Korsgaard 
#5 lore raw

PATCH 1/2 package.snappy: fix static builds

In reply to Yann E. MORIN
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> 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/
Quoted 8 lines

---
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.

Quoted 9 lines
---
 package/snappy/snappy.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/snappy/snappy.mk +0 -0
index b00dddf..3e8d603 100644

package/snappy/snappy.mk SNAPPY_INSTALL_STAGING = YES · line 25

Quoted 10 lines
package/snappy/snappy.mk +7 -0
@@ -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.

Signature · 1 line
Bye, Peter Korsgaard