gr-rpitx icon indicating copy to clipboard operation
gr-rpitx copied to clipboard

Is it possible to compile on Raspberry pi without buildroot?

Open antonjan opened this issue 3 years ago • 5 comments

Hi I would like to compile on Raspberry Pi without using buildroot. Just want to add the gr-rpitx to the existing gnuradio on Pi no PC involved. Thanks Anton

antonjan avatar Jun 25 '21 10:06 antonjan

Compiling on the target board, and more generally using binary general purpose operating system images on embedded systems, is frowned upon, as we have extensively documented at https://fosdem.org/2021/schedule/event/fsr_gnu_radio_on_embedded_using_buildroot/ Being based on cmake, compiling gr-rpitx on the target should be as simple as mkdir build cd build cmake ../ make make install assuming all the dependencies (that Buildroot will take care of) are available, but that is not a supported approach to embedded system development. Best wishes

jmfriedt avatar Jun 25 '21 18:06 jmfriedt

Thanks I understand there is lots of reasons not to run it on Pi but in my case I needs to run it there. All seems to compile and install but now get the following errors.

Peri Base = 3f000000 SDRAM c0000000
can't open /dev/mem

This program should be run as root. Try prefixing command with: sudo

image Try running it as root using sudo gnuradio-companion I get a different error I think it is an Library path problem for root. image

Traceback (most recent call last):
  File "/home/pi/rptx_traqnsmitter.py", line 20, in <module>
    import rpitx
**ModuleNotFoundError:** No module named 'rpitx'

Done (return code 1)

I think I need to play with the following paths for It to see the librptx library export PYTHONPATH export LD_LIBRARY_PATH I will let you know if I get it working and I am also open for any suggestions.

antonjan avatar Jun 30 '21 11:06 antonjan

If you are at the point of running gnuradio-companion as root, you might as well sudo chmod 777 /dev/mem and run the script as user pi (the chmod being extremely unsecure and should never be done in a production environment). I would run gnuradio-companion on the host PC, generate the Python script on the host and run the script on the target, but seems not to be the path followed here. Also notice that in your flowchart, 2 MS/s is way beyond the documented accessible sampling rate, see http://jmfriedt.free.fr/gnuradiodays2021.pdf (200 kS/s is safe, 400 kS/s max.) Best wishes.

jmfriedt avatar Jun 30 '21 20:06 jmfriedt

Hi I got it working fine on Raspberry using gnuradio-companion. (Stil need to run as root) Here is my script that I run to setup my paths and then start gnuradio-companion with sudo I created a script with the below content then run it with sudo

export PATH=/usr/local/bin:$PATH
export PYTHONPATH=/usr/local/lib/python3/dist-packages:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_CONFIG
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
/usr/local/bin/gnuradio-companion

gnuradio-companions seem to work fine with gr-rpitx I found one more problem. You need to install rpitx and then run the ./install.sh script as it makes your librpitx stable without doing this it seems to be running intermittent.

antonjan avatar Jul 01 '21 11:07 antonjan

Did you remember to compile librpitx prior to compiling gr-rpitx as stated in the README.md file: "For GNU Radio Companion on the host PC to be aware of the gr-rpitx sink block, this tool must also be compiled for the host after installing librpitx on the host (git clone https://github.com/F5OEO/librpitx/ && cd librpitx/src && LDFLAGS="-lm -lrt -lpthread" make && sudo cp librpitx.so /usr/lib)" since your approach is very close to installing gr-rpitx on the host PC to generate the flowgraph?

jmfriedt avatar Jul 03 '21 16:07 jmfriedt