[SOLVED] Compilation problems in environment with Qt 4.8 and 5.1

  • Hello, I need some help figuring out what is going on here.

    I'm on Ubuntu 12. I've installed Qt 5.1 and Qt 4.8 on my system (in this order). For both, I used the downloads from Qt's website instead of searching the software center. After installing Qt 4.8, I had to manually add the 4.8 version and kit to Qt Creator. By the way, I'm using the Qt Creator that came with the Qt 5.1 installation, since the Qt 4.8 install didn't come with Qt Creator.

    I tried compiling a 4.8 project, and for some reason it gave me errors related to libQt5Core:

    @/usr/bin/ld: warning: libicui18n.so.51, needed by /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: warning: libicuuc.so.51, needed by /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ucnv_toUnicode_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toucol_setAttribute_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ures_open_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toucnv_open_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ucnv_close_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toucnv_getMaxCharSize_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ucol_close_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toucnv_countAliases_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ucol_open_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toucnv_getStandardName_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ucol_getSortKey_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference tou_strToUpper_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to u_errorName_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toucol_getAttribute_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ucnv_getDefaultName_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference tou_strToLower_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ucnv_getAlias_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toucol_strcoll_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ucnv_setSubstChars_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toucnv_countAvailable_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ucnv_compareNames_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toucnv_fromUnicode_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to ures_getStringByKey_51' /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference toures_close_51'
    /home/person/Qt5.1.0/5.1.0/gcc/lib/libQt5Core.so.5: undefined reference to `ucnv_getAvailableName_51'
    collect2: ld returned 1 exit status
    make: *** [TheProject] Error 1
    10:20:42: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project TheProject (kit: Qt 4.8.5)
    When executing step 'Make'@

    Somehow the build process is looking for Qt 5.1 stuff. I have no idea why. Could it be an environment variable that was set when installing Qt 5.1 that I don't know of? What is the problem?

  • Lifetime Qt Champion


    Are you sure your project is using the right kit ?

  • Thanks for the quick reply!

    I think I am... I had to add the kit manually though, after installing 4.8. All I did was add Qt 4.8 as a version manually and create a new kit using this version. Is that enough?

    Here's a screenshot of the kit I'm using to compile the project:


  • Moderators

    Those are general Qt Creator settings. You need to modify settings for your specific project: click on "Project" button on the left-side pane in Qt Creator while your project is open.

  • The 'Qt 4.8.5' kit I created is the one I'm using to compile this project.

  • This is an excerpt of the Makefile generated by qmake for this project:

    @####### Compiler, tools and options

    CC = gcc
    CXX = g++
    CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
    CXXFLAGS = -pipe -fpermissive -g -Wall -W -D_REENTRANT $(DEFINES)
    INCPATH = -I../../../../Qt-4.8.5/mkspecs/linux-g++ -I. -I../../../../Qt-4.8.5/include/QtCore -I../../../../Qt-4.8.5/include/QtNetwork -I../../../../Qt-4.8.5/include/QtGui -I../../../../Qt-4.8.5/include/QtXml -I../../../../Qt-4.8.5/include/QtSql -I../../../../Qt-4.8.5/include -I/home/person/Projetos/trunk/fonte/TheProject/../fonte/qextserialport-1.2rc/src -I. -Ilib -I. -I.
    LINK = g++
    LFLAGS = -Wl,-rpath,/home/person/Qt-4.8.5/lib
    LIBS = $(SUBLIBS) -L/home/person/Qt-4.8.5/lib -L/home/person/Projetos/trunk/fonte/TheProject/lib/build -L/home/person/Projetos/trunk/fonte/TheProject/ -lconvecf -L/home/person/Projetos/trunk/fonte/TheProject/lib/build/ -lqextserialport -lAssinatura -lQtSql -L/home/person/Qt-4.8.5/lib -lQtXml -lQtGui -L/usr/X11R6/lib -lQtNetwork -lQtCore -lpthread
    AR = ar cqs
    RANLIB =
    QMAKE = /home/person/Qt-4.8.5/bin/qmake
    TAR = tar -cf
    COMPRESS = gzip -9f
    COPY = cp -f
    SED = sed
    COPY_DIR = $(COPY) -r
    STRIP = strip
    INSTALL_FILE = install -m 644 -p
    INSTALL_PROGRAM = install -m 755 -p
    DEL_FILE = rm -f
    SYMLINK = ln -f -s
    DEL_DIR = rmdir
    MOVE = mv -f
    CHK_DIR_EXISTS= test -d
    MKDIR = mkdir -p@

    You can see I'm using the correct kit.

  • Moderators


    Build -> Clean Project "XYZ"

    Build -> Run qmake

    Build -> Build Project "XYZ"

  • Thanks for replying JKSH,

    I did that a few times already, and it has not changed the result. I'm completely out of ideas...

  • I figured it out... turns out I was trying to link to a library that was compiled with Qt 5.1.

  • [quote author="tiredtyrant" date="1374005189"]I figured it out... turns out I was trying to link to a library that was compiled with Qt 5.1. [/quote]

    How do you fix that?

  • Lifetime Qt Champion

    He probably rebuild the library using Qt5 and linked to that one.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.