DavidEGrayson / minimu9-ahrs

Program for reading data from the Pololu MinIMU-9 over I²C. Works on the Raspberry Pi and other embedded ARM Linux boards.
Other
167 stars 68 forks source link

minimu9-ahrs: command not found #7

Closed Smity closed 10 years ago

Smity commented 11 years ago

David,

Your software looks great, and I'm very exited to use it. However, after following your instructions on your wiki (https://github.com/DavidEGrayson/minimu9-ahrs/wiki), I still can't seem to get minimu9-ahrs to run. I installed using the command "sudo apt-get install libi2c-dev libboost-program-options-dev make" because I'm using the armhf EABI (so says the command line when I try wget). I don't see any errors, and everything seems to have worked fine, but when I try entering "minimu9-ahrs --mode raw" into the terminal I get the error "-bash: minimu9-ahrs: command not found". I'm pretty new with this, am I simply missing a step somewhere?

cgridley commented 11 years ago

Smity, I had a similar problem when I built this project from source for the current (armhf) version of the Raspberry Pi. What I discovered was running the "make" command after "sudo apt-get ..." wasn't sufficient. I had to run "make install" so that the final binaries were moved to a directory (/usr/bin/) in the search path for the shell. Hope this helps. - cgridley

DavidEGrayson commented 11 years ago

Hello, @Smity. If you install the Debian package I created and it works, then that should be all you need to do. It sounds like you installed all the prerequisites for building minimu9-ahrs from source, but you did not install minimu9-ahrs itself. The instructions for installing the Debian package are on the Wiki, which you provided a link to in your post.

If the Debian package does not work for you (for example you might have issue https://github.com/DavidEGrayson/minimu9-ahrs/issues/5 ) then you could compile the program yourself from source. You should be able to type "make" to build the binary and then run it with a command like "./minimu9-ahrs" from within the build directory. @cgridley's advice should work nicely too, as it should install the binary into your bin directory so you can run it easily from anywhere.

@cgridley, thanks for helping!

DavidEGrayson commented 11 years ago

In general, Linux programs needs to be in a directory listed on your PATH environment variable for you to run them without specifying a directory. If they are not on your PATH, you need to specify the relative or absolute directory path to them. Examples:

  1. ./minimu9-ahrs ( the . stands for the current directory )
  2. ~/minimu9-ahrs/minimu9-ahrs ( the ~ stands for the current user's home directoy )
  3. /home/smity/minumu9-ahrs/minimu9-ahrs ( this is the full path and will work no matter what your current directory is )
Smity commented 11 years ago

Thank you both for the advice, but I'm afraid I'm sure exactly what either of you are saying -this method of installinfg software is very new to me. cgridley, I tried running "sudo apt-get install libi2c-dev libboost-program-options-dev make install" (and many other variants of that), but the terminal told me it could not find the package "install". I suppose that means that every string after "sudo apt-get install" must be an installable package? If that's the case, can you please advise me on the correct syntax you used?

David, your hypothesis of me installing all the prerequisites for building minimu9-ahrs from source, but not installing minimu9-ahrs itself seems to make sense. What I'm having trouble figuring out is how to do that, as the wiki directs me to the readme, and the only instruction there is to install the prerequisites (at least, I think that's what it means).

Thanks again for the help.

DavidEGrayson commented 11 years ago

The wiki has lots of information on it. Did you see the section entitled "Installing minimu9-ahrs" ?

Smity commented 11 years ago

Yeah, I did, but isn't the information only relevant to armel systems?

DavidEGrayson commented 11 years ago

Yeah, I think so. Are you sure you have an armhf system? If not, could you just try installing that Debian package as it says to do in the Wiki, and tell me what the result is?

thesummer commented 11 years ago

Maybe a bit more detailed explanation: As far as I understand you are trying to compile/build the program yourself, but you where mixing things up. Basically you have 4 steps:

  1. Get the prerequisites: David uses several libraries in his program. In order for the compiler to use them you have to install them first (actually the development version, which has some more informations for the compiler how to use the libraries). This is done using the command you already posted: sudo apt-get install libi2c-dev libboost-program-options-dev make You only have to do this once. The libraries (and other helpful tools like make) are installed now.
  2. Get the source code of David's program: You can either download the source code as a zip-file from here: https://github.com/DavidEGrayson/minimu9-ahrs (in the new design its on the right column now). Or you clone the source code using git: git clone git@github.com:DavidEGrayson/minimu9-ahrs.git If the git command is not found you have to install git first using: sudo apt-get install git
  3. Build the program: Go into the folder where the source code is located. There should be a file called "Makefile". Then just type "make". Now the compiler is actually trying to build the program. If no error occurred you are nearly ready to go.
  4. Run the program: If 3. was successful you should have a file minimu9-ahrs in your source folder, but you can not simply run it using "minimu9-ahrs" the shell won't be able to find it (even if it is in the same folder). The reason is that the shell only looks in a few special folders for programs and your current directory is not one of them. One solution is to tell the shell where the program is located. If it is in your current directory use "./minimu9-ahrs". The "./" means basically look for the program in the folder I am currently. Problem is, you would always have to navigate to the folder of the program or give the full path to the folder in order to run the program (David explained that a few comments above) The second method is to install the program into a directory the shell is actually looking for programs. This is done with: sudo make install The program is now copied to a certain folder (probably /usr/local/bin) where the shell can find it. Now you only have to run "minimu9-ahrs" in future. Hope that helps.
DavidEGrayson commented 11 years ago

Oh yeah, @smity: in your first post you wrote "sudo apt-get install libi2c-dev libboost-program-options-dev make". I think you misinterpeted the README file. Note how in the README file, "make" is on a separate line. That means make is different command and it should not be part of the previous command. There are two commands specified in the README file, and the second one is simply "make". For the second one to work, you need to have a copy of my source code and the current directory (pwd) needs to be set to the directory where the source code is.

Smity commented 11 years ago

Haha! Got it! Thanks so much for your explanations, guys. Seriously, I really appreciate it.