This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

entering command-line environment

Hi,

I've installed the nRF Connect SDK, and want to bring up a command-line build environment.

I'm able to do it as it says in the instructions here: Bring up the Toolchain Manager and use the "Open Bash" option from the drop-down menu.

However, I'd like to be able to get into the environment without bringing up the Toolchain Manager. What do I do? What script do I run from git-bash?

I tried running zephyr/zephyr-env.sh, but apparently that's not enough.

Thanks!

Parents
  • Hi,

    I think we're getting closer.

    Some good news: I tried it out on Windows command prompt (not Power Shell), and found that after just running env.cmd, I could run west and build an example with it!

    As for Git Bash:

    To the steps I described before, I added:

    export PATH=$PATH:`pwd`/toolchain/opt/bin:`pwd`/toolchain/opt/bin/Scripts

    Now if I execute "which west", I get (correctly):

    /c/Users/yaron.shragai/ncs/v1.9.1/toolchain/opt/bin/Scripts/west

    But if I try to run west, regardless of options, it just returns without doing anything and with no screen output.

    By the way: It looks like the Git Bash environment spawned by the Toolchain Manager sets the root dir (the "/" dir) to the SDK's directory. In my setup, the root dir is still Git Bash's default root dir (which is C:\Program Files\Git). I tried to search the web for how to change Git Bash's root dir, but came up empty; but that is clearly something that the Toolchain Manager does when it spawns a Bash shell - so if you can tell me how to do that, it just might resolve this.

    And as for Windows Power Shell:

    After executing env.cmd, I navigated to the toolchain\opt\bin dir and executed:

    $env:path += ";" + $pwd

    Then I navigated down to Scripts and did the same.

    I verified that $env:path now includes those dirs.

    When I executed west, I got:

    Traceback (most recent call last):
    File "C:\Users\yaron.shragai\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
    File "C:\Users\yaron.shragai\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
    File "C:\Users\yaron.shragai\ncs\v1.9.1\toolchain\opt\bin\Scripts\west.exe\__main__.py", line 4, in <module>
    ModuleNotFoundError: No module named 'west'

    So, it seems like west.exe is trying to set off some Python code which is not working.

  • Hi,

    When you open bash or command prompt using the buttons in the Toolchain Manager you are actually just running the files git-bash.exe or git-cmd.cmd located in the toolchain folder. What these do is to set up the environment correctly before running bash and command prompt. You can see that by opening git-cmd.cmd and cmd/env.cmd in a text editor. So the issue is not the root dir, but that the environment variables are not correctly set. If you do not run env.cmd you need to make sure that all environment variables set by that file is set in your path instead.

    As for Windows Power Shell it seems like it is using the incorrect Python path. I should have mentioned in my last reply that you will also need to add the correct Python path to your environment variables. You can also find this in env.cmd.

    Best regards,

    Marte

Reply
  • Hi,

    When you open bash or command prompt using the buttons in the Toolchain Manager you are actually just running the files git-bash.exe or git-cmd.cmd located in the toolchain folder. What these do is to set up the environment correctly before running bash and command prompt. You can see that by opening git-cmd.cmd and cmd/env.cmd in a text editor. So the issue is not the root dir, but that the environment variables are not correctly set. If you do not run env.cmd you need to make sure that all environment variables set by that file is set in your path instead.

    As for Windows Power Shell it seems like it is using the incorrect Python path. I should have mentioned in my last reply that you will also need to add the correct Python path to your environment variables. You can also find this in env.cmd.

    Best regards,

    Marte

Children
No Data
Related