aarossig / nrfnet

Using NRF24L01 as a virtual network device under Linux.
Apache License 2.0
77 stars 19 forks source link

Compilation isssue - RF24.h is Missing? #5

Open ZigiWalter opened 3 years ago

ZigiWalter commented 3 years ago

Hi,

I've hit several compilation issues. I was able to workaround those that required removing the relative paths in "#include" statements and a casting of a "const" parameter, but I'm quite lost about the below error. Did I do anything wrong/overlooked some installation phase?

Thanks.

Scanning dependencies of target nerfnet
[ 50%] Building CXX object net/CMakeFiles/nerfnet.dir/nerfnet_main.o
/home/pi/installs/nrfnet/nerfnet/net/nerfnet_main.cc:21:10: fatal error: RF24/RF24.h: No such file or directory
 #include <RF24/RF24.h>
          ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [net/CMakeFiles/nerfnet.dir/build.make:63: net/CMakeFiles/nerfnet.dir/nerfnet_main.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: net/CMakeFiles/nerfnet.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
ZigiWalter commented 3 years ago

...I think this is the correct link for installing the RF24 dependency: https://nrf24.github.io/RF24/md_docs_linux_install.html

But I'm still not out of the woods :-( I hit many errors like the below, probably because I'm using the wrong compiler version. However, I'm not sure which is required, nor how to tell the build script to use it. AFAIK, the RPI image I use is updated to the most recent version. Help would be greatly appreciated.

>make all [ 37%] Built target util [ 50%] Building CXX object net/CMakeFiles/nerfnet.dir/nerfnet_main.o In file included from /home/pi/installs/nrfnet/nerfnet/net/primary_radio_interface.h:22, from /home/pi/installs/nrfnet/nerfnet/net/nerfnet_main.cc:30: /home/pi/installs/nrfnet/nerfnet/net/radio_interface.h:74:10: error: ‘optional’ in namespace ‘std’ does not name a template type std::optional<uint8_t> id; ^~~~~~~~ /home/pi/installs/nrfnet/nerfnet/net/radio_interface.h:74:5: note: ‘std::optional’ is only available from C++17 onwards std::optional<uint8_t> id; ^~~

ZigiWalter commented 3 years ago

OK, I got it to work on an RPI4!

For whoever may find it useful, here are the things I did, though I suspect there are easier ways:

  1. Installed the RF24 library (https://nrf24.github.io/RF24/md_docs_linux_install.html)
  2. Created a soft link to /nrf24/rf24libs/RF24 in /nrfnet/nerfnet/
  3. Installed (10.1) GCC binaries (https://solarianprogrammer.com/2017/12/08/raspberry-pi-raspbian-install-gcc-compile-cpp-17-programs/)
  4. In step#5 above, a "/usr/include/sys" needs to be created, by in my RPI setup a real folder with this name already existed. Had to rename it.
  5. At this point, compilation still failed for me because of a missing GLIBC version. This is my current workaround (a better solution is needed): sudo mv /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6.org sudo ln -s /opt/gcc-10.1.0/lib/libstdc++.so.6 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6

After all of the above, "NerfNet" works as expected. However, please post fixes/corrections you may have. BTW - I use it in conjunction with"sshuttle" in order to forward all TCP traffic, and also with "ssf" to forward selected UDP traffic - the combination seems to work just fine.

yurdagulOlgun commented 2 years ago

Hi,

I've hit several compilation issues. I was able to workaround those that required removing the relative paths in "#include" statements and a casting of a "const" parameter, but I'm quite lost about the below error. Did I do anything wrong/overlooked some installation phase?

Thanks.

Scanning dependencies of target nerfnet
[ 50%] Building CXX object net/CMakeFiles/nerfnet.dir/nerfnet_main.o
/home/pi/installs/nrfnet/nerfnet/net/nerfnet_main.cc:21:10: fatal error: RF24/RF24.h: No such file or directory
 #include <RF24/RF24.h>
          ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [net/CMakeFiles/nerfnet.dir/build.make:63: net/CMakeFiles/nerfnet.dir/nerfnet_main.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: net/CMakeFiles/nerfnet.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

Hi, How did you solve "include" and "const" things?