Skip to contentSkip to conversation

libssh2: update second patch

PATCH New Fabrice Fontaine 2 participants 2 messages Nov 3, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libssh2: update second patch

curl can be statically linked with mbedtls, in this case build will fail on:
kex.c:(.text+0x1be0): undefined reference to `mbedtls_mpi_read_binary'

This is due to the fact that CURL_LIBRARIES does not contain mbedtls library:
CURL_LIBRARIES:INTERNAL=curl;cares;ssh2;ssh2;z;ssl;crypto;z;z;crypto;z;z;ssl;z;z;crypto;z

even if libcurl.pc is correct:
Libs.private: -lcares -lssh2 -L/home/fabrice/buildroot/output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -lssh2 /home/fabrice/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmbedcrypto.a /home/fabrice/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmbedcrypto.a -L/home/fabrice/buildroot/output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -L/home/fabrice/buildroot/output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -lz -lssl -lcrypto -lssl -lz -lz -lcrypto -lz -lz

This full library path is added by the second patch on libssh2 so update it to replace $LIBMBDEDCRYPTO by $LTLIBMBEDCRYPTO as suggested by Thomas during review of https://patchwork.ozlabs.org/patch/989339

Fixes:
- http://autobuild.buildroot.org/results/dc7810d5d5c62658837cdd2faae6fe3390f968a2

---
 package/libssh2/0002-acinclude.m4-add-mbedtls-to-LIBS.patch | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
package/libssh2/0002-acinclude.m4-add-mbedtls-to-LIBS.patch +5 -1
index 76e08c51a9..b74c6c9c48 100644
@@ -8,6 +8,10 @@ libssh2.pc contains correct info for the benefit of pkg-config users.
 Static link with libssh2 requires this information.
 
 Signed-off-by: Baruch Siach <[email protected]>
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Replace $LIBMBEDCRYTO by $LTLIBMBEDCRYPTO to avoid adding a full
+library path to libssh2.pc as it raises build failures on some packages
+such as xerces]
 ---
 Upstream status: https://github.com/libssh2/libssh2/pull/242
 
@@ -22,7 +26,7 @@ index c0e89a1a0c98..02c70845d27c 100644
  [mbedtls], [
    LIBSSH2_LIB_HAVE_LINKFLAGS([mbedcrypto], [], [#include <mbedtls/version.h>], [
      AC_DEFINE(LIBSSH2_MBEDTLS, 1, [Use $1])
-+    LIBS="$LIBS $LIBMBEDCRYPTO"
++    LIBS="$LIBS $LTLIBMBEDCRYPTO"
      found_crypto="$1"
      support_clear_memory=yes
    ])
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 libssh2: update second patch

Hello Fabrice,

Quoted 11 lines · Fabrice Fontaine

curl can be statically linked with mbedtls, in this case build will fail on:
kex.c:(.text+0x1be0): undefined reference to `mbedtls_mpi_read_binary'

This is due to the fact that CURL_LIBRARIES does not contain mbedtls library:
CURL_LIBRARIES:INTERNAL=curl;cares;ssh2;ssh2;z;ssl;crypto;z;z;crypto;z;z;ssl;z;z;crypto;z

even if libcurl.pc is correct:
Libs.private: -lcares -lssh2 -L/home/fabrice/buildroot/output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -lssh2 /home/fabrice/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmbedcrypto.a /home/fabrice/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmbedcrypto.a -L/home/fabrice/buildroot/output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -L/home/fabrice/buildroot/output/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib -lz -lssl -lcrypto -lssl -lz -lz -lcrypto -lz -lz

Quoted 8 lines

This full library path is added by the second patch on libssh2 so update it to replace $LIBMBDEDCRYPTO by $LTLIBMBEDCRYPTO as suggested by Thomas during review of https://patchwork.ozlabs.org/patch/989339

Fixes:
- http://autobuild.buildroot.org/results/dc7810d5d5c62658837cdd2faae6fe3390f968a2

I have applied, but after tweaking the commit title. Indeed "update second patch" is very fuzzy. It should instead describe what is the goal of the commit, not how you achieve it. The fact that you need to update the second patch to fix static linking scenarios involving mbedtls is of secondary importance.

Quoted 2 lines

+Signed-off-by: Fabrice Fontaine <[email protected]>

Your SoB...

package/libssh2/0002-acinclude.m4-add-mbedtls-to-LIBS.patch libssh2.pc contains correct info for the benefit of pkg-config users. · line 14

Quoted 3 lines

+[Replace $LIBMBEDCRYTO by $LTLIBMBEDCRYPTO to avoid adding a full

package/libssh2/0002-acinclude.m4-add-mbedtls-to-LIBS.patch +2 -0
+library path to libssh2.pc as it raises build failures on some packages
+such as xerces]

... should have been *after* the commit you're adding to explain the changes you've done.

I've fixed both issues and applied. Many thanks for looking again at the issue following my initial review, and providing an updated version of the patch!

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com