C++ Cmake errors with ntcore on jetson tx1

Hello,

We are from Team 5690 Subzero Robotics and we are having some networktable issues while using cmake to make our vision code. We are using ntcore from github and built it using ./gradlew :arm:build without any errors. We added paths in our CMakeLists.txt for ntcore and the networktables/NetworkTable.h. We end up getting an error that looks like this

ubuntu@tegra-ubuntu:~/Desktop/Projects$ cmake .
CUDA_USE_STATIC_CUDA_RUNTIME : OFF
– Found CUDA: /usr/local/cuda-8.0 (found suitable exact version “8.0”)
– Found CUDA: /usr/local/cuda-8.0 (found version “8.0”)
– Configuring done
– Generating done
– Build files have been written to: /home/ubuntu/Desktop/Projects
ubuntu@tegra-ubuntu:~/Desktop/Projects$ make
Scanning dependencies of target ZED_Tracking_Viewer
50%] Building CXX object CMakeFiles/ZED_Tracking_Viewer.dir/src/main.o
[100%] Linking CXX executable “ZED Tracking Viewer”
CMakeFiles/ZED_Tracking_Viewer.dir/src/main.o: In function main': /home/ubuntu/Desktop/Projects/src/main.cpp:32: undefined reference toNetworkTable::SetClientMode()’
/home/ubuntu/Desktop/Projects/src/main.cpp:33: undefined reference to NetworkTable::SetIPAddress(llvm::StringRef)' /home/ubuntu/Desktop/Projects/src/main.cpp:34: undefined reference toNetworkTable::Initialize()’
/home/ubuntu/Desktop/Projects/src/main.cpp:35: undefined reference to NetworkTable::GetTable(llvm::StringRef)' /home/ubuntu/Desktop/Projects/src/main.cpp:37: undefined reference toNetworkTable::Shutdown()’
collect2: error: ld returned 1 exit status
CMakeFiles/ZED_Tracking_Viewer.dir/build.make:141: recipe for target ‘ZED Tracking Viewer’ failed
make[2]: *** [ZED Tracking Viewer] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/ZED_Tracking_Viewer.dir/all’ failed
make[1]: *** [CMakeFiles/ZED_Tracking_Viewer.dir/all] Error 2
Makefile:83: recipe for target ‘all’ failed
make: *** [all] Error 2
ubuntu@tegra-ubuntu:~/Desktop/Projects$

Any ideas? Any help is much appreciated.

Did you add the ntcore library to the target_link_libraries() entry for your executable?

Also, double-check that arm is the correct target type. The TX1 is aarch64 (64-bit ARM architecture). arm might be trying to build a 32-bit library. Use the file command to see what type of library ntcore.* is and make sure it specifies a 64-bit version.

Could you please explain how we could do this? We are a rookie team when it comes to C++ and Vision tracking. Here is a pastbin link (http://pastebin.com/MjM4vLYB) of our CMakeLists.txt(We added comments to what we added) and our path to our project folder is /home/ubuntu/Desktop/Projects

our main.cpp file is in /home/ubuntu/Desktop/Projects/src
our ntcore folder is in /home/ubuntu/Desktop/Projects/ntcore

we used the command ./gradlew :arm:build to build ntcore. ::rtm:: :deadhorse:

You’ll have to figure out what the ntcore library is named and where to find it. I had a build subdir under the ntcore directory and that’s where the libntcore.so library lives for me. Not sure about the gradle build, though, it might be different for you. “find /home/ubuntu/Desktop/Projects/ntcore -name libntcore.so” will show where it is in your setup - use that directory name as the last argument to the find_library command below.

In CMakeLists

find_library(LibNT ntcore /home/ubuntu/Desktop/Projects/ntcore/build)

then uncomment the ${LibNT} line in TARGET_LINK_LIBRARIES on line 99.

Also, adding header files to the list of sources on line 86 is probably wrong.

Thanks so much we successfully built our code. Off to testing :ahh:

Did you require Java to use gradlew to build? Right now we are also using Jetson, Cmake, and C++ but can’t build because we do not have Java installed on it.

Thanks