Using NTCore without building project with CMake

My team is using a Jetson Nano for vision this year, and our data is getting pushed to Network Tables. We’re currently using Python but we want to switch to C++ for improved performance. Currently we use the pynetworktables library for Python and as I understand it the only real library for C++ network tables is the official NTCore. I compiled and installed allwpilib with CMake (using WPILib’s CMake system) on the Nano, and our build system for the C++ code is Makefile. I made sure to include the shared object files and the header files properly with GCC, but whenever I compile the project it complains that it’s missing “wpi/deprecated.h”. I went through the installation and never found such a file, so I’m stuck assuming that it’s created/managed by CMake. Is there a way to avoid using CMake and sticking with just Makefiles? I’d rather not redo the whole build system again and only run just 1 command to compile our project rather than have to deal with CMake’s building style.

If you need code snippets to help me, I currently can’t provide them as they aren’t pushed to our GitHub and we don’t meet again till Thursday, sorry!

What are the include paths you are specifying? You need to include both the ntcore and wpiutil include directories, as the wpi/deprecated.h header is part of wpiutil. You’re doing “make install” when you built allwpilib, correct?

Yes, I’m performing the installation step, which installs to /usr/local/wpiutil on the system, with the appropriate . I’m pointing GCC to “include” from the include folder and added the lib folder to the paths to check for shared objects. As I said at the end of my post I don’t have access to the modified Makefile yet but would not including the base wpilib shared object likely cause that error?

No. That file is part of the wpiutil portion of the build.

It would be very helpful for you to provide what the actual g++ command line is.

I’ve been able to build it on the Jetson. Are you getting the errors when you make allwpilib? Or when you try to build your own project? To build allwpilib on the Nano I had to edit the CMakeList.txt to set the following:

option(WITHOUT_JAVA “don’t include java and JNI in the build” ON)
option(BUILD_SHARED_LIBS “build with shared libs (needed for JNI)” ON)
option(WITHOUT_CSCORE “Don’t build cscore (removes OpenCV requirement)” ON)
option(WITHOUT_ALLWPILIB “Don’t build allwpilib (removes OpenCV requirement)” ON)

Also make sure your not doing an in-source build. I created directory called buildcmake and ran “cmake …” from within there. That’s where I ran make from as well.

In the CMakeList.txt for my own C++ code, I had to add the following:
find_package(wpiutil REQUIRED)
find_package(ntcore REQUIRED)

I don’t use wpiutil directly, but it was needed by NTCore. I didn’t have to do anything with the include_directories in the CMakeList.txt for my project as find_package takes care of that.

I hope this helps! It works great once you get it on line, and the Nano really is a nice little device.

It’s not necessary to edit the CMakeLists.txt… all of these can be defined when you run cmake, using -D (e.g. -DWITHOUT_JAVA=yes).

This is correct, but the OP isn’t using cmake, they’re building their code with just a plain Makefile.

Thanks for the info about the command line parameter. Kind of new to make myself.

Sorry for the late response, but we got it figured out. Originally we used -I/usr/local/wpilib/include to grab the include files, but the rest of the .h files couldn’t be properly found because of the root of the include path we added didn’t match with what the source files expected.
We added each folder inside the wpilib include folder and that worked out best, and it looked like this:

INCLUDES= -I/usr/local/wpilib/include/wpiutil \
    -I/usr/local/wpilib/include/cameraserver/ \
    -I/usr/local/wpilib/include/cscore/ \

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.