libboost-date-time abi issue

Heiko Bauke heiko.bauke at mail.de
Mon Mar 21 16:39:08 UTC 2016


Dear Ubuntu Developers,

I am not able to link against libboost_date_time. Compiling the test
program on Ubuntu 16.04 with all recent updates

#include "boost/date_time/gregorian/gregorian.hpp"
#include <iostream>
#include <string>

int main() {
   using namespace boost::gregorian;
   try {
     // The following date is in ISO 8601 extended format (CCYY-MM-DD)
     std::string s("2001-10-9"); //2001-October-09
     date d(from_simple_string(s));
     std::cout << to_simple_string(d) << std::endl;
   }
   catch(std::exception& e) {
     std::cout << "  Exception: " <<  e.what() << std::endl;
   }
   return 0;
}

with »g++ -o test test.cc -lboost_date_time« yields

/tmp/ccwYYS48.o: In function `unsigned short 
boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::string 
const&)':
test.cc:(.text._ZN5boost9date_time19month_str_to_ushortINS_9gregorian10greg_monthEEEtRKSs[_ZN5boost9date_time19month_str_to_ushortINS_9gregorian10greg_monthEEEtRKSs]+0xab): 
undefined reference to `boost::gregorian::greg_month::get_month_map_ptr()'
collect2: error: ld returned 1 exit status

I figured out that the reason for this error is due to the static member 
function get_month_map_ptr in
/usr/lib/x86_64-linux-gnu/libboost_date_time.so.1.58.0 has the abi tag 
cxx11. I think, this function should not have this tag. I speculate it 
was added automatically by the compiler while compiling the library 
because of the function's return value. As a temporary fix I added 
»__attribute((abi_tag("cxx11")))« in the file 
/usr/include/boost/date_time/gregorian/greg_month.hpp to the declaration 
of the static member function get_month_map_ptr.


	Regards,

	Heiko




More information about the Ubuntu-devel-discuss mailing list