Reputation: 377
When trying to write an OOT block for Gnuradio, I ran cmake ../
, and then make
. The make process successfully builds some objects, but when it gets to the step:
Linking CXX executable test-XXXXXXXX
there is the problem:
libgnuradio-XXXXXXXX.so: undefined reference to 'YYYYYYYY'
YYYYYYYY
is a function defined in a .cc
file, which I add to the _impl.cc
for the block using a header. This source is apparently not being found, despite being in the same source directory as the _impl.cc
file.
Cmake explicitly warns not to make any modifications to the generated Makefile, and it is a fairly complex makefile anyway, so I would be hesitant to try messing with it. Is there another way to direct make to include that additional source when linking?
Upvotes: 1
Views: 422
Reputation: 106
Your best bet is to look at the CMakeLists.txt at the top of your OOT folder. It is most likely that you are seeing a link problem and that a package dependency is not satisfied. The cmake find_package utility can be used to determine if a dependency is available on the system. If you look at the cmake/Modules directory under the main OOT folder, there should be a couple of examples. Cmake ships with many modules so it's likely what you need will exist.
By adding some find_package logic to the main CMakeLists.txt file, and then blowing away the build directory and making it again and executing "cmake ../", the dependency issue should be apparent. Put another way, whatever libgnuradio-*.so thinks is missing must belong to a package that is not installed on your system. Using find_package will confirm it, and then the answer is to install it.
Look at some other CMakeLists.txt files, say, in gr-digital, for find_package examples.
Upvotes: 0