17 Replies Latest reply on Jul 15, 2019 3:40 AM by ilg

    Using XPM in Ubuntu

    kylobeetle

      Hello again, My two friends and I decided to use Ubuntu as working environment. So like I did in Windows, I proceeded to install the nodejs and then install xpm, which was successfully. but when I tried to install "xpm install --global @gnu-mcu-eclipse/arm-none-eabi-gcc" in the terminal I got :

       

      sudo xpm install --global @gnu-mcu-eclipse/arm-none-eabi-gcc --force

      xPack manager - install package(s)

       

       

      Processing @gnu-mcu-eclipse/arm-none-eabi-gcc@8.2.1-1.4.1...

      Removing existing package from '/home/kylo/opt/xPacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.4.1'...

      Installing globally in '/home/kylo/opt/xPacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.4.1'...

      Extracting 'gnu-mcu-eclipse-arm-none-eabi-gcc-8.2.1-1.4-20190214-0604-centos64.tgz'...

      3243 files extracted.

       

       

      'xpm install' completed in 12.944 sec.

       

       

      I used force because when using the command normally I still get the same issue , and the issue is that the folder is empty, only some text files, and not the bin folder and the rest. for any reason something is preventing  the extracted files to be placed in that directory, am I missing something ??

       

      thanks in advance

      Alex

        • Re: Using XPM in Ubuntu
          ilg

          There is nothing wrong and you do not need sudo, the toolchain is in a folder named .content.

          1 of 1 people found this helpful
            • Re: Using XPM in Ubuntu
              kylobeetle

              Hello again Mr. Liviu, My question is because in the tutorial I have this :

               

              This method uses the portable tool xpm, the xPack Package Manager, and can be used on Windows, macOS and GNU/Linux.

               

              $ xpm install --global @gnu-mcu-eclipse/arm-none-eabi-gcc 

               

              This will always install the latest available version, in the central xPacks repository, which is a platform dependent folder in the user home:

              • Windows: %APPDATA%\xPacks (or %userprofile%\AppData\Roaming\xPacks, like C:\Users\ilg\AppData\Roaming\xPacks)
              • macOS: ${HOME}/Library/xPacks
              • GNU/Linux: ${HOME}/opt/xPacks

              This location is also known by Eclipse, so it can automatically identify the installed toolchains.

               

               

              So later they show a way to test it :

               

              $ "${HOME}"/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1-20180401-0515/bin/arm-none-eabi-gcc --version

               

              Actually I know that version is old compared to the new one, but after the folder which contain the version on its name, the folder only shows some txt files but there is not the folder "bin", even the whole directory only weights 19kb or something.

               

              Thanks in advance.

              Alex

              1 of 1 people found this helpful
                • Re: Using XPM in Ubuntu
                  ilg

                  This is a misunderstanding.

                   

                  The documentation presents two methods to install the toolchain, "The xPack install" and "Manual install".

                   

                  The command you refer to (to test the toolchain) is in the "Manual install" section, and does not apply to "The xPack install", since the folders are different.

                   

                  When you install via xpm, things are fully automated, xpm first downloads the package.json and few other text files, then gets the large archive (that otherwise you have to manually download), and places its content in a folder named .content, that you probably do not see unless you instruct your file explorer to show dot files.

                   

                  If the wording in the documentation page is difficult to understand, please point where the problem is and possibly suggest a better one.

                  1 of 1 people found this helpful
                    • Re: Using XPM in Ubuntu
                      kylobeetle

                      Thanks for your kind reply... This will save me a lot of troubles from now. You excuse me if I missed this point, but would be good (if not already there) any note explaining that the xpm method is very different from manual installing. Also if possible, a way to test when xpm installs, to make sure we are in the correct path. If is that the case, I will proceed with the rest of the instructions until Im ready to run any test on my MCU, which I already have with me. For now, I will be working with ST LINK V2 until I get to work with the J-link. baby steps, you know..

                       

                      Alex

                        • Re: Using XPM in Ubuntu
                          ilg

                          I added some details mentioning the different folders.

                          1 of 1 people found this helpful
                            • Re: Using XPM in Ubuntu
                              valpoli

                              Hi Liviu,

                              I have installed:

                              npm -v

                              3.5.2

                              Then installed xpm:

                              sudo npm install --global xpm

                              But then xpm shows message with even simple command:

                              xpm -v

                              /home/. . ./opt/npm/lib/node_modules/xpm/node_modules/@ilg/cli-start-options/lib/cli-application.js:150

                                static async start () {

                                             ^^^^^

                              SyntaxError: Unexpected identifier

                                  at exports.runInThisContext (vm.js:53:16)

                                  at Module._compile (module.js:374:25)

                                  at Object.Module._extensions..js (module.js:417:10)

                                  at Module.load (module.js:344:32)

                                  at Function.Module._load (module.js:301:12)

                                  at Module.require (module.js:354:17)

                                  at require (internal/module.js:12:17)

                                  at Object.<anonymous> (/home/. . ./opt/npm/lib/node_modules/xpm/node_modules/@ilg/cli-start-options/index.js:55:24)

                                  at Module._compile (module.js:410:26)

                                  at Object.Module._extensions..js (module.js:417:10)

                              I need to install:

                              arm-none-eabi-gcc

                              to be able to work with:

                              Could you please advise.

                                • Re: Using XPM in Ubuntu
                                  ilg

                                  your npm is way too old.

                                   

                                  please follow the instructions in https://xpack.github.io/preview/xpm/install/  and it should work.

                                   

                                  the new site is in preview mode, and will hopefully be public soon, together with new versions of the tools, but the pages documenting the prerequisites should be fine.

                                  1 of 1 people found this helpful
                                    • Re: Using XPM in Ubuntu
                                      valpoli

                                      Hi Liviu,

                                      I am having a hard time to use the proposed instructions.

                                      There are confusing details like:

                                      "The result is a binary like /usr/bin/node and a folder like /usr/lib/node_modules where the modules, includingnpm, are installed."

                                      Then it says:

                                      "$ which node
                                      /usr/local/bin/node
                                      $ node --version
                                      v10.16.0
                                      $"

                                      I have downloaded:

                                      node-v10.16.0-linux-x64

                                      Then have tried to implement the proposed instruction and found that sym links are broken.

                                      Looks like something is installed as I can see:

                                      $ which node

                                      /usr/bin/node/node

                                      $ node -v

                                      v10.16.0

                                      But look at npm:

                                      npm -v

                                      internal/modules/cjs/loader.js:638

                                          throw err;

                                          ^

                                      Error: Cannot find module '/usr/lib/node_modules/npm/bin/node_modules/npm/bin/npm-cli.js'

                                          at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

                                          at Function.Module._load (internal/modules/cjs/loader.js:562:25)

                                          at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)

                                          at startup (internal/bootstrap/node.js:283:19)

                                          at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

                                      Is it possible to find clear process to follow.

                                        • Re: Using XPM in Ubuntu
                                          ilg

                                          Hi Valery, you were right, the instructions were incomplete, the step to reinstall npm was not explicit.

                                           

                                          I added it, and tested the steps on my Ubuntu 18.

                                           

                                          Please remove your the node & npm and install according to the web page, and let me know the result.

                                            • Re: Using XPM in Ubuntu
                                              valpoli

                                              I removed previously installed node & npm

                                              Then starting from scratch downloaded:

                                              node-v10.16.0-linux-x64.tar.xz

                                              And executed these commands:

                                              sudo mkdir -p /usr/local/lib/nodejs

                                              sudo tar -xJvf ~/Downloads/node-v10.16.0-linux-x64.tar.xz -C /usr/local/lib/nodejs

                                              sudo ln -s /usr/local/lib/nodejs/node-v10.16.0-linux-x64/bin/node /usr/local/bin/node

                                              sudo ln -s /usr/local/lib/nodejs/node-v10.16.0-linux-x64/bin/bin/npm /usr/local/bin/npm

                                              sudo ln -s /usr/local/lib/nodejs/node-v10.16.0-linux-x64/bin/npx /usr/local/bin/npx

                                               

                                              //added line to .profile and source it

                                              export PATH="/usr/local/bin:${PATH}" in .profile

                                              source ~/.profile

                                               

                                              //checked

                                              $ which node

                                              /usr/local/bin/node

                                              $ node --version

                                              v10.16.0

                                               

                                              Then tried npm update:

                                              $ mkdir -p ~/opt/npm

                                              $ ls ~/opt/npm

                                               

                                              And got the message after doing:

                                              $ npm config set prefix ~/opt/npm

                                              The program 'npm' is currently not installed. You can install it by typing:

                                              sudo apt install npm

                                              Did not try to use this because something wrong here at this point.

                                                • Re: Using XPM in Ubuntu
                                                  ilg

                                                  oops, my mistake again, the link to npm is wrong, it has a double bin in the path.

                                                   

                                                  it should read:

                                                   

                                                  sudo ln -s /usr/local/lib/nodejs/node-v10.16.0-linux-x64/bin/npm /usr/local/bin/npm
                                                    • Re: Using XPM in Ubuntu
                                                      valpoli

                                                      It works but not sure if it installed the latest version, as from 'How to' it says 6.10.0 and in git I see 6.10.1 or this is not important for now.

                                                      And also the location is different from what says in 'How to'

                                                      //My

                                                      $ which npm

                                                      /home/. . ./opt/npm/bin/npm

                                                      $ npm -v

                                                      6.9.0

                                                      //In 'How to'

                                                      which npm
                                                      /Users/ilg/Library/npm/bin/npm
                                                      $ npm --version
                                                      6.10.0

                                                        • Re: Using XPM in Ubuntu
                                                          ilg

                                                          right, the npm path was copy/pasted from mac. I fixed the documentation.

                                                           

                                                          as for the version, I don't know why it picked the previous 6.9.0, I suspect a small server glitch.

                                                           

                                                          could you try again to install with explicit version npm@latest? (I added this detail to the documentation too). in my setup it installed 6.10.1.

                                                            • Re: Using XPM in Ubuntu
                                                              valpoli

                                                              Still there is an issue to have active latest version:

                                                               

                                                              npm install --global npm@latest

                                                              /home/.../opt/npm/bin/npm -> /home/.../opt/npm/lib/node_modules/npm/bin/npm-cli.js

                                                              /home/.../opt/npm/bin/npx -> /home/.../opt/npm/lib/node_modules/npm/bin/npx-cli.js

                                                              + npm@6.10.1

                                                              updated 1 package in 16.856s

                                                               

                                                              which npm

                                                              /home/.../opt/npm/bin/npm

                                                              npm -v

                                                              6.9.0

                                                               

                                                              Guess somewhere the previously installed version exists.

                                                               

                                                              looks like not correct link:

                                                              ../lib/node_modules/npm/bin/npm-cli.js

                                                              npm 6.10.1 path:

                                                              /home/.../opt/npm/bin/npm

                                                              but if you take ../ from this folder it will be:

                                                              /home/.../opt/npm/bin

                                                              and in this folder there is no npm

                                                              Then it takes next search in $PATH variable and it will be:

                                                              /usr/local/bin/npm

                                                              this has a link to:

                                                              /usr/local/lib/nodejs/node-v10.16.0-linux-x64/bin/npm

                                                              where initial npm installed (6.9.0)

                                                              I think it should not be two places here for node, npm, npx

                                                              They should be linked to the latest installed version for each of them.

                                                                • Re: Using XPM in Ubuntu
                                                                  ilg

                                                                  I'm not sure that your hypothesis is correct.

                                                                   

                                                                  can you create a new terminal and try again 'npm -v'?

                                                                   

                                                                  I did this on my Ubuntu 18 LTS VM and it showed the correct version, while the previous version is still in /usr/local/bin.

                                                                    • Re: Using XPM in Ubuntu
                                                                      valpoli

                                                                      Hi Liviu,

                                                                      I fixed this by cleanup the ~/.profile

                                                                      Doing several re-installations there were introduced several export PATH= for npm an xpm.

                                                                      After removing them and now have this in ~/.profile

                                                                      ...

                                                                      export PATH=/usr/local/bin:${PATH}

                                                                      export PATH="${HOME}/opt/npm/bin:${PATH}"

                                                                      ...

                                                                      It works properly:

                                                                      node -v

                                                                      v10.16.0

                                                                      npm -v

                                                                      6.10.1

                                                                      xpm --version

                                                                      0.5.0

                                                                       

                                                                      which node

                                                                      /usr/local/bin/node

                                                                      which npm

                                                                      /home/genesys/opt/npm/bin/npm

                                                                      which xpm

                                                                      /home/genesys/opt/npm/bin/xpm

                                                                       

                                                                      So, probably in the "How to" better to mention about not repeat steps with PATH updates to avoid multiple entries that could lead to issue.

                                                                      Thank you for support,

                                                                      I was able to install ARM compiler and it works properly right now.

                                                                      xpm install --global @gnu-mcu-eclipse/arm-none-eabi-gcc

                                                                      Let me know if you have expertise with ARM processor SW development or know who have that.

                                                                      I am looking into IoT programming and HW

                                                                      Val