discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] gr-trellis: Linking errors with viterbi_algorithm


From: Garver, Paul W
Subject: Re: [Discuss-gnuradio] gr-trellis: Linking errors with viterbi_algorithm_combined()
Date: Wed, 7 Sep 2016 11:58:45 +0000

For those in the future searching the list, I will answer my own question. The problem was that I was calling viterbi_algorithm_combined() with template input type float and output type char. This isn't actually a valid template combination, so the symbol really doesn't exist in the library (can check with nm command). Once I changed to unsigned char or short for the output time, everything compiles fine. I thought the compiler would have flagged this issue in the compiling stage instead of the linking stage, but I suppose with templates things are obfuscated a bit.  Just adding TRELLIS and DIGITAL to GR_REQUIRED_COMPONENTS in the OOT module's root CMakeLists.txt is sufficient for proper linking, as [1] notes.


On Sep 5, 2016, at 11:23 AM, Garver, Paul W <address@hidden> wrote:

I am writing a block (pwg) in an OOT module (gr-research) which calls viterbi_algorithm_combined() in gr-trellis. I can’t seem to get the linker to cooperate. I’ll admit my C++ template skills are a bit rusty, so maybe this is a simple linking-against-a-template issue. Is there something different about linking against viterbi_algorithm_combined() compared with the typical OOT linking described in [1]? Thanks y’all.


Specifically, this is the cmake error:

bash-3.2$ make
[  4%] Building CXX object lib/CMakeFiles/gnuradio-research.dir/pwg_impl.cc.o
/Users/pwg/git_repos/gr-research/lib/pwg_impl.cc:86:14: warning: enumeration value 'ST_ACKREP' not handled in switch [-Wswitch]
      switch(d_state){
             ^
1 warning generated.
[  9%] Linking CXX shared library libgnuradio-research.dylib
Undefined symbols for architecture x86_64:
  "void gr::trellis::viterbi_algorithm_combined<float, char>(int, int, int, std::__1::vector<int, std::__1::allocator<int> > const&, std::__1::vector<int, std::__1::allocator<int> > const&, std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > const&, std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > const&, int, int, int, int, std::__1::vector<float, std::__1::allocator<float> > const&, gr::digital::trellis_metric_type_t, float const*, char*)", referenced from:
      gr::research::pwg_impl::general_work(int, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<void const*, std::__1::allocator<void const*> >&, std::__1::vector<void*, std::__1::allocator<void*> >&) in pwg_impl.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libgnuradio-research.1.0.0git.dylib] Error 1
make[1]: *** [lib/CMakeFiles/gnuradio-research.dir/all] Error 2
make: *** [all] Error 2


My block calls trellis::viterbi_algorithm_combined() from general_work(). The CMakeLists.txt in the root directory of the OOT module has TRELLIS and DIGITAL added as required components:

# Search for GNU Radio and its components and versions. Add any
# components required to the list of GR_REQUIRED_COMPONENTS (in all
# caps such as FILTER or FFT) and change the version to the minimum
# API compatible version required.
set(GR_REQUIRED_COMPONENTS RUNTIME TRELLIS DIGITAL)
find_package(Gnuradio "3.7.2" REQUIRED)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
include(GrVersion)

My understanding from [1] is that no further CMake edits should be required for the compiler to find the proper includes and libraries.

In gr-research/lib/pwg_impl.h has the following include (Shouldn’t be an include problem anyways…)

#include <gnuradio/trellis/core_algorithms.h>


Version Information:
OS Version: MAC OS X 10.10.4
GR Version (gnuradio-config-info -v) v3.7-MacPorts-devel-git-e106376b(20160809), installed from macports
C Compiler: llvm-gcc 
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
C++ Compiler llvm-g++ 
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix


gnuradio.org
Configuring GNU Radio and Out-of-tree (OOT) Modules¶ Configuring GNU Radio and Out-of-tree (OOT) Modules. Quick Start Guide. Configuring Our Project to Use GNU Radio ...



_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

[Prev in Thread] Current Thread [Next in Thread]