Looks like an emsdk bug.  Would you mind filing an issue here:
https://github.com/emscripten-core/emsdk/issues

On Mon, Jan 27, 2020 at 5:02 AM Benjamin Golinvaux <[email protected]> wrote:

> Hello
>
> I have build script that I call like that:
>
> ./build.sh RelWithDebInfo
>
> Inside this script, I source the emsdk_env.sh file like that:
>
> cd $somewhere
> source ./emsdk_env.sh
>
> then, below, I am using
>
> emconfigure cmake .....
>
> I noticed that it stopped working a few releases ago (emconfigure not
> found).
>
> And, indeed, my PATH variable (I am using Ubuntu 16 in WSL) was not
> updated inside my script.
>
> I inserted debug logs and I traced the problem to this (in emsdk_env.sh):
>
> ./emsdk construct_env "$@" $tmpfile
>
> and this (around line 2645 in 1.38.41 in emsdk):
>
>   elif cmd == 'construct_env':
>     if len(sys.argv) == 2:
>       outfile = EMSDK_SET_ENV
>       silentremove(EMSDK_SET_ENV) # Clean up old temp file up front, in
> case of failure later before we get to write out the new one.
>     else:
>       outfile = sys.argv[2]
>
> The thing is, when I source emsdk_env.sh without arguments, "$@" is not
> empty, *but contains the list of arguments from my build.sh script!*
>
> So, the following line
>
> ./emsdk construct_env "$@" $tmpfile
>
> becomes equivalent to
>
> ./emsdk construct_env "RelWithDebInfo" $tmpfile
>
> and, since the Python code does special processing when len(sys.argv) != 2,
> the outfile where the EXPORT statements are written is* not* the correct
> one (which is $tmpFile)
>
> This causes the environment setup script to be written to a file called 
> RelWithDebInfo
> that is not called at all.
>
> The workaround is to use
>
> source ./emsdk_env.sh ""
>
> when sourcing the EMSDK env file.
>
> I am not sure there is a solution, but maybe having a separate
> emsdk_env_src.sh file meant to be sourced and that uses no arguments
> would be a good idea (just my $0.02)
>
> In case someone wastes time on this as I did, I thought it'd be
> interesting to share...
>
> Thanks for your attention :)
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/85eac63b-f49d-4ea6-bb25-d26d04e7c032%40googlegroups.com
> <https://groups.google.com/d/msgid/emscripten-discuss/85eac63b-f49d-4ea6-bb25-d26d04e7c032%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAL_va28FnaXbEDdjqH0HqEOL551YwG_Sd3sBWDeCrwDWDcevkw%40mail.gmail.com.

Reply via email to