ld error when building latest git version. undefined reference to log4cpp::Appender ...

Doron Behar doron.behar at gmail.com
Wed Dec 12 20:44:11 UTC 2018


So I wanted to compile gr-osmosdr from source. I created a build
directory and I ran `cmake ..` and then `make`.

These are the errors I got:

```
[ 57%] Linking CXX shared library libgnuradio-osmosdr-0.1.5git.so
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/source_impl.cc.o: in function `_GLOBAL__sub_I_source_impl.cc':
source_impl.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: source_impl.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/sink_impl.cc.o: in function `_GLOBAL__sub_I_sink_impl.cc':
sink_impl.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: sink_impl.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/device.cc.o: in function `_GLOBAL__sub_I_device.cc':
device.cc:(.text.startup+0x60): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: device.cc:(.text.startup+0x67): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/osmosdr/osmosdr_src_c.cc.o: in function `_GLOBAL__sub_I_osmosdr_src_c.cc':
osmosdr_src_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: osmosdr_src_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/file/file_source_c.cc.o: in function `_GLOBAL__sub_I_file_source_c.cc':
file_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: file_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/file/file_sink_c.cc.o: in function `_GLOBAL__sub_I_file_sink_c.cc':
file_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: file_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/rtl/rtl_source_c.cc.o: in function `_GLOBAL__sub_I_rtl_source_c.cc':
rtl_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: rtl_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/rtl_tcp/rtl_tcp_source_c.cc.o: in function `_GLOBAL__sub_I_rtl_tcp_source_c.cc':
rtl_tcp_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: rtl_tcp_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/uhd/uhd_sink_c.cc.o: in function `_GLOBAL__sub_I_uhd_sink_c.cc':
uhd_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: uhd_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/uhd/uhd_source_c.cc.o: in function `_GLOBAL__sub_I_uhd_source_c.cc':
uhd_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: uhd_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/miri/miri_source_c.cc.o: in function `_GLOBAL__sub_I_miri_source_c.cc':
miri_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: miri_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/hackrf/hackrf_source_c.cc.o: in function `_GLOBAL__sub_I_hackrf_source_c.cc':
hackrf_source_c.cc:(.text.startup+0x58): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: hackrf_source_c.cc:(.text.startup+0x5f): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/hackrf/hackrf_sink_c.cc.o: in function `_GLOBAL__sub_I_hackrf_sink_c.cc':
hackrf_sink_c.cc:(.text.startup+0x58): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: hackrf_sink_c.cc:(.text.startup+0x5f): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/bladerf/bladerf_source_c.cc.o: in function `_GLOBAL__sub_I_bladerf_source_c.cc':
bladerf_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: bladerf_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/bladerf/bladerf_sink_c.cc.o: in function `_GLOBAL__sub_I_bladerf_sink_c.cc':
bladerf_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: bladerf_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/rfspace/rfspace_source_c.cc.o: in function `_GLOBAL__sub_I_rfspace_source_c.cc':
rfspace_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: rfspace_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/airspy/airspy_source_c.cc.o: in function `_GLOBAL__sub_I_airspy_source_c.cc':
airspy_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: airspy_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/soapy/soapy_source_c.cc.o: in function `_GLOBAL__sub_I_soapy_source_c.cc':
soapy_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: soapy_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/soapy/soapy_sink_c.cc.o: in function `_GLOBAL__sub_I_soapy_sink_c.cc':
soapy_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: soapy_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/redpitaya/redpitaya_source_c.cc.o: in function `_GLOBAL__sub_I_redpitaya_source_c.cc':
redpitaya_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: redpitaya_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/redpitaya/redpitaya_sink_c.cc.o: in function `_GLOBAL__sub_I_redpitaya_sink_c.cc':
redpitaya_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: redpitaya_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/freesrp/freesrp_source_c.cc.o: in function `_GLOBAL__sub_I_freesrp_source_c.cc':
freesrp_source_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: freesrp_source_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
/usr/bin/ld: CMakeFiles/gnuradio-osmosdr.dir/freesrp/freesrp_sink_c.cc.o: in function `_GLOBAL__sub_I_freesrp_sink_c.cc':
freesrp_sink_c.cc:(.text.startup+0x54): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::AppenderMapStorageInitializer()'
/usr/bin/ld: freesrp_sink_c.cc:(.text.startup+0x6b): undefined reference to `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorageInitializer()'
collect2: error: ld returned 1 exit status
make[2]: *** [lib/CMakeFiles/gnuradio-osmosdr.dir/build.make:555: lib/libgnuradio-osmosdr-0.1.5git.so.0.0.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:141: lib/CMakeFiles/gnuradio-osmosdr.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
```

As you can see, all error messages refer to the same reference to a
log4cpp appender function.

I have log4cpp version 1.1.3 installed by my package manager on Arch
Linux. It is installed in /usr/lib. It seems like a missing library in
CMakeLists.txt . Am I correct?

Thanks for creating this software.


More information about the osmocom-sdr mailing list