This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM355 Setting up build environment

Hello,

I am not able to run the hello.c file as described in the starting guide sec.4.4.1.

Whenever i type:

arm_v5t_le-gcc hello.c -o hello

i get a message saying: "bash: arm_v5t_le-gc: command not found"

Please anyone can guide me!

Thanks in advance

  • This sounds like your path that was setup in section 4.4 of the GSG is incorrect, or you have not yet installed all the tools. You can check your system's environment variables with the 'printenv' command on your host, upon running this you should see a variety of variables that have been set, one of which should be PATH, which should contain a number of paths seperated by colons, if none of those paths point to the cross compiler (/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin:/opt/mv_pro_4.0.1/montavista/pro/bin:/opt/mv_pro_4.0.1/montavista/common/bin) than you would get such an error. You can add environment variables using the 'export' command, for example export FRUIT=apple will make an environment variable called FRUIT set to the value apple which can be seen with the printenv command, you can add to existing variables by referencing the existing variable in your export statement by putting a $ before the name of the variable, so if you ran export FRUIT="orange:$FRUIT" you would end up with FRUIT=orange:apple, which is why in section 4.4 they have $PATH in step 2.

    Basically try running the line below and than see if it will let you build:

    export PATH="/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin:/opt/mv_pro_4.0.1/montavista/pro/bin:/opt/mv_pro_4.0.1/montavista/common/bin:$PATH"

  •  

    When I type "printenv" i get this:

    GPG_AGENT_INFO=/tmp/seahorse-apfxs7/S.gpg-agent:6234:1
    SHELL=/bin/bash
    DESKTOP_STARTUP_ID=
    TERM=xterm
    XDG_SESSION_COOKIE=f707273d5a70d8c54f18d60e48f335cd-1224076057.410249-477489783
    GTK_RC_FILES=/etc/gtk/gtkrc:/home/saadia/.gtkrc-1.2-gnome2
    WINDOWID=52428892
    USER=saadia
    LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:
    SSH_AUTH_SOCK=/tmp/keyring-XZbOnr/ssh
    GNOME_KEYRING_SOCKET=/tmp/keyring-XZbOnr/socket
    SESSION_MANAGER=local/saadia-desktop:/tmp/.ICE-unix/6123
    USERNAME=saadia
    PATH=/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin:
    /opt/mv_pro_4.0.1/montavista/pro/bin:
    /opt/mv_pro_4.0.1/montavista/common/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    DESKTOP_SESSION=default
    GDM_XSERVER_LOCATION=local
    PWD=/home/saadia
    LANG=en_US.UTF-8
    GNOME_KEYRING_PID=6122
    GDM_LANG=en_US.UTF-8
    GDMSESSION=default
    HISTCONTROL=ignoreboth
    SHLVL=1
    HOME=/home/saadia
    GNOME_DESKTOP_SESSION_ID=Default
    LOGNAME=saadia
    XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/
    DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-AmM4Fu8Nid,guid=740be4a403bd0ec68f3b8b7e48f5eb1a
    LESSOPEN=| /usr/bin/lesspipe %s
    WINDOWPATH=7
    DISPLAY=:0.0
    LESSCLOSE=/usr/bin/lesspipe %s %s
    COLORTERM=gnome-terminal
    XAUTHORITY=/home/saadia/.Xauthority
    _=/usr/bin/printenv

     

     

  • There is a step in the Getting Started Guide (GSG) that asks you to use "export" command to set the "PATH" variable correctly.  From your log above, it appears not all the paths listed in the GSG have been set correctly.

  • Can you please tell me which section you are referring towards? And if you can write down the exact command i need to edit in the .bashrc.

     

    Thanks.

     

  • I was referring to section 4.4 step 2 in spruf73a.pdf (DM355 Getting Started Guide).  You are correct that they provide a more permanent solution (edit .bashrc) rather than the 'export' command I was thinking (it would have to be typed anytime you open a new window).

    Let me know if this helps clear things up.

  • The GSG actually shows editing bashrc instead of using export, but either should work, the section in question is 4.4.

    It looks like your path does have the right paths in it, since that is correct the next thing I would verify is that you completed the installation process in section 4.3, and that the folders (and the files within those folders) mentioned in your path variable exist and are accessable from the login you are trying to build with.

  • After you "source .bashrc", if everything is set correctly, you should be able to type the following linux command

    > which arm_v5t_le-gcc

    to verify the path.

    [edit] Also, please note that ~/.bashrc runs automatically anytime you open a new command shell (window), hence no need to source it every time. 

  • I have completed sections:4.3.1,4.3.2,4.3.4 only. But I suppose these are enough to atleast get the "hello world" going?

  • Those section should be enough to get hello program going.  If you are still having issues, please verify the directories in your PATH variable exists; in particular please verify

    /opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin  (per your log)

    exists in your host.

     

  • saadia@saadia-desktop:~$ cd /opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin

    saadia@saadia-desktop:/opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin$ ls -la

    drwxr-xr-x  2 root root     4096 2007-08-07 13:56 .
    drwxr-xr-x 13 root root     4096 2008-10-13 06:35 ..
    -rwxr-xr-x  1 root root     6784 2006-07-06 00:02 apr-config
    -rwxr-xr-x  1 root root     5914 2006-07-06 00:02 apu-config
    -rwxr-xr-x  1 root root    23118 2006-07-06 00:02 apxs
    -rwxr-xr-x  1 root root  2001776 2006-07-05 23:50 arm_v5t_le-addr2line
    -rwxr-xr-x  1 root root  2063141 2006-07-05 23:50 arm_v5t_le-ar
    -rwxr-xr-x  1 root root  3546889 2006-07-05 23:50 arm_v5t_le-as
    -rwxr-xr-x  1 root root   294079 2006-07-05 23:57 arm_v5t_le-c++
    -rwxr-xr-x  1 root root  1939944 2006-07-05 23:50 arm_v5t_le-c++filt
    -rwxr-xr-x  1 root root   293894 2006-07-05 23:57 arm_v5t_le-cpp
    -rwxr-xr-x  1 root root     8705 2006-07-06 00:04 arm_v5t_le-e2fs_install
    -rwxr-xr-x  1 root root   294079 2006-07-05 23:57 arm_v5t_le-g++
    -rwxr-xr-x  1 root root   290583 2006-07-05 23:57 arm_v5t_le-gcc
    -rwxr-xr-x  1 root root   121483 2006-07-05 23:57 arm_v5t_le-gcov
    -rwxr-xr-x  1 root root 12815530 2006-07-06 00:01 arm_v5t_le-gdb
    -rwxr-xr-x  1 root root  2496256 2006-07-05 23:50 arm_v5t_le-gprof
    -rwxr-xr-x  1 root root    32580 2006-07-06 00:01 arm_v5t_le-initdconfig
    -rwxr-xr-x  1 root root  1808350 2006-07-06 00:01 arm_v5t_le-ksymoops
    -rwxr-xr-x  1 root root  2740220 2006-07-05 23:50 arm_v5t_le-ld
    lrwxrwxrwx  1 root root       23 2008-10-13 06:35 arm_v5t_le-ldd -> arm_v5t_le-prelink-rtld
    -rwxr-xr-x  1 root root     6922 2006-07-05 19:00 arm_v5t_le-libindex
    -rwxr-xr-x  1 root root    17091 2006-07-05 19:00 arm_v5t_le-libopt
    -rwxr-xr-x  1 root root    10077 2006-07-05 19:32 arm_v5t_le-libtoolize
    -rwxr-xr-x  1 root root  2039962 2006-07-05 23:50 arm_v5t_le-nm
    -rwxr-xr-x  1 root root  2492366 2006-07-05 23:50 arm_v5t_le-objcopy
    -rwxr-xr-x  1 root root  2640391 2006-07-05 23:50 arm_v5t_le-objdump
    -rwxr-xr-x  1 root root  1576047 2006-07-06 00:04 arm_v5t_le-prelink
    -rwxr-xr-x  1 root root   606200 2006-07-06 00:04 arm_v5t_le-prelink-rtld
    -rwxr-xr-x  1 root root  2063140 2006-07-05 23:50 arm_v5t_le-ranlib
    -rwxr-xr-x  1 root root   436641 2006-07-05 23:50 arm_v5t_le-readelf
    -rwxr-xr-x  1 root root    32580 2006-07-06 00:01 arm_v5t_le-shellconfig
    -rwxr-xr-x  1 root root  1909068 2006-07-05 23:50 arm_v5t_le-size
    -rwxr-xr-x  1 root root  1882211 2006-07-05 23:50 arm_v5t_le-strings
    -rwxr-xr-x  1 root root  2492365 2006-07-05 23:50 arm_v5t_le-strip
    -rwxr-xr-x  1 root root     1259 2006-07-05 19:43 audiofile-config
    -rwxr-xr-x  1 root root      579 2006-07-05 19:43 freetype-config
    -rwxr-xr-x  1 root root   197707 2006-07-06 00:03 glib-genmarshal
    -rwxr-xr-x  1 root root     5446 2006-07-06 00:03 glib-gettextize
    -rwxr-xr-x  1 root root    14309 2006-07-06 00:03 glib-mkenums
    -rwxr-xr-x  1 root root   524346 2006-07-06 00:03 gobject-query
    -rwxr-xr-x  1 root root   844469 2006-07-06 00:04 orbit-idl-2
    -rwxr-xr-x  1 root root     1047 2006-07-05 19:44 xml2-config

     

    thats my host linux

  • Based on your logs, you should be all set.  when you type

    >which arm_v5t_le-gcc

    you should see the correct path displayed.  Are you not seeing this?

  • And yes,

    where will be the output file be stored? I mean hpw will I know if its executed or not?

  • Juan Gonzales said:

    Based on your logs, you should be all set.  when you type

    >which arm_v5t_le-gcc

    you should see the correct path displayed.  Are you not seeing this?

     

    nothing seems to happen when i type: which arm_v5t_le-gcc

     

     

  • saadia said:

    And yes,

    where will be the output file be stored? I mean hpw will I know if its executed or not?

    I mean in my host system

  • the "-o" option specifies where your output goes; since no path is provided after this build option, it will simply put "hello" file (output) in the same directry where you execute the command.

  • You end up with a file called hello in the same directory you ran the command to build the c file. You take that hello file and copy it into your target file system (probaby though NFS) so that you can execute it on the target board, when you run ./hello on your target board you should see it print the message, showing you that it works.

  • Interesting; I would expect at least a "command not found" message.  What Linux Host are you using? just curious. 

     

  • Juan Gonzales said:

    the "-o" option specifies where your output goes; since no path is provided after this build option, it will simply put "hello" file (output) in the same directry where you execute the command.

    I got a file "a.out" in /opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin. Is that the output file im looking for? 

    Iam using UBUNTU.

  • Bernie Thompson said:

    You end up with a file called hello in the same directory you ran the command to build the c file. You take that hello file and copy it into your target file system (probaby though NFS) so that you can execute it on the target board, when you run ./hello on your target board you should see it print the message, showing you that it works.

    Is arm_v5t_le-gcc converts my C file to .bin which is executble in the evaluation board?

  • saadia said:

    Is arm_v5t_le-gcc converts my C file to .bin which is executble in the evaluation board?

    That is the idea yes, it is just making a ARM executable for you.

  • I believe a.out is the default when the user does not specify "-o" build option as suggested on GSG.  That should work on target.

    BTW, how did you get around the issue of arm_v5t_le-gcc not being found; did you simply type the full path to the command or where you able to resolve the PATH issue?

     

  • Well the a.out worked on the target board.

    I simple typed the path to the command, and didnt do it with the PATH.

    I will work on the PATH issue today probably and if i get any results will post it.

    Thanks guys.

  • We are happy to help; let us know how the PATH issue goes.

  • I am glad to hear that at least your build works, it is unfortunate that there is something broken with the path. This sounds like a host issue, and though I have heard of others using Ubuntu, I have not seen this sort of problem with it. What version of Ubuntu are you using?

  • its UBUNTU 8.0.4 i believe

  • you can do a simple test using any variable of your choice; try something like below

    > export MYVAR=/this/is/a/test

    > echo MYVAR

    If you do not see your variable displaying the value you set ("/this/is/a/test"), then this may be a host issue.

  • Dear all,

    I am trying to compile hello.c as described in the GSG, and I get the following message:

     

    /opt/mv_pro_4.0.1/montavista/pro/devkit/arm/v5t_le/bin/../lib/gcc/armv5tl-montavista-linuxeabi/3.4.3/../../../../armv5tl-montavista-linuxeabi/bin/ld: cannot open output file hello: Permission denied

    collect2: ld returned 1 exit status

    The paths are correct, and both the NFS and the entire mv_pro_4.0.1 folders have chmod 777 permissions.
    What could be the problem?
    Pablo