Skip to contentSkip to conversation

curl: Remove absolute paths when mbedtls is enabled

PATCH In review [email protected] 3 participants 5 messages May 13 – May 22

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 curl: Remove absolute paths when mbedtls is enabled

From: Ricardo Simoes <[email protected]>

When enabling mbedtls PACKAGECONFIG option, the curl-config and libcurl.pc are generated with paths to STAGE_DIR_TARGET, causing the QA check buildpaths to fail. This is due to the fact that the mbedtls option uses the path to STAGING_DIR_TARGET to find the mbedtls library.

When installed, the curl-config and libcurl.pc will still need the the flag '--with-mbedtls', but not with the path. Same is true for the library path flag. Thus drop the absolute paths from both files when mbedtls is enabled, and add the flag '--with-mbedtls' to the curl-config and libcurl.pc.

---
 meta/recipes-support/curl/curl_8.19.0.bb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-support/curl/curl_8.19.0.bb +4 -2
index b9251336b8..cc37cc934b 100644
@@ -93,13 +93,15 @@ EXTRA_OECONF = " \
 "
 
 fix_absolute_paths () {
-	# cleanup buildpaths from curl-config
+	# cleanup buildpaths from curl-config and libcurl.pc
 	sed -i \
 	    -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
 	    -e 's,--with-libtool-sysroot=${STAGING_DIR_TARGET},,g' \
+	    -e 's,--with-mbedtls=${STAGING_DIR_TARGET},--with-mbedtls,g' \
+	    -e 's,-L${STAGING_DIR_TARGET},,g' \
 	    -e 's|${DEBUG_PREFIX_MAP}||g' \
 	    -e 's|${@" ".join(d.getVar("DEBUG_PREFIX_MAP").split())}||g' \
-	    ${D}${bindir}/curl-config
+	    ${D}${bindir}/curl-config ${D}${libdir}/pkgconfig/libcurl.pc
 }
 
 do_install:append:class-target() {
Signature · 1 line
2.34.1
#1 lore raw
Quoted 38 lines · Mark Jonas via lists.openembedded.org

From: Ricardo Simoes <[email protected]>

When enabling mbedtls PACKAGECONFIG option, the curl-config and libcurl.pc are generated with paths to STAGE_DIR_TARGET, causing the QA check buildpaths to fail. This is due to the fact that the mbedtls option uses the path to STAGING_DIR_TARGET to find the mbedtls library.

When installed, the curl-config and libcurl.pc will still need the the flag '--with-mbedtls', but not with the path. Same is true for the library path flag. Thus drop the absolute paths from both files when mbedtls is enabled, and add the flag '--with-mbedtls' to the curl-config and libcurl.pc.

---
 meta/recipes-support/curl/curl_8.19.0.bb | 6 ++++--

 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-support/curl/curl_8.19.0.bb +0 -0
index b9251336b8..cc37cc934b 100644
@@ -93,13 +93,15 @@ EXTRA_OECONF = " \

 "

 fix_absolute_paths () {

meta/recipes-support/curl/curl_8.19.0.bb +1 -1
-	# cleanup buildpaths from curl-config
+	# cleanup buildpaths from curl-config and libcurl.pc

  sed -i \
      -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
      -e 's,--with-libtool-sysroot=${STAGING_DIR_TARGET},,g' \

meta/recipes-support/curl/curl_8.19.0.bb +2 -0
+	    -e 's,--with-mbedtls=${STAGING_DIR_TARGET},--with-mbedtls,g' \
+	    -e 's,-L${STAGING_DIR_TARGET},,g' \

      -e 's|${DEBUG_PREFIX_MAP}||g' \
      -e 's|${@" ".join(d.getVar("DEBUG_PREFIX_MAP").split())}||g' \

meta/recipes-support/curl/curl_8.19.0.bb +1 -1
-	    ${D}${bindir}/curl-config
+	    ${D}${bindir}/curl-config ${D}${libdir}/pkgconfig/libcurl.pc
Quoted 3 lines

 }

 do_install:append:class-target() {

In most cases we don't need to edit .pc files. I'm concerned about seeing this being added to the sed, we should fix the data coming into .pc files in the first place. I'm really happy we don't need to change many .pc files and I don't want to see us regress like this.

curl-config is a different story unfortunately but can you see if the .pc can be fixed at source please?

Thanks,

Richard

#2 lore raw

Hi Richard,

Quoted 53 lines
Quoted 5 lines

From: Ricardo Simoes <[email protected]>

When enabling mbedtls PACKAGECONFIG option, the curl-config and libcurl.pc are generated with paths to STAGE_DIR_TARGET, causing the QA check buildpaths to fail. This is due to the fact that the

mbedtls

Quoted 1 line

option uses the path to STAGING_DIR_TARGET to find the mbedtls

library.

Quoted 2 lines

When installed, the curl-config and libcurl.pc will still need the

the

Quoted 25 lines

flag '--with-mbedtls', but not with the path. Same is true for the library path flag. Thus drop the absolute paths from both files when mbedtls is enabled, and add the flag '--with-mbedtls' to the curl-config and libcurl.pc.

---
 meta/recipes-support/curl/curl_8.19.0.bb | 6 ++++--

 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-support/curl/curl_8.19.0.bb +0 -0
index b9251336b8..cc37cc934b 100644
@@ -93,13 +93,15 @@ EXTRA_OECONF = " \

 "

 fix_absolute_paths () {

meta/recipes-support/curl/curl_8.19.0.bb +1 -1
-	# cleanup buildpaths from curl-config
+	# cleanup buildpaths from curl-config and libcurl.pc

  sed -i \
      -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
      -e 's,--with-libtool-sysroot=${STAGING_DIR_TARGET},,g' \

meta/recipes-support/curl/curl_8.19.0.bb

Quoted 1 line
meta/recipes-support/curl/curl_8.19.0.bb +1 -0
+	    -e 's,--with-mbedtls=${STAGING_DIR_TARGET},--with-mbedtls,g'

\

Quoted 3 lines
meta/recipes-support/curl/curl_8.19.0.bb +1 -0
+	    -e 's,-L${STAGING_DIR_TARGET},,g' \

      -e 's|${DEBUG_PREFIX_MAP}||g' \
      -e 's|${@" ".join(d.getVar("DEBUG_PREFIX_MAP").split())}||g'

\

Quoted 5 lines
meta/recipes-support/curl/curl_8.19.0.bb +1 -1
-	    ${D}${bindir}/curl-config
+	    ${D}${bindir}/curl-config ${D}${libdir}/pkgconfig/libcurl.pc

 }

 do_install:append:class-target() {

In most cases we don't need to edit .pc files. I'm concerned about seeing this being added to the sed, we should fix the data coming into .pc files in the first place. I'm really happy we don't need to change many .pc files and I don't want to see us regress like this.

Quoted 2 lines

curl-config is a different story unfortunately but can you see if the .pc can be fixed at source please?

Thank you for looking at it and your feedback. We'll have a look at it and give it a try. So far we have zero experience with autoconf.

In case somebody with autoconf experience is reading here and would like to give a hand, help is welcome.

Cheers,
Mark

#3 lore raw
Quoted 3 lines · Mark Jonas via lists.openembedded.org

Thank you for looking at it and your feedback. We'll have a look at it and give it a try. So far we have zero experience with autoconf.

In case somebody with autoconf experience is reading here and would like to give a hand, help is welcome.

The logic here is that curl looks for a mbedtls symbol in libmbedtls.so on the default search path, and if that fails then tries again using the path it’s been given. If that succeeds then the path gets dropped into various places.

The problem is that the first symbol looked up was removed from mbedtls five years ago, so that will always fail. The same path is then used explicitly and the search succeeds, so the sysroot gets dropped into various places for no good reason.

Patch incoming.

Ross

#4 lore raw

Hi Ross,

Quoted 13 lines
Quoted 1 line · Mark Jonas via lists.openembedded.org

Thank you for looking at it and your feedback. We'll have a look at

it and give it a try. So far we have zero experience with autoconf.

Quoted 2 lines

In case somebody with autoconf experience is reading here and would

like to give a hand, help is welcome.

The logic here is that curl looks for a mbedtls symbol in libmbedtls.so on the default search path, and if that fails then tries again using the path it’s been given. If that succeeds then the path gets dropped into various places.

Quoted 8 lines

The problem is that the first symbol looked up was removed from mbedtls five years ago, so that will always fail. The same path is then used explicitly and the search succeeds, so the sysroot gets dropped into various places for no good reason.

Patch incoming.

Ross

Thank you very much! We had a look at your patch and can confirm that it works.

Cheers,
Mark