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

Müller, Marcus (CEL) mueller at kit.edu
Thu Dec 13 09:56:26 UTC 2018


Hi Doron,

my guess is that you updated the log4cpp header files, but your ld is
still linking to an older version of log4cpp, or vice versa.
Since (as far as I know), gr-osmosdr doesn't use log4cpp itself at all,
this would, for example, happen, if you have a GNU Radio installed that
was built agains an older version of log4cpp, and then you've updated
log4cpp, and now are trying to build software that links agains GNU
Radio.

Best regards,
Marcus
On Wed, 2018-12-12 at 22:44 +0200, Doron Behar wrote:
> 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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: source_impl.cc:(.text.startup+0x6b): undefined reference
> to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: sink_impl.cc:(.text.startup+0x6b): undefined reference
> to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: device.cc:(.text.startup+0x67): undefined reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: osmosdr_src_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: file_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: file_sink_c.cc:(.text.startup+0x6b): undefined reference
> to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: rtl_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: rtl_tcp_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: uhd_sink_c.cc:(.text.startup+0x6b): undefined reference
> to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: uhd_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: miri_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: hackrf_source_c.cc:(.text.startup+0x5f): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: hackrf_sink_c.cc:(.text.startup+0x5f): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: bladerf_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: bladerf_sink_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: rfspace_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: airspy_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: soapy_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: soapy_sink_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: redpitaya_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: redpitaya_sink_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: freesrp_source_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> /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::AppenderMapStorage
> Initializer()'
> /usr/bin/ld: freesrp_sink_c.cc:(.text.startup+0x6b): undefined
> reference to
> `log4cpp::Appender::AppenderMapStorageInitializer::~AppenderMapStorag
> eInitializer()'
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6582 bytes
Desc: not available
URL: <http://lists.osmocom.org/pipermail/osmocom-sdr/attachments/20181213/5174ac0a/attachment.bin>


More information about the osmocom-sdr mailing list