Page 2 of 3

Re: Getting Error while running make command

Posted: Sun Mar 13, 2016 3:27 am
by xyefa
The instructions here: https://github.com/RedPitaya/RedPitaya/ ... /README.md do NOT mention the setting of the CROSS_COMPILE environment variable. Is this an omission?

8lu3 wrote:Download Vivado 2015.4 (License is "WebPack" or something like that). You can download everything or just Vivado WebPack and the SDK. There is also a vivado downloader which installs the components you want. Install to /opt/Xilinx. Add /opt/Xilinx/Vivado/2015.4/bin and /opt/Xilinx/SDK/2015.4/bin to $PATH.
run
sudo chown -R $you:$you /opt/Xilinx (maybe -r instead of -R)
sudo apt-get install libc6-dev-armel-cross
sudo apt-get install build-essential

Download arm-linux-gnueabihf 4.9 2011.4 manually
sudo mkdir -p /opt/linaro
sudo chown $you:$you /opt/linaro
unpack the downloaded arm-linux.. archive to /opt/linaro
add /opt/linaro/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin to $PATH (third directory may differ)

go to your RedPitay directory in shell
run make CROSS_COMPILE=arm-linux-gnueabihf- api
go to Examples/C in shell
run make CROSS_COMPILE=arm-linux-gnuabihf all

Maybe you have to clone the project again. I had some trouble building the api after a failed attempt. Hope that helps

Re: Getting Error while running make command

Posted: Sun Mar 13, 2016 4:43 pm
by mharis
Hi,

I did followed each step you have mentioned. The api is successfully complied but as soon as I run make Cross_Compile command for compiling Examples/C, it gives error. I also tried it with "make digital_led_blink" but no success. Following is the error:

Code: Select all

haris@ubuntu:~/Downloads/RedPitaya/Examples/C$ make digital_led_blink 
gcc -g -std=gnu99 -Wall -Werror -I../../api/include -L ../../api/lib -lm -lpthread -lrp    digital_led_blink.c   -o digital_led_blink
/tmp/ccD5vsgk.o: In function `main':
/home/haris/Downloads/RedPitaya/Examples/C/digital_led_blink.c:22: undefined reference to `rp_Init'
/home/haris/Downloads/RedPitaya/Examples/C/digital_led_blink.c:29: undefined reference to `rp_DpinSetState'
/home/haris/Downloads/RedPitaya/Examples/C/digital_led_blink.c:31: undefined reference to `rp_DpinSetState'
/home/haris/Downloads/RedPitaya/Examples/C/digital_led_blink.c:36: undefined reference to `rp_Release'
collect2: error: ld returned 1 exit status
make: *** [digital_led_blink] Error 1

Any thoughts on this?

Regards

Re: Getting Error while running make command

Posted: Sun Mar 13, 2016 9:53 pm
by 8lu3
Do you get a similar error for 'make CROSS_COMPILE=arm-linux-gnueabi- all' ? Does the librp.so file exist in RedPitaya/api/lib ?
By the way, you have to call make CROSS_COMPILE=arm-linx-gnueabi-all digital_led_blink .

Re: Getting Error while running make command

Posted: Sun Mar 13, 2016 10:39 pm
by mharis
Yes I do have librp.so file inside lib folder. Regarding make CROSS_COMPILE=arm-linx-gnueabi-all digital_led_blink, I get this error when i execute it:
Even tough I have followed everything you said.

Code: Select all

make CROSS_COMPILE=arm-linx-gnueabi-all digital_led_blink
arm-linx-gnueabi-allgcc -g -std=gnu99 -Wall -Werror -I../../api/include -L ../../api/lib -lm -lpthread -lrp    digital_led_blink.c   -o digital_led_blink
make: arm-linx-gnueabi-allgcc: Command not found
make: *** [digital_led_blink] Error 127

Re: Getting Error while running make command

Posted: Sun Mar 13, 2016 11:13 pm
by 8lu3
You have to use 'make CROSS_COMPILE=arm-linux-gnueabihf- all' not 'make CROSS_COMPILE=arm-linux-gnueabi- all' . Did you use the soft floated (hard floated compiler: arm-linux-gnueabihf-gcc; soft floated compiler: arm-linux-gnueabi-gcc) version for building the api as well? Have you installed the hard floated (hf) compiler as I said previously?

Also you missed a whitespace between "-" and all in your command.
Please, run this command

Code: Select all

arm-linx-gnueabihf-gcc -g -std=gnu99 -Wall -Werror -I../../api/include -L ../../api/lib -lm -lpthread -lrp    digital_led_blink.c   -o digital_led_blink
in RedPitaya/Example/C/program_folder . It will build the program, if you have installed arm-linux-gnueabihf-gcc (hf version) and the api was build with this hf version.

Re: Getting Error while running make command

Posted: Mon Mar 14, 2016 11:59 am
by redpitaya
Hi,

You need to input

Code: Select all

. settings.sh
command before

Code: Select all

 make api
Best,

Re: Getting Error while running make command

Posted: Mon Mar 14, 2016 10:09 pm
by Nils Roos
Sorry, I've been down with the flu over the weekend.

To recapitulate and bring all the different contributions that were made in the meantime into context:

The prerequisites listed in the README on github are incomplete if one wants to do a full build. Starting from a freshly installed Ubuntu 14.04, the following steps are neccessary:
  1. fake gmake:

    Code: Select all

    sudo ln -s /usr/bin/make /usr/bin/gmake
  2. install additional packages:

    Code: Select all

    sudo apt-get install device-tree-compiler u-boot-tools gcc-multilib g++-multilib libncurses5-dev lib32z1 git
  3. prepare toolchain directories:

    Code: Select all

    sudo mkdir /opt/Xilinx /opt/linaro
    sudo chown $USER:$GROUP /opt/Xilinx/ /opt/linaro/
    with the prepared directories, the following two steps can be done without elevated privileges, and it is not neccessary to change the permissions afterwards
  4. download and unpack the linaro toolchain - downloading and unpacking manually should work just as well as using curl etc.
  5. download, install, and license Vivado 2015.4 (Webpack), be sure to select the SDK during setup
  6. clone the Red Pitaya repository:

    Code: Select all

    git clone https://github.com/RedPitaya/RedPitaya RedPitaya/
So much for preparation. Now, as redpitaya rightfully pointed out, before running

Code: Select all

make
(for any target) you need to execute

Code: Select all

. ./settings.sh
in the RedPitaya directory. You need to do this once each time you open a new terminal window.

Re: Getting Error while running make command

Posted: Tue Aug 09, 2016 10:14 pm
by viseng
Hi , the previous posts are I believe issues with cross compiling on a host linux machine? My problem is that i cannot make any of the examples on the RP board directly. I have followed "How_to_make_simple_program" on the wiki (latest instructions), including make api which completed ok.
the errors are (for compiling analog_inputs:
undefined reference to `rp_Init'
undefined reference to `rp_AIpinG
undefined reference to rp_Release'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'analog_inputs' failed

I have no idea what these errors mean, so wondered if anyone could provide the corrections to the wiki instructions?

thanks in advance,

Re: Getting Error while running make command

Posted: Wed Aug 10, 2016 8:43 pm
by viseng
Thought it might be useful to again ask for support on this problem, as there must be many out there who have sucessfully managed to compile the examples on the RP board. In fact I can compile them on the old 0.95 ecosystem, but not on the current 0.96-20. According to the website, in order to run the professional scope app, I have to use 0.96-20, as it no longer runs on the 0.95 release. The compilation instructions are unchanged from the 0.95 rev. so is it possible that there is some small difference in the way they should be compiled in the current version??

thanks for any help,

Re: Getting Error while running make command

Posted: Wed Aug 10, 2016 9:09 pm
by Nils Roos
I am currently looking into that, and I don't believe that there are many people who have successfully compiled things on the RP locally with the latest release.