Skip to contentSkip to conversation

package/protobuf: misc fixes (branch yem/protobuf)

PATCH New Yann E. MORIN 2 participants 4 messages Aug 18, 2015

lore
Share & tools
lore
#0 lore raw

v2 cover package/protobuf: misc fixes (branch yem/protobuf)

Hello All!

This small series fixes two things wrt protobuf:

- remove a false comment in protobuf-c, implying that there was a dependency on protobuf, which is wrong,

- make protobuf depend on shared libs to fix an idiosyncracy of the autoconf macro that checks for threads and forcibly wants to link it shared, always.

Changes v1 -> v2:
- rebase on top of master, after the thread fixes

Regards,
Yann E. MORIN.

The following changes since commit 932442e7a30e6d2e08c1ba8cb1d4c1cf7464926c:

ola: Add patch to fix linking issue (2015-08-18 21:06:20 +0200)

are available in the git repository at:

git://git.busybox.net/~ymorin/git/buildroot yem/protobuf

for you to fetch changes up to f3cf57fe430940d32733da671c2a9bbac56b1cb9:

package/protobuf: needs dynamic libraries (2015-08-18 21:18:01 +0200)

----------------------------------------------------------------
Yann E. MORIN (2):
package/protobuf-c: threads dependency is a direct dependency package/protobuf: needs dynamic libraries

 package/mosh/Config.in       | 6 ++++--
 package/ola/Config.in        | 6 ++++--
 package/protobuf-c/Config.in | 2 +-
 package/protobuf/Config.in   | 6 ++++--
 4 files changed, 13 insertions(+), 7 deletions(-)
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.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v2 1/2 package/protobuf-c: threads dependency is a direct dependency

Currently, protobuf-c's dependency on threads is labelled as being inherited from protobuf.

This is wrong, as protobuf-c does not depend on protobuf, and such dependency was removed in e16865a (protobuf-c: Don't require protobuf on target), but forgot to remove the corresponding comment.

Remove it now.

---
 package/protobuf-c/Config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/protobuf-c/Config.in +1 -1
index f9fab37..2855550 100644
@@ -1,7 +1,7 @@
 config BR2_PACKAGE_PROTOBUF_C
 	bool "protobuf-c"
 	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_TOOLCHAIN_HAS_THREADS # protobuf
+	depends on BR2_TOOLCHAIN_HAS_THREADS
 	# host-protobuf only builds on certain architectures
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
 	help
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/2 package/protobuf: needs dynamic libraries

In reply to Yann E. MORIN

Eventhough it should be theoretically possible to build protobuf in static-only, configure.ac includes an m4 macro, ACX_PTHREAD defined in m4/acx_pthread.m4, which forcibly checks for threads *with* shared libs, and is completely broken for static-only (as it forces -shared whatever the user selection), ending up with these configure results:

checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking whether to check for GCC pthread/shared inconsistencies... yes
checking whether -pthread is sufficient with -shared... no
checking whether -lpthread fixes that... no
checking whether -lc_r fixes that... no
configure: WARNING: Impossible to determine how to use pthreads with shared libraries checking whether what we have so far is sufficient with -nostdlib... no
checking whether -lpthread saves the day... no
configure: WARNING: Impossible to determine how to use pthreads with shared libraries and -nostdlib

Fixing this macro is far from trivial; protobuf in a static-only scenario is probably not too common. So, just disable protobuf for static-only builds.

Fixes:

    http://autobuild.buildroot.org/results/3ef/3efb86c7e8ec2db5d953d634470cafae79bd34cf/
    http://autobuild.buildroot.org/results/96a/96ae1108fc3193df2a93a779057130b774379655/
    http://autobuild.buildroot.org/results/00c/00c29795980319d38823eec1301e9ebd860ebd2a/
    ...

---
Changes v1 -> v2:
- rebase ontop of master, after thread fixes

---
 package/mosh/Config.in     | 6 ++++--
 package/ola/Config.in      | 6 ++++--
 package/protobuf/Config.in | 6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)
package/mosh/Config.in +4 -2
index f4c1466..868b9ff 100644
@@ -1,5 +1,6 @@
-comment "mosh needs a toolchain w/ C++, threads"
-	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
+comment "mosh needs a toolchain w/ C++, threads, dynamic library"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP \
+		|| BR2_STATIC_LIBS
 	depends on !(BR2_arm || BR2_i386 || BR2_mipsel || BR2_x86_64)
 
 config BR2_PACKAGE_MOSH
@@ -7,6 +8,7 @@ config BR2_PACKAGE_MOSH
 	depends on BR2_arm || BR2_i386 || BR2_mipsel || BR2_x86_64 # protobuf
 	depends on BR2_INSTALL_LIBSTDCPP # protobuf
 	depends on BR2_TOOLCHAIN_HAS_THREADS # protobuf
+	depends on !BR2_STATIC_LIBS # protobuf
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" # protobuf
 	select BR2_PACKAGE_PROTOBUF
 	select BR2_PACKAGE_NCURSES
package/ola/Config.in +4 -2
index f587db5..fd693de 100644
@@ -1,5 +1,6 @@
-comment "ola needs a toolchain w/ C++, threads, wchar"
-	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
+comment "ola needs a toolchain w/ C++, threads, wchar, dynamic library"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR \
+		|| !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
 	depends on BR2_arm || BR2_i386 || BR2_mipsel || BR2_x86_64
 
 config BR2_PACKAGE_OLA
@@ -8,6 +9,7 @@ config BR2_PACKAGE_OLA
 	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
 	select BR2_PACKAGE_UTIL_LINUX
 	depends on BR2_INSTALL_LIBSTDCPP # protobuf
+	depends on !BR2_STATIC_LIBS # protobuf
 	depends on BR2_USE_WCHAR # util-linux
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_arm || BR2_i386 || BR2_mipsel || BR2_x86_64 # protobuf
package/protobuf/Config.in +4 -2
index bbb927f..9ee7e7d 100644
@@ -7,13 +7,15 @@ config BR2_PACKAGE_PROTOBUF
 	depends on BR2_arm || BR2_i386 || BR2_mipsel || BR2_x86_64
 	# host-protobuf only builds on certain architectures
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
+	depends on !BR2_STATIC_LIBS
 	help
 	  Protocol buffers are Google's language-neutral, platform-neutral,
 	  extensible mechanism for serializing structured data.
 
 	  https://developers.google.com/protocol-buffers
 
-comment "protobuf needs a toolchain w/ C++, threads"
-	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
+comment "protobuf needs a toolchain w/ C++, threads, dynamic library"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
+		|| BR2_STATIC_LIBS
 	depends on BR2_arm || BR2_i386 || BR2_mipsel || BR2_x86_64
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
Signature · 1 line
1.9.1
#3 lore raw

v2 cover package/protobuf: misc fixes (branch yem/protobuf)

In reply to Yann E. MORIN

Dear Yann E. MORIN,

Quoted 3 lines · Yann E. MORIN

Yann E. MORIN (2):
package/protobuf-c: threads dependency is a direct dependency package/protobuf: needs dynamic libraries

Both applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com