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 :)