NoodleCollie
NoodleCollie

Reputation: 1097

Can I compile a Qt application while ignoring Qt's packaged libraries?

I am attempting to compile a Qt application in Antergos Arch Linux, and the application makes use of icu-related libraries. I was a little confused when I got the following linker errors:

/usr/bin/ld: warning: libicuuc.so.60, needed by /usr/lib/libxml2.so.2, may conflict with libicuuc.so.56
/usr/bin/ld: warning: libicudata.so.60, needed by /usr/lib/libicuuc.so.60, may conflict with libicudata.so.56

These were followed by several undefined references to functions from the libraries. I double-checked all the versions of libicu* that I had on my system and could only find version 60; it wasn't until I looked in my Qt install directory, under Qt/5.10.0/gcc_64/lib, that I realised Qt was providing the version 56 library files.

I'm not all that hot on linker-related problems. Is it possible to have the compiler ignore the libraries provided with Qt and just link against the version 60 libs that I already have on my system? If not, what are my options for workarounds?

Upvotes: 0

Views: 417

Answers (2)

Benjamin T
Benjamin T

Reputation: 8321

Yes and no.

In theory Qt could simply use the v60 instead of the v56 icu library, provided that the 2 versions are binary compatible.

However, Qt libraries specifically require the version 56 of the icu libraries. Also you are trying to use libxml which requires the version 60 of the icu libraries. That means that you need both version 56 and 60 at the same time, which is not possible because you end up with conflicting symbols.

The origin of you issue is likely that you use the Qt packages provided by the Qt Company. Such packages are built to work with most Linux distributions, but they cannot be 100% compatible.

The solution is to use builds of Qt and libxml that use the same version of the icu libraries. The easiest solution is to use the Qt libraries provided by your Linux distro. Another solution is to build Qt from source.

Upvotes: 2

Thijs
Thijs

Reputation: 738

Define the order of of the v60 libs before Qt/(...)/lib; in your PATH variable. If you're using a bash shell, refresh it after you change the PATH variable by running hash.

Upvotes: 0

Related Questions