redpitaya/rp.h: No such file or directory found

Just about everything about Red Pitaya
Bhuvi
Posts: 3
Joined: Thu Apr 21, 2016 6:48 pm
Location: Austria

redpitaya/rp.h: No such file or directory found

Post by Bhuvi » Sat Apr 23, 2016 1:25 pm

I am a beginner and I have completed all the initialization process that are needed (Linux image and pinging the repitaya using the serial interface though putty) . I created my own folder and inside that I created a .c file to test the example code provided (http://redpitaya.com/examples-new/blink/) but after I compiled it using gcc I got the error "redpitaya/rp.h: No such file r directory found" . How can I debug this and what could be the reason for this error ??

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: redpitaya/rp.h: No such file or directory found

Post by Nils Roos » Mon Apr 25, 2016 1:33 am

All C-examples depend on the RP api (librp.so and redpitaya/rp.h). To compile them you need to tell the compiler how to find these two components.

Let's assume you cloned the RedPitaya repository into /root/RedPitaya/ . You would first need to build the RP API:

Code: Select all

cd /root/RedPitaya/
make api
Then to compile your own source:

Code: Select all

cd /<path to your source>/
gcc -g -std=gnu99 -I/root/RedPitaya/api/include/ -L/root/RedPitaya/api/lib/ -lrp -lm -o <myprogram> <mysource.c>
To run it you either copy librp.so to /lib/ or use

Code: Select all

LD_LIBRARY_PATH=/opt/redpitaya/lib/ ./myprogram

Bhuvi
Posts: 3
Joined: Thu Apr 21, 2016 6:48 pm
Location: Austria

Re: redpitaya/rp.h: No such file or directory found

Post by Bhuvi » Mon Apr 25, 2016 6:55 pm

Thank you so so much !!! Now it works :) It would be great if few more basic faqs like these are present in the website ! Now my next target is to try and use the SPI present ! I hope I will be able to use it too ! Thank you once again !

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: redpitaya/rp.h: No such file or directory found

Post by amin » Fri Mar 10, 2017 1:15 pm

I already make api

Code: Select all

cd /root/RedPitaya/
make api
after that i refresh my folder root in eclipse and RedPitaya/api/lib appears.
it is contain librp.a and librp.so.
and then i go to cd RedPitaya/Test/bode.c (as path will i edit )to tell the linker to use librp.so with -lrp.
and copy to another locations using -L in root/RedPitaya/api/lib like your example below

Code: Select all

cd /<path to your source>/
gcc -g -std=gnu99 -I/root/RedPitaya/api/include/ -L/root/RedPitaya/api/lib/ -lrp -lm -o <myprogram> <mysource.c>
so i change like this
gcc -g -std=gnu99 -I/root/RedPitaya/api/include / -L/root/RedPitaya/api/lib/ -lrp -lm -o bode bode.c

but the result is like this
gcc -g -std=gnu99 -I/root/RedPitaya/api/in clude / -L/root/RedPitaya/api/lib/ -lrp -lm -o bode bode.c
/usr/bin/ld: cannot find /: File format not recognized
collect2: error: ld returned 1 exit status

Do you know why this happen?

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: redpitaya/rp.h: No such file or directory found

Post by Nils Roos » Fri Mar 10, 2017 1:23 pm

Code: Select all

gcc -g -std=gnu99 -I/root/RedPitaya/api/in clude / -L/root/RedPitaya/api/lib/ -lrp -lm -o bode bode.c
There's a couple of spaces in places where they should not be in the above command.

Code: Select all

gcc -g -std=gnu99 -I/root/RedPitaya/api/include/ -L/root/RedPitaya/api/lib/ -lrp -lm -o bode bode.c

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: redpitaya/rp.h: No such file or directory found

Post by amin » Fri Mar 10, 2017 1:53 pm

[quote="Nils Roos"]All C-examples depend on the RP api (librp.so and redpitaya/rp.h). To compile them you need to tell the compiler how to find these two components.


how about Test/bode/bode.c, is it also depend on RP api (librp.so and redpitaya/rp.h) ?
because currently i cannot add rp.h and add port function ie. rp_DpinSetState.

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: redpitaya/rp.h: No such file or directory found

Post by Nils Roos » Fri Mar 10, 2017 1:56 pm

See my answer here.

And please stop posting similar questions to several different topics at once.

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: redpitaya/rp.h: No such file or directory found

Post by amin » Fri Mar 10, 2017 2:05 pm

i did it again with correct command but still get many undefined lib

gcc -g -std=gnu99 -I/root/RedPitaya/api/include/ -L/root/RedPitaya/api/lib/ -lrp -lm -o bode bode.c
/tmp/ccFEmhlU.o: In function `main':
/root/RedPitaya/Test/bode/bode.c:355: undefined reference to `log10f'
/root/RedPitaya/Test/bode/bode.c:356: undefined reference to `log10f'
/root/RedPitaya/Test/bode/bode.c:376: undefined reference to `rp_app_init'
/root/RedPitaya/Test/bode/bode.c:425: undefined reference to `powf'
/root/RedPitaya/Test/bode/bode.c:512: undefined reference to `round'
/root/RedPitaya/Test/bode/bode.c:519: undefined reference to `rp_set_params'
/tmp/ccFEmhlU.o: In function `synthesize_signal':
/root/RedPitaya/Test/bode/bode.c:613: undefined reference to `c_awg_smpl_freq'
/root/RedPitaya/Test/bode/bode.c:613: undefined reference to `c_awg_smpl_freq'
/root/RedPitaya/Test/bode/bode.c:613: undefined reference to `round'
/root/RedPitaya/Test/bode/bode.c:633: undefined reference to `cos'
/root/RedPitaya/Test/bode/bode.c:633: undefined reference to `round'
/root/RedPitaya/Test/bode/bode.c:638: undefined reference to `cos'
/root/RedPitaya/Test/bode/bode.c:638: undefined reference to `round'
/root/RedPitaya/Test/bode/bode.c:664: undefined reference to `round'
/root/RedPitaya/Test/bode/bode.c:678: undefined reference to `round'
/root/RedPitaya/Test/bode/bode.c:684: undefined reference to `cos'
/root/RedPitaya/Test/bode/bode.c:684: undefined reference to `acos'
/root/RedPitaya/Test/bode/bode.c:684: undefined reference to `round'
/root/RedPitaya/Test/bode/bode.c:693: undefined reference to `c_awg_smpl_freq'
/root/RedPitaya/Test/bode/bode.c:693: undefined reference to `c_awg_smpl_freq'
/root/RedPitaya/Test/bode/bode.c:697: undefined reference to `log'
/root/RedPitaya/Test/bode/bode.c:697: undefined reference to `log'
/root/RedPitaya/Test/bode/bode.c:697: undefined reference to `exp'
/root/RedPitaya/Test/bode/bode.c:697: undefined reference to `sin'
/root/RedPitaya/Test/bode/bode.c:697: undefined reference to `round'
/tmp/ccFEmhlU.o: In function `write_data_fpga':
/root/RedPitaya/Test/bode/bode.c:722: undefined reference to `fpga_awg_init'
/root/RedPitaya/Test/bode/bode.c:726: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:726: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:727: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:727: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:728: undefined reference to `g_awg_reg'
/tmp/ccFEmhlU.o:/root/RedPitaya/Test/bode/bode.c:728: more undefined references to `g_awg_reg' follow
/tmp/ccFEmhlU.o: In function `write_data_fpga':
/root/RedPitaya/Test/bode/bode.c:733: undefined reference to `g_awg_cha_mem'
/root/RedPitaya/Test/bode/bode.c:733: undefined reference to `g_awg_cha_mem'
/root/RedPitaya/Test/bode/bode.c:737: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:737: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:738: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:738: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:739: undefined reference to `g_awg_reg'
/tmp/ccFEmhlU.o:/root/RedPitaya/Test/bode/bode.c:739: more undefined references to `g_awg_reg' follow
/tmp/ccFEmhlU.o: In function `write_data_fpga':
/root/RedPitaya/Test/bode/bode.c:744: undefined reference to `g_awg_chb_mem'
/root/RedPitaya/Test/bode/bode.c:744: undefined reference to `g_awg_chb_mem'
/root/RedPitaya/Test/bode/bode.c:753: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:753: undefined reference to `g_awg_reg'
/root/RedPitaya/Test/bode/bode.c:755: undefined reference to `fpga_awg_exit'
/tmp/ccFEmhlU.o: In function `acquire_data':
/root/RedPitaya/Test/bode/bode.c:771: undefined reference to `rp_get_signals'
/tmp/ccFEmhlU.o: In function `bode_data_analysis':
/root/RedPitaya/Test/bode/bode.c:853: undefined reference to `sin'
/root/RedPitaya/Test/bode/bode.c:854: undefined reference to `sin'
/root/RedPitaya/Test/bode/bode.c:856: undefined reference to `sin'
/root/RedPitaya/Test/bode/bode.c:857: undefined reference to `sin'
/root/RedPitaya/Test/bode/bode.c:868: undefined reference to `powf'
/root/RedPitaya/Test/bode/bode.c:868: undefined reference to `powf'
/root/RedPitaya/Test/bode/bode.c:868: undefined reference to `sqrtf'
/root/RedPitaya/Test/bode/bode.c:869: undefined reference to `atan2f'
/root/RedPitaya/Test/bode/bode.c:872: undefined reference to `powf'
/root/RedPitaya/Test/bode/bode.c:872: undefined reference to `powf'
/root/RedPitaya/Test/bode/bode.c:872: undefined reference to `sqrtf'
/root/RedPitaya/Test/bode/bode.c:873: undefined reference to `atan2f'
/root/RedPitaya/Test/bode/bode.c:890: undefined reference to `log'
collect2: error: ld returned 1 exit status

i also already make api.

Nils Roos
Posts: 1441
Joined: Sat Jun 07, 2014 12:49 pm
Location: Königswinter

Re: redpitaya/rp.h: No such file or directory found

Post by Nils Roos » Fri Mar 10, 2017 2:24 pm

Adapt the Makefile like I described in the other thread and just use "make".
Otherwise you would first need to compile all the sourcefiles separately and list the resulting .o files in the gcc command.

amin
Posts: 54
Joined: Mon Feb 06, 2017 12:31 pm

Re: redpitaya/rp.h: No such file or directory found

Post by amin » Fri Mar 10, 2017 2:29 pm

Nils sorry i just want to make a note in same case like me.
i will arrange step by step
cd root/RedPitaya
make api
cd RedPitaya/Test/bode
LIBS=-L /root/RedPitaya/api/lib/ -lm -lpthread -lrp
but in this step error is like this
LIBS = -L/root/RedPitaya/api/lib/ -lm -lpt hread -lrp
-bash: LIBS: command not found

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 7 guests