emcc command not found
Having a hell of a time getting emcc working on mac. Having followed and ensured that all the requirements are installed, i can't seem to get emcc to run outside of the installed folder getting a command not found.
Are these steps correct? http://webassembly.org/getting-started/developers-guide/
Hi, if you're inside emsdk folder please type:
source ./emsdk_env.sh
emcc --version
What output do you see?
source:
Adding directories to PATH:
PATH += /Users/username/Documents/GitHub/webassembly/emsdk
PATH += /Users/username/Documents/GitHub/webassembly/emsdk/clang/e1.37.22_64bit
PATH += /Users/username/Documents/GitHub/webassembly/emsdk/node/4.1.1_64bit/bin
PATH += /Users/username/Documents/GitHub/webassembly/emsdk/emscripten/1.37.22
Setting environment variables:
EMSDK = /Users/username/Documents/GitHub/webassembly/emsdk
EM_CONFIG = /Users/username/.emscripten
BINARYEN_ROOT = /Users/username/Documents/GitHub/webassembly/emsdk/clang/e1.37.22_64bit/binaryen
EMSCRIPTEN = /Users/username/Documents/GitHub/webassembly/emsdk/emscripten/1.37.22
for the version I get this
emcc (Emscripten gcc/clang-like replacement) 1.37.22 (commit 024e3bb3b4d1860c46c2c887aad868db7053fe1a)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
when I do emcc -v outside that folder I get this
-bash: emcc: command not found
You always have to source ./emsdk_env.sh first in a new terminal session
ok, that makes sense now, ty
@gogoprog why do we need to that all the time in a new terminal session? it is so boring.
@hon because there is nothing set magically: your default PATH doesn't contain the emcc path so it has to be set.
But of course you can set that up once for all by automatically calling the source ./emsdk_env.sh in your session startup script. Look for .bashrc configuration if you're using bash (I guess that's the case on OsX)
@gogoprog does't source ./emsdk_env.sh set env path?
which emcc
/Users/hon/work/emsdk-portable/emscripten/incoming/emcc
and the '/Users/hon/work/emsdk-portable/emscripten/incoming/emcc' is already set into $PATH (in .zshrc file)
but it does't work...
PATH contains directories instead of file paths.
After source ./emsdk_env.sh type echo $PATH to see how it's populated.
@hon yes source ./emsdk_env.sh will set the PATH.
How is it set in your .zshrc file?
@gogoprog
➜ emsdk-portable echo $PATH
./node_modules/.bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/hon/work/go/bin:/usr/local/go/bin:/usr/local/nginx/sbin:/Users/hon/.cargo/bin:/Users/hon/Library/Android/sdk/build-tools/23.0.1:/Users/hon/rust/src:/Users/hon/Library/Android/sdk/tools:/Users/hon/Library/Android/sdk/platform-tools:/usr/local/bin:/usr/include/libxml2/:/Users/hon/work/emsdk-portable:/Users/hon/work/emsdk-portable/clang/fastcomp/build_incoming_64/bin:/User/hon/work/emsdk-portable/emscripten/incoming:/Users/hon/work/emsdk-portable/emscripten/incoming/emcc
➜ emsdk-portable emcc
zsh: command not found: emcc
➜ emsdk-portable
the binary file is set in $PATH, but can not work.
@hon You should add /Users/hon/work/emsdk-portable/emscripten/incoming/ to the PATH as a folder what contains emcc, not a full path to emcc.
Also you better just do the following in your .zshrc:
pushd path/to/emsdk
source ./emsdk_env.sh
popd
So the PATH will be correctly set
@asRIA folder /Users/hon/work/emsdk-portable/emscripten/incoming/ is alreay in $PATH @gogoprog I add the commands, but I need to type the following command in every new session:
. ~/.zshrc
what I wondering now is: the function of env path is make some binary file can be executed everywhere in the system, with out type the full path. since the path was in the $PATH, why can't it be executed? Sorry for so many questions. I never met the situation before(I have to source .sh file every time to make some command work).
Maybe you don't use ZSH, but the regular bash? Can you type ps -p $$ and check the output?
If it's a bash, then it's needed to change .bashrc file
@asRIA
➜ emscripten ps -p $$
PID TTY TIME CMD
33664 ttys001 0:00.58 -zsh
Hm.. Interesting. Last call: in .zshrc please just leave:
. /Users/hon/work/emsdk-portable/emsdk_env.sh
Now it works, but every time in a new session, the console outputs:
Last login: Tue Oct 24 17:03:49 on ttys004
~/work/emsdk-portable ~
Adding directories to PATH:
PATH += /Users/hon/work/emsdk-portable/node/4.1.1_64bit/bin
PATH += /Users/hon/work/emsdk-portable/emscripten/incoming
Setting environment variables:
EMSDK = /Users/hon/work/emsdk-portable
EM_CONFIG = /Users/hon/.emscripten
EMSCRIPTEN = /Users/hon/work/emsdk-portable/emscripten/incoming
/Users/hon/.zshrc:popd:151: directory stack empty
➜ ~
If you use the absolute path and . the popd and pushd commands aren't needed.
ok, ty~
I have same issue, did everything but not able to fix it tonight.