Re: [Cppcms-users] Boost locale with icu backend static linking.
Brought to you by:
artyom-beilis
From: Stanimir M. <sta...@zo...> - 2012-08-07 14:12:11
|
After i made a simple example for linking with boost_locale statically and building it on a clean machine the problems still exists. It could be something with the link order or something else, that i just can't see. Here are some info for my environment: Ubuntu 12.04 server x86_64 g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 - installed from the repository boost 1.49 - compiled from source and installed $ locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= Here is the example that fails to compile: #include <boost/locale.hpp> #include <boost/locale/date_time.hpp> #include <boost/locale/info.hpp> #include <boost/locale/localization_backend.hpp> #include <string> int main(int argc, char* argv[]) { using namespace boost::locale; generator gen; std::locale l = gen("bg_BG.UTF-8"); std::locale::global(l); std::cout.imbue(l); boost::locale::date_time date = boost::locale::date_time(); std::cout << "info: " << std::use_facet<boost::locale::info>(l).country() << std::endl; std::cout << boost::locale::as::date << date << std::endl; } The expected output must be: info: BG 07.08.2012 Compiling with the following command line for dynamic linking works: g++ main.cpp -o test -lboost_filesystem -lboost_thread -lboost_system -lboost_locale -Wl,-Bdynamic The problematic link for static is: $ g++ -Wl,-Bstatic -lboost_system -lboost_filesystem -lboost_locale -static main.cpp -o test Here is the output of the command line for static: /tmp/ccosf6nV.o: In function `main': main.cpp:(.text+0x21): undefined reference to `boost::locale::generator::generator()' main.cpp:(.text+0xbd): undefined reference to `boost::locale::date_time::date_time()' main.cpp:(.text+0x149): undefined reference to `boost::locale::date_time::~date_time()' main.cpp:(.text+0x161): undefined reference to `boost::locale::generator::~generator()' main.cpp:(.text+0x1c3): undefined reference to `boost::locale::date_time::~date_time()' main.cpp:(.text+0x1e0): undefined reference to `boost::locale::generator::~generator()' /tmp/ccosf6nV.o: In function `boost::locale::as::date(std::ios_base&)': main.cpp:(.text._ZN5boost6locale2as4dateERSt8ios_base[boost::locale::as::date(std::ios_base&)]+0x14): undefined reference to `boost::locale::ios_info::get(std::ios_base&)' main.cpp:(.text._ZN5boost6locale2as4dateERSt8ios_base[boost::locale::as::date(std::ios_base&)]+0x21): undefined reference to `boost::locale::ios_info::display_flags(unsigned long)' /tmp/ccosf6nV.o: In function `boost::locale::generator::operator()(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const': main.cpp:(.text._ZNK5boost6locale9generatorclERKSs[boost::locale::generator::operator()(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const]+0x27): undefined reference to `boost::locale::generator::generate(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' /tmp/ccosf6nV.o: In function `boost::locale::info const& std::use_facet<boost::locale::info>(std::locale const&)': main.cpp:(.text._ZSt9use_facetIN5boost6locale4infoEERKT_RKSt6locale[boost::locale::info const& std::use_facet<boost::locale::info>(std::locale const&)]+0xd): undefined reference to `boost::locale::info::id' /tmp/ccosf6nV.o: In function `std::basic_ostream<char, std::char_traits<char> >& boost::locale::operator<< <char>(std::basic_ostream<char, std::char_traits<char> >&, boost::locale::date_time const&)': main.cpp:(.text._ZN5boost6localelsIcEERSt13basic_ostreamIT_St11char_traitsIS3_EES7_RKNS0_9date_timeE[std::basic_ostream<char, std::char_traits<char> >& boost::locale::operator<< <char>(std::basic_ostream<char, std::char_traits<char> >&, boost::locale::date_time const&)]+0x18): undefined reference to `boost::locale::date_time::time() const' main.cpp:(.text._ZN5boost6localelsIcEERSt13basic_ostreamIT_St11char_traitsIS3_EES7_RKNS0_9date_timeE[std::basic_ostream<char, std::char_traits<char> >& boost::locale::operator<< <char>(std::basic_ostream<char, std::char_traits<char> >&, boost::locale::date_time const&)]+0x37): undefined reference to `boost::locale::ios_info::get(std::ios_base&)' main.cpp:(.text._ZN5boost6localelsIcEERSt13basic_ostreamIT_St11char_traitsIS3_EES7_RKNS0_9date_timeE[std::basic_ostream<char, std::char_traits<char> >& boost::locale::operator<< <char>(std::basic_ostream<char, std::char_traits<char> >&, boost::locale::date_time const&)]+0x3f): undefined reference to `boost::locale::ios_info::display_flags() const' main.cpp:(.text._ZN5boost6localelsIcEERSt13basic_ostreamIT_St11char_traitsIS3_EES7_RKNS0_9date_timeE[std::basic_ostream<char, std::char_traits<char> >& boost::locale::operator<< <char>(std::basic_ostream<char, std::char_traits<char> >&, boost::locale::date_time const&)]+0x8c): undefined reference to `boost::locale::ios_info::get(std::ios_base&)' main.cpp:(.text._ZN5boost6localelsIcEERSt13basic_ostreamIT_St11char_traitsIS3_EES7_RKNS0_9date_timeE[std::basic_ostream<char, std::char_traits<char> >& boost::locale::operator<< <char>(std::basic_ostream<char, std::char_traits<char> >&, boost::locale::date_time const&)]+0x99): undefined reference to `boost::locale::ios_info::display_flags(unsigned long)' main.cpp:(.text._ZN5boost6localelsIcEERSt13basic_ostreamIT_St11char_traitsIS3_EES7_RKNS0_9date_timeE[std::basic_ostream<char, std::char_traits<char> >& boost::locale::operator<< <char>(std::basic_ostream<char, std::char_traits<char> >&, boost::locale::date_time const&)]+0xc4): undefined reference to `boost::locale::ios_info::get(std::ios_base&)' main.cpp:(.text._ZN5boost6localelsIcEERSt13basic_ostreamIT_St11char_traitsIS3_EES7_RKNS0_9date_timeE[std::basic_ostream<char, std::char_traits<char> >& boost::locale::operator<< <char>(std::basic_ostream<char, std::char_traits<char> >&, boost::locale::date_time const&)]+0xd3): undefined reference to `boost::locale::ios_info::display_flags(unsigned long)' collect2: ld returned 1 exit status On Thu, Jul 19, 2012 at 11:05 AM, Stanimir Mladenov <sta...@zo...> wrote: > Sorry for bothering you! It should be my something wrong with my > ubuntu development machine, so i will setup a new clean one and i bet > the problem will disappear. If it doesn't then i will write back > again. > > Actually, this looks to be very common problem, i.e. messing up > something bad with multiple installations. That's why i am tring to do > everything in a new virtual machine first, before posting again for > help. > > On Thu, Jul 19, 2012 at 10:54 AM, Artyom Beilis <art...@ya...> wrote: >> - What exactly the error? >> - What symbols are missing? >> - How exactly do you link? >> >> Artyom Beilis >> -------------- >> CppCMS - C++ Web Framework: http://cppcms.com/ >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> ________________________________ >> From: Stanimir Mladenov <sta...@zo...> >> To: CppCMS users group <cpp...@li...> >> Sent: Monday, July 16, 2012 7:10 PM >> Subject: [Cppcms-users] Boost locale with icu backend static linking. >> >> Boost locale with dynamic linking works just fine. When i try to link >> it statically i get bunch of unresolved externals. >> >> 1. I did try with plain icu api call and static linking. Works. >> 2. I tried a simple libboost_filesystem api call with static linking. Works. >> >> The only problem is when I try to link libboost_locale statically. >> Does someone is able to statically link it? >> >> Greetings, >> Stanimir >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> |