Adrian17
Adrian17

Reputation: 443

Unable to statically link boost-locale due to libicu linking errors on Ubuntu 18.04

The following code:

#include <boost/locale.hpp>
int main()
{
    using namespace boost::locale;
    generator gen;
}

Built with the following flags:

g++ -static -static-libstdc++ -pthread main.cpp -lboost_locale -lboost_system -licuuc -licudata -licui18n

Fails to link with the following errors:

(.text+0x16b8): undefined reference to `icu_60::CacheKeyBase::~CacheKeyBase()'
(.text+0x1c8d): undefined reference to `icu_60::UVector64::~UVector64()'
(.text+0x7dc): undefined reference to `icu_60::UCharsTrie::Iterator::~Iterator()'
...hundreds of other undefined symbols
...(the sample code also has boost linking errors, but let's ignore them, as they only appear in my attempt of reproduction; the real code I have issues with has only icu-related link errors)

I'm using Ubuntu 18.04, with both libboost-all-dev and libicu-dev installed from the Ubuntu repositories. I'm probably missing some trivial component/flag/library needed to make it link together, but am unable to find it.

Upvotes: 3

Views: 1521

Answers (0)

Related Questions