Revert "bctoolbox: fix typos and logic error"
PATCH 1/4 Revert "bctoolbox: fix typos and logic error"
This reverts commit 5c4d3560b94c9cb8f1594c9200a632b89ddf7aa0.
Although the patch fixes the build error it does not set the flags for Libs.private properly. A fellow-up patch will provide a better solution for this issue.
--- package/bctoolbox/0001-fix-typo.patch | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 package/bctoolbox/0001-fix-typo.patch
package/bctoolbox/0001-fix-typo.patch deleted +0 -18
@@ -1,18 +0,0 @@ -Fix a typo in the variable name. Only check path for a single library name. - -Signed-off-by: Waldemar Brodkorb <[email protected]> - -diff -Nur bctoolbox-0.4.0.orig/CMakeLists.txt bctoolbox-0.4.0/CMakeLists.txt ---- bctoolbox-0.4.0.orig/CMakeLists.txt 2016-10-06 17:30:41.000000000 +0200 -+++ bctoolbox-0.4.0/CMakeLists.txt 2017-02-13 23:30:38.641288032 +0100 -@@ -103,8 +103,8 @@ - endif() - - if(MBEDTLS_FOUND) -- get_filename_component(mbedtls_library_path "${MBEDTLS_LIBRARIES}" PATH) -- set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${mbedlts_library_path}") -+ get_filename_component(mbedtls_library_path "${MBEDTLS_LIBRARY}" PATH) -+ set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${mbedtls_library_path}") - endif() - if(POLARSSL_FOUND) - get_filename_component(polarssl_library_path "${POLARSSL_LIBRARIES}" PATH)
Signature · 1 line
2.11.1
PATCH 2/4 bctoolbox: add patch to fix static linking
Static linking with bctoolbox fails when using pkg-config as the generated bctoolbox.pc file only consists of an '-L' string without any search path or libraries flags:
``` libtool: link: need path for `-L' option ```
That's because of an typo in mbedtls_library_path. However, mbedtls_library_path contains a string of the mbedtls libraries concatenated by an ';' which cannot be parsed by pkg-config.
Therefore, use MBEDTLS_LIBRARY instead of MBEDTLS_LIBRARIES to get the library path.
Furthermore, add the three mbedtls libraries mbedtls, mbedcrypto, and mbedx509 to LIBS_PRIVATE so these libraries are added to the Libs.private field of bctoolbox.pc.
Fixes:
http://autobuild.buildroot.net/results/37d5625df4be11ccdc063871e9f6e13d5f59fb52
http://autobuild.buildroot.net/results/1999c841fae41f860f00747a362327cb2857e687
.. and many more.
Upstream status: Pending
https://github.com/BelledonneCommunications/bctoolbox/pull/4
--- .../0001-Fix-Libs.private-flags-for-mbedtls.patch | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 package/bctoolbox/0001-Fix-Libs.private-flags-for-mbedtls.patch
package/bctoolbox/0001-Fix-Libs.private-flags-for-mbedtls.patch new file +49 -0
@@ -0,0 +1,49 @@ +From c0b3dbb43aa3a38c47311556c85eadc6072e2d68 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= <[email protected]> +Date: Tue, 14 Feb 2017 22:02:26 +0100 +Subject: [PATCH] Fix Libs.private flags for mbedtls +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Static linking with bctoolbox fails when using pkg-config as the +generated bctoolbox.pc file only consists of an '-L' string without any +search path or libraries flags. + +That's because of an typo in `mbedtls_library_path`. However, +`mbedtls_library_path` contains a string of the mbedtls libraries +concatenated by an ';' which cannot be parsed by pkg-config. + +Therefore, use `MBEDTLS_LIBRARY` instead of `MBEDTLS_LIBRARIES` to get +the library path. + +Furthermore, add the three mbedtls libraries *mbedtls*, *mbedcrypto*, and +*mbedx509* to `LIBS_PRIVATE` so these libraries are added to the +`Libs.private` field of bctoolbox.pc. + +Upstream status: Pending +https://github.com/BelledonneCommunications/bctoolbox/pull/4 + +Signed-off-by: J?rg Krause <[email protected]> +--- + CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ed7aa00..4127f0e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -103,8 +103,8 @@ else() + endif() + + if(MBEDTLS_FOUND) +- get_filename_component(mbedtls_library_path "${MBEDTLS_LIBRARIES}" PATH) +- set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${mbedlts_library_path}") ++ get_filename_component(mbedtls_library_path "${MBEDTLS_LIBRARY}" PATH) ++ set(LIBS_PRIVATE "${LIBS_PRIVATE} -L${mbedtls_library_path} -lmbedtls -lmbedcrypto -lmbedx509") + endif() + if(POLARSSL_FOUND) + get_filename_component(polarssl_library_path "${POLARSSL_LIBRARIES}" PATH) +-- +2.11.1 +
Signature · 1 line
2.11.1
PATCH 3/4 bctoolbox: fix mbedtls/polarssl dependency
In reply to Jörg KrauseCurrently we force selection on mbedtls for bctoolbox. If, for whatever reason, mbedTLS is not found, bctoolbox searches for PolarSSL and, if not present, fails with:
``` Could NOT find PolarSSL (missing: POLARSSL_INCLUDE_DIRS HAVE_POLARSSL_SSL_H) ```
This happens because bctoolbox enables support for mbedTLS and PolarSSL by default, whereas, if both are enabled, mbedTLS is preferred over PolarSSL.
However, crypto support is not mandatory and support for both libraries can be turned off. Therefore, optionally depend on mbedTLS or PolarSSL and enable/disable the library support explicitly.
This fixes the issue of searching for PolarSSL altough the dependency is not declared in the bctoolbox package.
Note, that this does not fix the issue why mbedtls is not found although it is enabled. This issue is address in this thread [1].
Fixes:
http://autobuild.buildroot.net/results/cfe/cfeb2f542598e5d450b332fb51a6d79bae24158c/
.. and more.
[1] http://lists.busybox.net/pipermail/buildroot/2017-February/183055.html
--- package/bctoolbox/Config.in | 4 +++- package/bctoolbox/bctoolbox.mk | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
package/bctoolbox/Config.in +3 -1
@@ -2,11 +2,13 @@ config BR2_PACKAGE_BCTOOLBOX bool "bctoolbox" depends on BR2_INSTALL_LIBSTDCPP depends on BR2_TOOLCHAIN_HAS_THREADS - select BR2_PACKAGE_MBEDTLS # mbedtls is preferred over polarssl help Utilities library used by Belledonne Communications softwares like belle-sip, mediastreamer2 and linphone. + Select BR2_PACKAGE_MBEDTLS (preferred) or + BR2_PACKAGE_POLARSSL for crypto support. + https://github.com/BelledonneCommunications/bctoolbox comment "bctoolbox needs a toolchain w/ C++, threads"
package/bctoolbox/bctoolbox.mk +16 -0
@@ -17,6 +17,22 @@ BCTOOLBOX_CONF_OPTS = \ -DENABLE_TESTS=OFF \ -DGIT_EXECUTABLE=OFF +# bctoolbox can be build with mbedTLS or PolarSSL support. If both +# libraries are present, mbedTLS is preferred over PolarSSL. +ifeq ($(BR2_PACKAGE_MBEDTLS),y) +BCTOOLBOX_DEPENDENCIES += mbedtls +BCTOOLBOX_CONF_OPTS += -DENABLE_MBEDTLS=ON +else +BCTOOLBOX_CONF_OPTS += -DENABLE_MBEDTLS=OFF +endif + +ifeq ($(BR2_PACKAGE_POLARSSL),y) +BCTOOLBOX_DEPENDENCIES += polarssl +BCTOOLBOX_CONF_OPTS += -DENABLE_POLARSSL=ON +else +BCTOOLBOX_CONF_OPTS += -DENABLE_POLARSSL=OFF +endif + ifeq ($(BR2_STATIC_LIBS),y) BCTOOLBOX_CONF_OPTS += -DENABLE_SHARED=OFF -DENABLE_STATIC=ON else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
Signature · 1 line
2.11.1
PATCH 4/4 bctoolbox: disable rpath
In reply to Jörg KrauseBy default, bctoolbox adds the rpath to the shared library. Prevent this by setting CMAKE_SKIP_RPATH [1] to a true value.
[1] https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_RPATH.html
--- package/bctoolbox/bctoolbox.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
package/bctoolbox/bctoolbox.mk +4 -1
@@ -11,11 +11,14 @@ BCTOOLBOX_LICENSE_FILES = COPYING BCTOOLBOX_DEPENDENCIES = mbedtls BCTOOLBOX_INSTALL_STAGING = YES +# Set CMAKE_SKIP_RPATH to prevent bctoolbox from adding the rpath to +# shared library. BCTOOLBOX_CONF_OPTS = \ -DENABLE_STRICT=OFF \ -DENABLE_TESTS_COMPONENT=OFF \ -DENABLE_TESTS=OFF \ - -DGIT_EXECUTABLE=OFF + -DGIT_EXECUTABLE=OFF \ + -DCMAKE_SKIP_RPATH=ON # bctoolbox can be build with mbedTLS or PolarSSL support. If both # libraries are present, mbedTLS is preferred over PolarSSL.
Signature · 1 line
2.11.1
PATCH 4/4 bctoolbox: disable rpath
Hi J?rg,
Quoted 17 lines · J?rg Krause
By default, bctoolbox adds the rpath to the shared library. Prevent this by setting
CMAKE_SKIP_RPATH[1] to a true value.[1] https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_RPATH.html
Signed-off-by J?rg Krause <[email protected]>--- package/bctoolbox/bctoolbox.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)package/bctoolbox/bctoolbox.mk +0
-0@@ -11,11 +11,14 @@ BCTOOLBOX_LICENSE_FILES = COPYING BCTOOLBOX_DEPENDENCIES = mbedtls BCTOOLBOX_INSTALL_STAGING = YES
package/bctoolbox/bctoolbox.mk BCTOOLBOX_LICENSE_FILES = COPYING · line 21
Quoted 10 lines
package/bctoolbox/bctoolbox.mk +4
-1+# Set CMAKE_SKIP_RPATH to prevent bctoolbox from adding the rpath to +# shared library. BCTOOLBOX_CONF_OPTS = \ -DENABLE_STRICT=OFF \ -DENABLE_TESTS_COMPONENT=OFF \ -DENABLE_TESTS=OFF \ - -DGIT_EXECUTABLE=OFF + -DGIT_EXECUTABLE=OFF \ + -DCMAKE_SKIP_RPATH=ON
Shouldn't we have this in package/pkg-cmake.mk? Samuel?
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH 4/4 bctoolbox: disable rpath
Quoted 21 lines · Baruch Siach
Hi J?rg,
Quoted 18 lines · J?rg Krause
By default, bctoolbox adds the rpath to the shared library. Prevent this by setting
CMAKE_SKIP_RPATH[1] to a true value.[1] https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_RPATH.html
Signed-off-by J?rg Krause <[email protected]>--- package/bctoolbox/bctoolbox.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)package/bctoolbox/bctoolbox.mk +0
-0@@ -11,11 +11,14 @@ BCTOOLBOX_LICENSE_FILES = COPYING BCTOOLBOX_DEPENDENCIES = mbedtls BCTOOLBOX_INSTALL_STAGING = YES
Quoted 11 lines
package/bctoolbox/bctoolbox.mk BCTOOLBOX_LICENSE_FILES = COPYING · line 21
Quoted 9 lines
package/bctoolbox/bctoolbox.mk +4
-1+# Set CMAKE_SKIP_RPATH to prevent bctoolbox from adding the rpath to +# shared library. BCTOOLBOX_CONF_OPTS = \ -DENABLE_STRICT=OFF \ -DENABLE_TESTS_COMPONENT=OFF \ -DENABLE_TESTS=OFF \ - -DGIT_EXECUTABLE=OFF + -DGIT_EXECUTABLE=OFF \ + -DCMAKE_SKIP_RPATH=ONShouldn't we have this in
package/pkg-cmake.mk? Samuel?
For host package, we may want to enable rpath.
For target package, I think we should not set/force this option by the infra because some packages may install some kind-of private libraries elsewhere than in /usr/lib and set RPATH to in their binaries to find them (e.g.: sudo or iptables, though they are cmake-based packages.).
Regards,
Signature · 1 line
Samuel
PATCH 4/4 bctoolbox: disable rpath
Hello,
Quoted 4 lines · Samuel Martin
For target package, I think we should not set/force this option by the infra because some packages may install some kind-of private libraries elsewhere than in
/usr/liband set RPATH to in their binaries to find them (e.g.: sudo or iptables, though they are cmake-based packages.).
Hum, I didn't think about this, and you're probably right. If CMAKE_SKIP_RPATH skips *all* rpath information, including some custom one like pointing to /usr/lib/<foo>/, then we have to keep it indeed.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 4/4 bctoolbox: disable rpath
In reply to Baruch SiachHello,
Quoted 21 lines · Baruch Siach
Hi J?rg,
Quoted 18 lines · J?rg Krause
By default, bctoolbox adds the rpath to the shared library. Prevent this by setting
CMAKE_SKIP_RPATH[1] to a true value.[1] https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_RPATH.html
Signed-off-by J?rg Krause <[email protected]>--- package/bctoolbox/bctoolbox.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)package/bctoolbox/bctoolbox.mk +0
-0@@ -11,11 +11,14 @@ BCTOOLBOX_LICENSE_FILES = COPYING BCTOOLBOX_DEPENDENCIES = mbedtls BCTOOLBOX_INSTALL_STAGING = YES
Quoted 11 lines
package/bctoolbox/bctoolbox.mk BCTOOLBOX_LICENSE_FILES = COPYING · line 21
Quoted 9 lines
package/bctoolbox/bctoolbox.mk +4
-1+# Set CMAKE_SKIP_RPATH to prevent bctoolbox from adding the rpath to +# shared library. BCTOOLBOX_CONF_OPTS = \ -DENABLE_STRICT=OFF \ -DENABLE_TESTS_COMPONENT=OFF \ -DENABLE_TESTS=OFF \ - -DGIT_EXECUTABLE=OFF + -DGIT_EXECUTABLE=OFF \ + -DCMAKE_SKIP_RPATH=ONShouldn't we have this in
package/pkg-cmake.mk? Samuel?
Indeed, it's a generic CMake option, so it should be in package/pkg-cmake.mk IMO.
Worth mentioning that there is both CMAKE_SKIP_RPATH and CMAKE_SKIP_INSTALL_RPATH. The former skips adding the rpath during both the build and install steps, which prevents from running the binary from the build directory. The latter only skips the rpath during the install step. But since we're cross-compiling, running on the host machine from the build directory anyway doesn't make sense. So CMAKE_SKIP_RPATH is OK.
See https://cmake.org/cmake/help/v3.0/variable/CMAKE_SKIP_RPATH.html.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 4/4 bctoolbox: disable rpath
Hi,
Quoted 40 lines · Thomas Petazzoni
Hello,
Quoted 28 lines · Baruch Siach
Hi J?rg,
Quoted 25 lines · J?rg Krause
By default, bctoolbox adds the rpath to the shared library. Prevent this
by settingCMAKE_SKIP_RPATH[1] to a true value.[1] https://cmake.org/cmake/help/latest/variable/CMAKE_SKIP_RPATH
.htmlSigned-off-by J?rg Krause <[email protected]>---
?package/bctoolbox/bctoolbox.mk | 5 ++++-
?1 file changed, 4 insertions(+), 1 deletion(-)package/bctoolbox/bctoolbox.mk +0
-0@@ -11,11 +11,14 @@ BCTOOLBOX_LICENSE_FILES = COPYING?BCTOOLBOX_DEPENDENCIES = mbedtls ?BCTOOLBOX_INSTALL_STAGING = YES
?
+# SetCMAKE_SKIP_RPATHto prevent bctoolbox from adding the rpath to
+# shared library.
?BCTOOLBOX_CONF_OPTS = \Quoted 8 lines
package/bctoolbox/bctoolbox.mk BCTOOLBOX_LICENSE_FILES = COPYING
Quoted 6 lines
? -DENABLE_STRICT=OFF \
? -DENABLE_TESTS_COMPONENT=OFF \
? -DENABLE_TESTS=OFF \package/bctoolbox/bctoolbox.mk +2
-1- -DGIT_EXECUTABLE=OFF + -DGIT_EXECUTABLE=OFF \ + -DCMAKE_SKIP_RPATH=ON??Shouldn't we have this in
package/pkg-cmake.mk? Samuel?
Quoted 2 lines
Indeed, it's a generic CMake option, so it should be in
package/pkg-cmake.mkIMO.
opencv and opencv3 both set this option on a package level.
Quoted 10 lines
Worth mentioning that there is both
CMAKE_SKIP_RPATHandCMAKE_SKIP_INSTALL_RPATH. The former skips adding the rpath during both
the build and install steps, which prevents from running the binary from the build directory. The latter only skips the rpath during the install step. But since we're cross-compiling, running on the host machine from the build directory anyway doesn't make sense. SoCMAKE_SKIP_RPATHis OK.See https://cmake.org/cmake/help/v3.0/variable/CMAKE_SKIP_RPATH.html.
Samuel argues not to force this option by the infrastructure. I am not sure how do we handle this properly. So, what shall we do?
Best regards,
J?rg Krause
PATCH 4/4 bctoolbox: disable rpath
Hello,
Quoted 9 lines · J?rg Krause
Quoted 9 lines
Worth mentioning that there is both
CMAKE_SKIP_RPATHandCMAKE_SKIP_INSTALL_RPATH. The former skips adding the rpath during both
the build and install steps, which prevents from running the binary from the build directory. The latter only skips the rpath during the install step. But since we're cross-compiling, running on the host machine from the build directory anyway doesn't make sense. SoCMAKE_SKIP_RPATHis OK.
Quoted 4 lines
Quoted 1 line
See https://cmake.org/cmake/help/v3.0/variable/CMAKE_SKIP_RPATH.html.
Samuel argues not to force this option by the infrastructure. I am not sure how do we handle this properly. So, what shall we do?
As I said in my second e-mail (sent after reading Samuel's answer), Samuel is probably correct. Skipping the rpath in *all* cases may not be correct, so we have to do it at the per-package level, like your patch does.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/4 Revert "bctoolbox: fix typos and logic error"
In reply to Jörg KrauseHello,
Quoted 11 lines · J?rg Krause
This reverts commit
5c4d3560b94c9cb8f1594c9200a632b89ddf7aa0.Although the patch fixes the build error it does not set the flags for Libs.private properly. A fellow-up patch will provide a better solution for this issue.
Signed-off-by J?rg Krause <[email protected]>--- package/bctoolbox/0001-fix-typo.patch | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 package/bctoolbox/0001-fix-typo.patch
Series applied to master. Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com