Skip to contentSkip to conversation

toolchain-scripts.bbclass: also recognize ${SDK_SYS} env setups

PATCH In review Jens Rehsack 2 participants 6 messages Jul 24, 2020 – Aug 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 toolchain-scripts.bbclass: also recognize ${SDK_SYS} env setups

Instead of recognizing only environment-setup scripts in ${STAGING_DIR_TARGET} or ${STAGING_DIR_NATIVE}, respectively - lurk also into ${SDKPATH}/buildtools/sysroots/${SDK_SYS} where nativesdk-openssl installs setup files.

---
 meta/classes/toolchain-scripts.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
meta/classes/toolchain-scripts.bbclass +5 -0
index db1d3215ef..e3959e21e8 100644
@@ -119,6 +119,11 @@ if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
 	    . \$envfile
     done
 fi
+if [ -d "${SDKPATH}/buildtools/sysroots/${SDK_SYS}/environment-setup.d" ]; then
+    for envfile in ${SDKPATH}/buildtools/sysroots/${SDK_SYS}/environment-setup.d/*.sh; do
+	    . \$envfile
+    done
+fi
 EOF
 }
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/2 buildtools-tarball: eliminate overwtiting OPENSSL_CONF

Remove overwriting of OPENSSL_CONF from buildtools-tarball.bb to clarify whether nativesdk-openssl installs wrong content or buildtools-tarball:

    (nativesdk-openssl) tmp/sysroots/x86_64/usr/lib/ssl-1.1/openssl.cnf
    (buildtools-tarball) buildtools/sysroots/x86_64-pokysdk-linux/etc/ssl/openssl.cnf
---
 meta/recipes-core/meta/buildtools-tarball.bb | 1 -
 1 file changed, 1 deletion(-)
meta/recipes-core/meta/buildtools-tarball.bb +0 -1
index d0f8dd7d7c..02e662b5cc 100644
@@ -75,7 +75,6 @@ create_sdk_files_append () {
 
 	echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
 	echo 'export SSL_CERT_FILE="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
-	echo 'export OPENSSL_CONF="${SDKPATHNATIVE}${sysconfdir}/ssl/openssl.cnf"' >>$script
 
 	if [ "${SDKMACHINE}" = "i686" ]; then
 		echo 'export NO32LIBS="0"' >>$script
Signature · 1 line
2.17.1
#2 lore raw

Re: [OE-core][PATCH v2 2/2] buildtools-tarball: eliminate overwtiting OPENSSL_CONF

Quoted 15 lines · Jens Rehsack

Remove overwriting of OPENSSL_CONF from buildtools-tarball.bb to clarify whether nativesdk-openssl installs wrong content or buildtools-tarball:

    (nativesdk-openssl) tmp/sysroots/x86_64/usr/lib/ssl-1.1/openssl.cnf
    (buildtools-tarball) buildtools/sysroots/x86_64-pokysdk-linux/etc/ssl/openssl.cnf
---
 meta/recipes-core/meta/buildtools-tarball.bb | 1 -
 1 file changed, 1 deletion(-)
meta/recipes-core/meta/buildtools-tarball.bb +0 -0
index d0f8dd7d7c..02e662b5cc 100644

meta/recipes-core/meta/buildtools-tarball.bb create_sdk_files_append () { · line 80

Quoted 7 lines
meta/recipes-core/meta/buildtools-tarball.bb +0 -1
@@ -75,7 +75,6 @@ create_sdk_files_append () {
 
 	echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
 	echo 'export SSL_CERT_FILE="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
-	echo 'export OPENSSL_CONF="${SDKPATHNATIVE}${sysconfdir}/ssl/openssl.cnf"' >>$script
 
 	if [ "${SDKMACHINE}" = "i686" ]; then
 		echo 'export NO32LIBS="0"' >>$script

I did look at this further. I don't see anywhere in buildtools-tarball that the code you add in toolchain-scripts.bbclass is actually run, it doesn't make it into the buildtools tarball.

Note the code does:

     rm -f ${SDK_OUTPUT}/${SDKPATH}/environment-setup-*
     [...]

     # Generate new (mini) sdk-environment-setup file
     script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
     touch $script

so your patch definitely breaks buildtools. I therefore don't plan to merge it.

You are right that we could add something here to source the environment.d files within OECORE_NATIVE_SYSROOT but you'd need to add that to the buildtools environment script itself.

Cheers,

Richard

#3 lore raw

Re: [OE-core][PATCH v2 2/2] buildtools-tarball: eliminate overwtiting OPENSSL_CONF

Am 28.07.2020 um 00:26 schrieb Richard Purdie <[email protected]>:

Quoted 38 lines · Jens Rehsack
Quoted 15 lines

Remove overwriting of OPENSSL_CONF from buildtools-tarball.bb to clarify whether nativesdk-openssl installs wrong content or buildtools-tarball:

   (nativesdk-openssl) tmp/sysroots/x86_64/usr/lib/ssl-1.1/openssl.cnf
   (buildtools-tarball) buildtools/sysroots/x86_64-pokysdk-linux/etc/ssl/openssl.cnf

---
meta/recipes-core/meta/buildtools-tarball.bb | 1 -

1 file changed, 1 deletion(-)
meta/recipes-core/meta/buildtools-tarball.bb +0 -0
index d0f8dd7d7c..02e662b5cc 100644

meta/recipes-core/meta/buildtools-tarball.bb create_sdk_files_append () { · line 80

Quoted 7 lines
meta/recipes-core/meta/buildtools-tarball.bb +0 -1
@@ -75,7 +75,6 @@ create_sdk_files_append () {
 
 	echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
 	echo 'export SSL_CERT_FILE="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
-	echo 'export OPENSSL_CONF="${SDKPATHNATIVE}${sysconfdir}/ssl/openssl.cnf"' >>$script
 
 	if [ "${SDKMACHINE}" = "i686" ]; then
 		echo 'export NO32LIBS="0"' >>$script

I did look at this further. I don't see anywhere in buildtools-tarball that the code you add in toolchain-scripts.bbclass is actually run, it doesn't make it into the buildtools tarball.

Note the code does:

    rm -f ${SDK_OUTPUT}/${SDKPATH}/environment-setup-*
    [...]

    # Generate new (mini) sdk-environment-setup file
    script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
    touch $script
Quoted 2 lines

so your patch definitely breaks buildtools. I therefore don't plan to merge it.

While I wouldn't argue against not merging it, I disagree the reasoning:

There is an buildtools/environment-setup-x86_64-pokysdk-linux in my created SDK which contains:

$ cat buildtools/environment-setup-x86_64-pokysdk-linux
export PATH=/home/sno/sds-lp791a-sdk/buildtools/sysroots/x86_64-pokysdk-linux/usr/bin:$PATH
#OECORE_NATIVE_SYSROOT="/home/sno/sds-lp791a-sdk/buildtools/sysroots/x86_64-pokysdk-linux"
export GIT_SSL_CAINFO="/home/sno/sds-lp791a-sdk/buildtools/sysroots/x86_64-pokysdk-linux/etc/ssl/certs/ca-certificates.crt"
export SSL_CERT_FILE="/home/sno/sds-lp791a-sdk/buildtools/sysroots/x86_64-pokysdk-linux/etc/ssl/certs/ca-certificates.crt"
export OPENSSL_CONF="/home/sno/sds-lp791a-sdk/buildtools/sysroots/x86_64-pokysdk-linux/etc/ssl/openssl.cnf"

So it's a bit weird - and deserves more investigation.

Quoted 3 lines

You are right that we could add something here to source the environment.d files within OECORE_NATIVE_SYSROOT but you'd need to add that to the buildtools environment script itself.

Maybe we can find a way so collect snippets - but I wanted to show the conflict between buildtools/environment-setup-x86_64-pokysdk-linux and buildtools/sysroots/x86_64-pokysdk-linux/environment-setup.d/openssl.sh.

$ cat buildtools/sysroots/x86_64-pokysdk-linux/environment-setup.d/openssl.sh
export OPENSSL_CONF="$OECORE_NATIVE_SYSROOT/usr/lib/ssl-1.1/openssl.cnf"

This conflict should get resolved somehow.

Quoted 3 lines

Cheers,

Richard

Cheers
--
Jens Rehsack - [email protected]

#4 lore raw
In reply to Jens Rehsack
Quoted 15 lines · Jens Rehsack

Instead of recognizing only environment-setup scripts in ${STAGING_DIR_TARGET} or ${STAGING_DIR_NATIVE}, respectively - lurk also into ${SDKPATH}/buildtools/sysroots/${SDK_SYS} where nativesdk-openssl installs setup files.

---
 meta/classes/toolchain-scripts.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
meta/classes/toolchain-scripts.bbclass +0 -0
index db1d3215ef..e3959e21e8 100644

meta/classes/toolchain-scripts.bbclass if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then · line 128

Quoted 10 lines
meta/classes/toolchain-scripts.bbclass +5 -0
@@ -119,6 +119,11 @@ if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
 	    . \$envfile
     done
 fi
+if [ -d "${SDKPATH}/buildtools/sysroots/${SDK_SYS}/environment-setup.d" ]; then
+    for envfile in ${SDKPATH}/buildtools/sysroots/${SDK_SYS}/environment-setup.d/*.sh; do
+	    . \$envfile
+    done
+fi
 EOF
 }

I finally got around to looking at this, sorry about the delay. Whilst this fixes the issue and doesn't harm anything, I think its incorrect. I suspect that $OECORE_NATIVE_SYSROOT should be pointing at ${SDKPATH}/buildtools/sysroots/${SDK_SYS}.

Could you see where $OECORE_NATIVE_SYSROOT is pointing and see if we perhaps can't fix that instead?

Cheers,

Richard

#5 lore raw
Quoted 27 lines

Am 27.07.2020 um 18:06 schrieb Richard Purdie <[email protected]>:

Quoted 22 lines · Jens Rehsack

Instead of recognizing only environment-setup scripts in ${STAGING_DIR_TARGET} or ${STAGING_DIR_NATIVE}, respectively - lurk also into ${SDKPATH}/buildtools/sysroots/${SDK_SYS} where nativesdk-openssl installs setup files.

---
meta/classes/toolchain-scripts.bbclass | 5 +++++

1 file changed, 5 insertions(+)
meta/classes/toolchain-scripts.bbclass +0 -0
index db1d3215ef..e3959e21e8 100644
@@ -119,6 +119,11 @@ if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
 	    . \$envfile
    done

fi

meta/classes/toolchain-scripts.bbclass +4 -0
+if [ -d "${SDKPATH}/buildtools/sysroots/${SDK_SYS}/environment-setup.d" ]; then
+    for envfile in ${SDKPATH}/buildtools/sysroots/${SDK_SYS}/environment-setup.d/*.sh; do
+	    . \$envfile
+    done
Quoted 8 lines
Quoted 3 lines

+fi
EOF
}

I finally got around to looking at this, sorry about the delay. Whilst this fixes the issue and doesn't harm anything, I think its incorrect. I suspect that $OECORE_NATIVE_SYSROOT should be pointing at ${SDKPATH}/buildtools/sysroots/${SDK_SYS}.

This would definitively a much better solution. Actually it's created as follows:

```
sdkpathnative=${7:-${SDKPATHNATIVE}}
echo "export OECORE_NATIVE_SYSROOT=\"$sdkpathnative\"" >> $script
```

Which is expanded (taken from bitbake -e):

# $SDKPATHNATIVE
# set /home/sno/gpw-community-bsp/sources/poky/meta/conf/bitbake.conf:424
# "${SDKPATH}/sysroots/${SDK_SYS}"
SDKPATHNATIVE="/opt/gpw/1.0.0/sysroots/x86_64-pokysdk-linux"

And it's updates after installing the SDK to:
export OECORE_NATIVE_SYSROOT="/home/sno/sds-lp791a-sdk/tmp/sysroots/x86_64"

Quoted 2 lines

Could you see where $OECORE_NATIVE_SYSROOT is pointing and see if we perhaps can't fix that instead?

Any suggestions?

Cheers
--
Jens Rehsack - [email protected]