22

I installed Qt5.4 with the online installer (working on ubuntu 14). I'm trying to compile my c++ source and link against libQt5Core but ld throw an error:

make
g++ -Wall test.o Party.o Communication.o FileParser.o PeerConnection.o ServerModule.o Utilities.o -o party -g -L/home/bush/Qt/5.4/gcc_64/lib -L/usr/lib/x86_64-linux-gnu/ -lQt5Core -lboost_system -lpthread
/usr/bin/ld: warning: libicui18n.so.53, needed by /home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicuuc.so.53, needed by /home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_setMillis_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_fromUnicode_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_get_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_inDaylightTime_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_open_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_countAvailable_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_countAliases_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `u_errorName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_openCountryTimeZones_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `u_strToUpper_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getDefaultName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `uenum_next_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_strcoll_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getMaxCharSize_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getAvailableName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_open_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_getTimeZoneDisplayName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_toUnicode_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `uenum_close_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_getSortKey_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getAlias_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_close_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_setAttribute_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_close_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_openTimeZoneIDEnumeration_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_openTimeZones_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getStandardName_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_close_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_compareNames_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_clone_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `u_strToLower_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_getDefaultTimeZone_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_open_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_setSubstChars_53'
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_getDSTSavings_53'
collect2: error: ld returned 1 exit status
make: *** [party] Error 1

My makefile is:

CPPFLAGS=-g -c --std=c++0x -I/usr/include -I/home/bush/Qt/5.4/gcc_64/include -I/home/bush/Qt/5.4/gcc_64/include/QtCore -I/usr/include/boost
LDFLAGS=-g -L/home/bush/Qt/5.4/gcc_64/lib -L/usr/lib/x86_64-linux-gnu/ -lQt5Core -lboost_system -lpthread

all:party

party:test.o Party.o Communication.o FileParser.o PeerConnection.o ServerModule.o Utilities.o
    g++ -Wall $^ -o party $(LDFLAGS)

test.o:test.cpp
    g++ $(CPPFLAGS) test.cpp
Party.o:Party.cpp
    g++ $(CPPFLAGS) Party.cpp
Communication.o:Communication.cpp
    g++ $(CPPFLAGS) Communication.cpp
FileParser.o:FileParser.cpp
    g++ -fPIC $(CPPFLAGS) FileParser.cpp
PeerConnection.o:PeerConnection.cpp
    g++ $(CPPFLAGS) PeerConnection.cpp
ServerModule.o:ServerModule.cpp
    g++ $(CPPFLAGS) ServerModule.cpp
Utilities.o:Utilities.cpp
    g++ $(CPPFLAGS) Utilities.cpp
Bush
  • 2,433
  • 5
  • 34
  • 57
  • OS can't find icu v53 libraries (qt was linked against that version), check for `libicui18n` in `/usr/lib64` – gengisdave Apr 05 '15 at 09:23
  • You can solve installing it, or if you have a different version of icu, faking it with a symlink – gengisdave Apr 05 '15 at 10:16
  • I did 'find / -name libicui18n' but no result found.. I also checked with apt-get install but no such package found.. How can I install it – Bush Apr 05 '15 at 10:23
  • I'm not into the apt-get world, but I think the package is called `libicu` and `libicu-dev` for compiling against its librarires. – gengisdave Apr 05 '15 at 11:58
  • Well I faked the lib name with by making link from the libicui18n libicuuc to and libicuuc.so.53. But it searches for symbols that are specific to the 53 version.. like: /home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_setMillis_53' – Bush Apr 05 '15 at 12:16
  • mmm... where the qt libraries come from? it sound you compiled them yourself, so you must have linked against icu 53; on a quick search[1] I found that only Debian unstable have the 53.1 package [1] https://launchpad.net/icu/+packages – gengisdave Apr 05 '15 at 13:50
  • I didn't compiled myself but used the qt online installer from http://www.qt.io/download-open-source/#section-2 I don't know what's wrong. Another thing with qt is that downloading an installer takes like 2 days (regardless of the internet connection you have..) so I couldn't uninstall and install another version of qt yet. – Bush Apr 05 '15 at 13:54
  • 1
    if you can reinstall the actual qt, I suggest you to install the one packaged by ubuntu (debian) devs `apt-get install qt5-default qttools5-dev-tools`; I did it on a Kubuntu and it worked well – gengisdave Apr 05 '15 at 14:19
  • That helped! without even uninstalling the previous version ( since the previous was installed in the desktop) so the libraries that are installed by the apt-get reside in `usr/lib/x86_64-linux-gnu/`. Compilation worked! Pls add this as an answer, maybe it would be helpful to people to know that the online installer doesn't install everything properly. – Bush Apr 05 '15 at 18:54

5 Answers5

20

I came across the same problem. but I find my way out just by this code.

export  LD_LIBRARY_PATH=/usr/local/Qt/5.5/gcc_64/lib:$LD_LIBRARY_PATH
wayne wang
  • 301
  • 2
  • 5
  • 1
    or whatever path you have installed Qt to... but, yes, this works and is the right answer. – Mark Ch Mar 01 '17 at 15:20
  • 2
    Yes, this is the right answer but use your specific install path as previously mentioned. I found that running "ldd libQt5Core.so.5" in the correct directory fails unless LD_LIBRARY_PATH is set correctly. I think what is happening (certainly for me) is that when the main executable is built the elf's library runpath is set to the correct location so libQt5Core is found ok. However, when libQt5Core in turn tries to find the above SO it fails because it has no run path and no LD_LIBRARY_PATH – mark sabido Jun 28 '17 at 13:48
6

In my case it worked after I made 3 symbolic links. The lib was installed but I had a newer version (55) than the one expected (54).

sudo ln -s /usr/local/Qt/5.5/gcc_64/lib/libicui18n.so.54 /usr/lib/x86_64-linux-gnu/libicui18n.so.54
sudo ln -s /usr/local/Qt/5.5/gcc_64/lib/libicuuc.so.54 /usr/lib/x86_64-linux-gnu/libicuuc.so.54
sudo ln -s /usr/local/Qt/5.5/gcc_64/lib/libicudata.so.54 /usr/lib/x86_64-linux-gnu/libicudata.so.54
Ajean
  • 5,528
  • 14
  • 46
  • 69
4

I get such errors when I was trying to build my project under Debian 8 (with libicu52 from official repository) from QtCreator. I solved it by changing 'Environment' for my Qt Kit (5.8.0) to: LD_LIBRARY_PATH=/opt/Qt/5.8/gcc_64/lib:${LD_LIBRARY_PATH}.

Screenshot: Changes marked by red line

Community
  • 1
  • 1
0

Try to add -licuuc to the LDFLAGS of the makefile.

sudo apt-get install libicu-dev
0

I get this error when I was trying to build Iris under Ubuntu. I solved it by removing CONFIG += static from the .pro file

Daniel Georgiev
  • 1,292
  • 16
  • 14