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

nRF Connect SDK installation dependence on bash vs zsh impedes use on macOS

I've been attempting to install nRF Connect SDK with both the SEGGER Embedded Studio and VS Code IDEs on and off for several months now.  These attempts have included automatic installation using various versions of the nRF Connect App and the Toolchan Manager (for both IDEs) and manual installation (for SES).  All attempts ended with some error that proved to be a rathole, a waste of effort.  (You can get a feel for this by looking at the tickets I've submitted.). All of these errors are some sort of configuration error and west appears to be involved in some way.

Digging into the detailed west installation instructions, I've found that it requires shell completion, which is only implemented for the bash shell.  Herein lies a problem for all recent-macOS users, where zsh is the default shell. Therefore, shell completion for west setup fails on Macs and the configuration is incomplete (e.g., the environment variables for west are never set, etc.). Many confusing errors then ensue when attempting to use the IDE.

I suspect the following are possible solutions:

  1. Port west-completion.bash to zsh and update the instructions
  2. Provide a set of instructions for manually accomplishing what the west-completion.bash does
  3. Point me at a complete description of the environment west expects (e.g., environment variables, directory and file organization, etc.) so I can configure it manually.

Comments?  Suggestions?  I'm surprised that anyone has succeeded in getting nRF Connect SDK working on the Mac, or is everyone a more clever bash and zsh programmer than I am Wink

TIA,

Mike (who's especially looking forward to experimenting with the VS Code version of the toolchain)

Parents
  • As I suspected, digging into bash shell scripting a bit, I confirmed that:

    1. I can execute a bash script from within a zsh instance by:
      1. Including the following first line in the bash script file: #!/usr/bin/env bash
      2. Executing the script file: ./myscript.sh
    2. Presumably the bash script will contain settings for environment variables, which will have effect in that shell and child shells, but not in the parent zsh shell.
    3. In order to affect the zsh environment, I need to execute the bash script file with source, as in: source my script.sh

    So, to update my post above, it's not that a bash script can't be executed from a zsh shell, but that there's something different in its effect.  I'll continue debugging the NCS in VS Code process at this point.

    Thanks for your attention.  Hope this helps,

    Mike

    PS: I should mention that I also attempted the NCS in VS Code using Toolchain Manager in Windows 10.  Ran into the same error, i.e., west wasn't properly configured and issued a "build" not a legal command when invoked while trying to build the Blinky sample.  So this difficulty isn't limited to macOS.

  • OK,  did some more testing.  In particular, did a manual installation of nRF Connect SDK on macOS to see if I could use that to verify the correct setup of west.  Learned:

    1. The issue isn't bash vs zsh so much (since "source bash_script-file.sh" can be used)
    2. Rather it's the proper configuration of west environment variables and activation of the correct west workspace.
    3. What that is is confusing from the current documentation:
      1. The video clips for installing nRF Connect SDK in VS Code aren't helpful.  They presume the automated process invoked by Toolchain Manager just works and doesn't specify the proper west setup.
      2. The manual SDK instructions aren't much help here.  They start by referring to the Zephyr installation.
      3. Both of these refer to different locations for the Zephyr folder.
    4. In my case, I discovered that I had multiple Zephyr installations in different places, accumulated over several months of attempted nRF Connect SDK installations.
    5. I did succeed with the manual installation far enough to get beyond the previous "build is not a legal west command" error, but whether I have the correct workspace is in doubt.

    So I have a request: Given the directory structure contemplated in the VS Code/nRF Connect SDK installation:

    • ncs
      • ,west
      • bootloader
      • mbedtls
      • ...
      • VS_Apps
      • zephyr

    What are the appropriate values for the following:

    • Environment variable ZEPHYR_TOOLCHAIN_VARIANT
    • Environment variable ZPROFILETEST

    • Any other relevant environment variables (ZSHRCTEST?, etc.) necessary for proper operation of west.
    • west manifest --path

    TIA,

    Mike

  • Hi,
    Sorry for the late answer, I was hoping I could get into office to test the installation on the mac there, but I am afraid I was not able to do that this week.

    Regardless, you have been following the description we have here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_installing.html#, right? But are ending up with problems when using both macOS and Win10?

  • Yes, at least on the latest attempt.

    I note that this version is labeled "nRF Connect 1.7.99", where "1.7.99" is not a release tag in the SDK repo.  I'm presuming this description refers to latest (master?) up-to-date/pre-release version of the SDK so should be the latest documentation as well.

    Yes, ran into problems on both macOS and Win10 (running in a Parallels Desktop VM on my MacBook Pro).

    At this point you could help me debug my configuration myself (without you having to do any tests) by telling me:

    • How to validate my west installation?
    • What environment variables are expected in a proper west execution environment?

    Thanks for getting back to me,

    Mie

  • Hi,

    Yes, .99 is the master / working branch. Tags are the released versions.

    Can you specify which error messages you are getting? Are you able to start vs code from the toolchain manager? is vs code able to start west etc? Are you using a m1 based mac or an intel based mac? mac os version?

Reply
  • Hi,

    Yes, .99 is the master / working branch. Tags are the released versions.

    Can you specify which error messages you are getting? Are you able to start vs code from the toolchain manager? is vs code able to start west etc? Are you using a m1 based mac or an intel based mac? mac os version?

Children
  • Looks like I may have found a workaround (or solution) for this problem.  If I scrub my system:

    • Uninstall west and all fragments of prior west installations (I had several),
    • Remove all Nordic SDK, toolchain, etc., files and directories, and
    • Ensure that I have the latest versions of the following installed:
      • macOS Monterey 12.1 Beta (21C5039b), the latest developer release
      • nRF Connect for Desktop 3.9.1
      • Toolchain Manager plug-in official v0.10.1
      • asdf virtual environment manager with Python 3.10.0, such that "python -V" ==> Python 3.10.0
      • pip 21.3.1

    then I can successfully install the SDK, along with both SES and VS Code IDE's using the "automatic" procedures invoked from Toolchain Manager.

    Two notes:

    1. I still get a failure when trying to update the toolchain using the command in the SDK button  (see the screenshot below).
    2. I've now been able to install both the SES and VS Code IDEs, allowing me to proceed far enough with the latter to encounter a crashing bug.  See my new ticket here

    So, we could probably close this ticket.  But I highly recommend you insert a warning In the documentation for nRF Connect SDK installation to make sure the user has a clean system before attemptng an installation.

    Hope this helps,

    Mike

Related