diff mbox

toolchain-scripts: add check for LD_LIBRARY_PATH in the SDK env setup script

Message ID 1497553789-126570-1-git-send-email-denis@denix.org
State New
Headers show

Commit Message

Denys Dmytriyenko June 15, 2017, 7:09 p.m. UTC
From: Denys Dmytriyenko <denys@ti.com>


Provide a descriptive error message and exit the environment-setup script,
when LD_LIBRARY_PATH is set on the host system.

Signed-off-by: Denys Dmytriyenko <denys@ti.com>

---
 meta/classes/toolchain-scripts.bbclass | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

-- 
2.7.4

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Denys Dmytriyenko June 23, 2017, 5:33 p.m. UTC | #1
Ping.

On Thu, Jun 15, 2017 at 03:09:49PM -0400, Denys Dmytriyenko wrote:
> From: Denys Dmytriyenko <denys@ti.com>

> 

> Provide a descriptive error message and exit the environment-setup script,

> when LD_LIBRARY_PATH is set on the host system.

> 

> Signed-off-by: Denys Dmytriyenko <denys@ti.com>

> ---

>  meta/classes/toolchain-scripts.bbclass | 15 +++++++++++++++

>  1 file changed, 15 insertions(+)

> 

> diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass

> index 260ece9..ef7b26f 100644

> --- a/meta/classes/toolchain-scripts.bbclass

> +++ b/meta/classes/toolchain-scripts.bbclass

> @@ -25,6 +25,21 @@ toolchain_create_sdk_env_script () {

>  	script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-$multimach_target_sys}

>  	rm -f $script

>  	touch $script

> +

> +	echo '# Check for LD_LIBRARY_PATH being set, which can break SDK and generally is a bad practice' >> $script

> +	echo '# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80' >> $script

> +	echo '# http://xahlee.info/UnixResource_dir/_/ldpath.html' >> $script

> +	echo '# Only disable this check if you are absolutely know what you are doing!' >> $script

> +	echo 'if [ ! -z "$LD_LIBRARY_PATH" ]; then' >> $script

> +	echo "    echo \"Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'\"" >> $script

> +	echo "    echo \"but please check why this was set in the first place and that it's safe to unset.\"" >> $script

> +	echo '    echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set."' >> $script

> +	echo '    echo "For more references see:"' >> $script

> +	echo '    echo "  http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80"' >> $script

> +	echo '    echo "  http://xahlee.info/UnixResource_dir/_/ldpath.html"' >> $script

> +	echo '    return 1' >> $script

> +	echo 'fi' >> $script

> +

>  	echo 'export SDKTARGETSYSROOT='"$sysroot" >> $script

>  	EXTRAPATH=""

>  	for i in ${CANADIANEXTRAOS}; do

> -- 

> 2.7.4

> 

> -- 

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Ross Burton June 26, 2017, 9:56 a.m. UTC | #2
On 23 June 2017 at 18:33, Denys Dmytriyenko <denis@denix.org> wrote:

> Ping

>


This has been in mut for a while, should be in soon.

Ross
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox

Patch

diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass
index 260ece9..ef7b26f 100644
--- a/meta/classes/toolchain-scripts.bbclass
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -25,6 +25,21 @@  toolchain_create_sdk_env_script () {
 	script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-$multimach_target_sys}
 	rm -f $script
 	touch $script
+
+	echo '# Check for LD_LIBRARY_PATH being set, which can break SDK and generally is a bad practice' >> $script
+	echo '# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80' >> $script
+	echo '# http://xahlee.info/UnixResource_dir/_/ldpath.html' >> $script
+	echo '# Only disable this check if you are absolutely know what you are doing!' >> $script
+	echo 'if [ ! -z "$LD_LIBRARY_PATH" ]; then' >> $script
+	echo "    echo \"Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'\"" >> $script
+	echo "    echo \"but please check why this was set in the first place and that it's safe to unset.\"" >> $script
+	echo '    echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set."' >> $script
+	echo '    echo "For more references see:"' >> $script
+	echo '    echo "  http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80"' >> $script
+	echo '    echo "  http://xahlee.info/UnixResource_dir/_/ldpath.html"' >> $script
+	echo '    return 1' >> $script
+	echo 'fi' >> $script
+
 	echo 'export SDKTARGETSYSROOT='"$sysroot" >> $script
 	EXTRAPATH=""
 	for i in ${CANADIANEXTRAOS}; do