All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] toolchain-shar-extract: compare SDK and host gcc versions
@ 2017-01-25 13:18 Ed Bartosh
  2017-10-05 17:43 ` Mark Hatle
  0 siblings, 1 reply; 3+ messages in thread
From: Ed Bartosh @ 2017-01-25 13:18 UTC (permalink / raw)
  To: openembedded-core

If ext sdk is built by gcc version higher than host gcc version
and host gcc version is 4.8 or 4.9 the installation is known to
fail due to the way uninative sstate package is built.

It's a known issue and we don't have a way to fix it for above
mentioned combinations of build and host gcc versions.

Detected non-installable combinations of gcc versions and
print an installation error.

[YOCTO #10881]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 meta/classes/populate_sdk_base.bbclass | 1 +
 meta/files/toolchain-shar-extract.sh   | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
index 5ad08c6..588a3cb 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -226,6 +226,7 @@ EOF
 		-e 's#@SDK_VERSION@#${SDK_VERSION}#g' \
 		-e '/@SDK_PRE_INSTALL_COMMAND@/d' \
 		-e '/@SDK_POST_INSTALL_COMMAND@/d' \
+		-e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d)}#g' \
 		${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
 
 	# add execution permission
diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 9295ddc..3f54c96 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -11,6 +11,9 @@ export PATH=`echo "$PATH" | sed -e 's/:\.//' -e 's/::/:/'`
 INST_ARCH=$(uname -m | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")
 SDK_ARCH=$(echo @SDK_ARCH@ | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")
 
+INST_GCC_VER=$(gcc --version | sed -ne 's/.* \([0-9]\+\.[0-9]\+\)\.[0-9]\+.*/\1/p')
+SDK_GCC_VER='@SDK_GCC_VER@'
+
 verlte () {
 	[  "$1" = "`printf "$1\n$2" | sort -V | head -n1`" ]
 }
@@ -112,6 +115,11 @@ fi
 # SDK_EXTENSIBLE is exposed from the SDK_PRE_INSTALL_COMMAND above
 if [ "$SDK_EXTENSIBLE" = "1" ]; then
 	DEFAULT_INSTALL_DIR="@SDKEXTPATH@"
+	if [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '4.9' ] || [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '' ] || \
+		[ "$INST_GCC_VER" = '4.9' -a "$SDK_GCC_VER" = '' ]; then
+		echo "Error: Incompatible SDK installer! Your host gcc version is $INST_GCC_VER and this SDK was built by gcc higher version."
+		exit 1
+	fi
 fi
 
 if [ "$target_sdk_dir" = "" ]; then
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] toolchain-shar-extract: compare SDK and host gcc versions
  2017-01-25 13:18 [PATCH] toolchain-shar-extract: compare SDK and host gcc versions Ed Bartosh
@ 2017-10-05 17:43 ` Mark Hatle
  2017-10-07  2:35   ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Hatle @ 2017-10-05 17:43 UTC (permalink / raw)
  To: Ed Bartosh, openembedded-core

I realize this reply is months after the original email.  But I think I found a
bug with the implementation.  See below inline.

On 1/25/17 7:18 AM, Ed Bartosh wrote:
> If ext sdk is built by gcc version higher than host gcc version
> and host gcc version is 4.8 or 4.9 the installation is known to
> fail due to the way uninative sstate package is built.
> 
> It's a known issue and we don't have a way to fix it for above
> mentioned combinations of build and host gcc versions.
> 
> Detected non-installable combinations of gcc versions and
> print an installation error.
> 
> [YOCTO #10881]
> 
> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> ---
>  meta/classes/populate_sdk_base.bbclass | 1 +
>  meta/files/toolchain-shar-extract.sh   | 8 ++++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
> index 5ad08c6..588a3cb 100644
> --- a/meta/classes/populate_sdk_base.bbclass
> +++ b/meta/classes/populate_sdk_base.bbclass
> @@ -226,6 +226,7 @@ EOF
>  		-e 's#@SDK_VERSION@#${SDK_VERSION}#g' \
>  		-e '/@SDK_PRE_INSTALL_COMMAND@/d' \
>  		-e '/@SDK_POST_INSTALL_COMMAND@/d' \
> +		-e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d)}#g' \

The return value from "oe.utils.host_gcc_version(d)" includes a leading '-'...

>  		${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
>  
>  	# add execution permission
> diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
> index 9295ddc..3f54c96 100644
> --- a/meta/files/toolchain-shar-extract.sh
> +++ b/meta/files/toolchain-shar-extract.sh
> @@ -11,6 +11,9 @@ export PATH=`echo "$PATH" | sed -e 's/:\.//' -e 's/::/:/'`
>  INST_ARCH=$(uname -m | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")
>  SDK_ARCH=$(echo @SDK_ARCH@ | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")
>  
> +INST_GCC_VER=$(gcc --version | sed -ne 's/.* \([0-9]\+\.[0-9]\+\)\.[0-9]\+.*/\1/p')

The item above fails with the message:

line 28: gcc: command not found

If the host does not have gcc on it.  (I realize this is incredibly rare
situation, but is valid in some cases.)  It might be a good idea to catch this
and put up a warning or otherwise clean up the error situation.

> +SDK_GCC_VER='@SDK_GCC_VER@'
> +

So based on the above you will end up with:

INST_GCC_VER="4.8"
SDK_GCC_VER="-4.9"

>  verlte () {
>  	[  "$1" = "`printf "$1\n$2" | sort -V | head -n1`" ]
>  }
> @@ -112,6 +115,11 @@ fi
>  # SDK_EXTENSIBLE is exposed from the SDK_PRE_INSTALL_COMMAND above
>  if [ "$SDK_EXTENSIBLE" = "1" ]; then
>  	DEFAULT_INSTALL_DIR="@SDKEXTPATH@"
> +	if [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '4.9' ] || [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '' ] || \
> +		[ "$INST_GCC_VER" = '4.9' -a "$SDK_GCC_VER" = '' ]; then

The comparisons above do not include the leading '-', so it would appear to me
that the checked would never end up being true -- and thus the error below would
never happen.

Am I seeing what is happening right?  If so, we'll need to get this fixed...

--Mark


> +		echo "Error: Incompatible SDK installer! Your host gcc version is $INST_GCC_VER and this SDK was built by gcc higher version."
> +		exit 1
> +	fi
>  fi
>  
>  if [ "$target_sdk_dir" = "" ]; then
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] toolchain-shar-extract: compare SDK and host gcc versions
  2017-10-05 17:43 ` Mark Hatle
@ 2017-10-07  2:35   ` Khem Raj
  0 siblings, 0 replies; 3+ messages in thread
From: Khem Raj @ 2017-10-07  2:35 UTC (permalink / raw)
  To: Mark Hatle; +Cc: Patches and discussions about the oe-core layer

On Thu, Oct 5, 2017 at 10:43 AM, Mark Hatle <mark.hatle@windriver.com> wrote:
> I realize this reply is months after the original email.  But I think I found a
> bug with the implementation.  See below inline.
>
> On 1/25/17 7:18 AM, Ed Bartosh wrote:
>> If ext sdk is built by gcc version higher than host gcc version
>> and host gcc version is 4.8 or 4.9 the installation is known to
>> fail due to the way uninative sstate package is built.
>>
>> It's a known issue and we don't have a way to fix it for above
>> mentioned combinations of build and host gcc versions.
>>
>> Detected non-installable combinations of gcc versions and
>> print an installation error.
>>
>> [YOCTO #10881]
>>
>> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
>> ---
>>  meta/classes/populate_sdk_base.bbclass | 1 +
>>  meta/files/toolchain-shar-extract.sh   | 8 ++++++++
>>  2 files changed, 9 insertions(+)
>>
>> diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass
>> index 5ad08c6..588a3cb 100644
>> --- a/meta/classes/populate_sdk_base.bbclass
>> +++ b/meta/classes/populate_sdk_base.bbclass
>> @@ -226,6 +226,7 @@ EOF
>>               -e 's#@SDK_VERSION@#${SDK_VERSION}#g' \
>>               -e '/@SDK_PRE_INSTALL_COMMAND@/d' \
>>               -e '/@SDK_POST_INSTALL_COMMAND@/d' \
>> +             -e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d)}#g' \
>
> The return value from "oe.utils.host_gcc_version(d)" includes a leading '-'...
>
>>               ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.sh
>>
>>       # add execution permission
>> diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
>> index 9295ddc..3f54c96 100644
>> --- a/meta/files/toolchain-shar-extract.sh
>> +++ b/meta/files/toolchain-shar-extract.sh
>> @@ -11,6 +11,9 @@ export PATH=`echo "$PATH" | sed -e 's/:\.//' -e 's/::/:/'`
>>  INST_ARCH=$(uname -m | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")
>>  SDK_ARCH=$(echo @SDK_ARCH@ | sed -e "s/i[3-6]86/ix86/" -e "s/x86[-_]64/x86_64/")
>>
>> +INST_GCC_VER=$(gcc --version | sed -ne 's/.* \([0-9]\+\.[0-9]\+\)\.[0-9]\+.*/\1/p')
>
> The item above fails with the message:
>
> line 28: gcc: command not found
>
> If the host does not have gcc on it.  (I realize this is incredibly rare
> situation, but is valid in some cases.)  It might be a good idea to catch this
> and put up a warning or otherwise clean up the error situation.
>

I think if we need gcc then we should sanitize the installer to check-before-use
so end user gets a good error message.


>> +SDK_GCC_VER='@SDK_GCC_VER@'
>> +
>
> So based on the above you will end up with:
>
> INST_GCC_VER="4.8"
> SDK_GCC_VER="-4.9"
>
>>  verlte () {
>>       [  "$1" = "`printf "$1\n$2" | sort -V | head -n1`" ]
>>  }
>> @@ -112,6 +115,11 @@ fi
>>  # SDK_EXTENSIBLE is exposed from the SDK_PRE_INSTALL_COMMAND above
>>  if [ "$SDK_EXTENSIBLE" = "1" ]; then
>>       DEFAULT_INSTALL_DIR="@SDKEXTPATH@"
>> +     if [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '4.9' ] || [ "$INST_GCC_VER" = '4.8' -a "$SDK_GCC_VER" = '' ] || \
>> +             [ "$INST_GCC_VER" = '4.9' -a "$SDK_GCC_VER" = '' ]; then
>
> The comparisons above do not include the leading '-', so it would appear to me
> that the checked would never end up being true -- and thus the error below would
> never happen.
>
> Am I seeing what is happening right?  If so, we'll need to get this fixed...
>
> --Mark
>
>
>> +             echo "Error: Incompatible SDK installer! Your host gcc version is $INST_GCC_VER and this SDK was built by gcc higher version."
>> +             exit 1
>> +     fi
>>  fi
>>
>>  if [ "$target_sdk_dir" = "" ]; then
>>
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-07  2:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-25 13:18 [PATCH] toolchain-shar-extract: compare SDK and host gcc versions Ed Bartosh
2017-10-05 17:43 ` Mark Hatle
2017-10-07  2:35   ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.