How to compile kmap2qmap

  • Hi,

    For an embedded application I need to tell to Qt what keymap used.
    This application is running trough eglfs platofrm.

    I found that to convert kmap file I have to use kmap2qmap tool but I'm not able to compile it with QtCreator (by loading the .pro file downloaded with qt sources).

    Could somebody help me ?


  • Lifetime Qt Champion


    What error are you getting ?

  • Hi @SGaist ,

    This is the output from qtcreator when I try to compile kmap2qmap project :

    10:45:51: Exécution des étapes pour le projet kmap2qmap...
    10:45:51: Configuration inchangée, étape qmake sautée.
    10:45:51: Débute : "/usr/bin/make" 
    g++ -c -pipe -g -std=c++1y -fno-exceptions -Wall -W -Wvla -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_QML_DEBUG -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_PLATFORMSUPPORT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../kmap2qmap -I. -I/home/vincent/Qt5.7.0/5.7/gcc_64/include -I/home/vincent/Qt5.7.0/5.7/gcc_64/include/QtPlatformSupport -I/home/vincent/Qt5.7.0/5.7/gcc_64/include/QtPlatformSupport/5.7.0 -I/home/vincent/Qt5.7.0/5.7/gcc_64/include/QtPlatformSupport/5.7.0/QtPlatformSupport -I/home/vincent/Qt5.7.0/5.7/gcc_64/include/QtGui/5.7.0 -I/home/vincent/Qt5.7.0/5.7/gcc_64/include/QtGui/5.7.0/QtGui -I/home/vincent/Qt5.7.0/5.7/gcc_64/include/QtCore/5.7.0 -I/home/vincent/Qt5.7.0/5.7/gcc_64/include/QtCore/5.7.0/QtCore -I/home/vincent/Qt5.7.0/5.7/gcc_64/include/QtGui -I/home/vincent/Qt5.7.0/5.7/gcc_64/include/QtCore -I.moc -isystem /usr/include/libdrm -I/home/vincent/Qt5.7.0/5.7/gcc_64/mkspecs/linux-g++ -o .obj/main.o ../kmap2qmap/main.cpp
    g++ -Wl,--gc-sections -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../lib -Wl,-rpath,\$ORIGIN/../lib -Wl,-rpath-link,/home/vincent/Qt5.7.0/5.7/gcc_64/lib -o /bin/kmap2qmap .obj/main.o   -L/usr/lib64 -L/home/vincent/Qt5.7.0/5.7/gcc_64/lib -lQt5PlatformSupport -lfontconfig -lfreetype -lQt5DBus -ldl -lgthread-2.0 -pthread -lrt -lglib-2.0 -lXrender -lXext -lX11 -lm -lEGL -lQt5Gui -lQt5Core -lGL -lpthread 
    /usr/bin/ld: cannot open output file /bin/kmap2qmap: Permission denied
    collect2: error: ld returned 1 exit status
    make: *** [/bin/kmap2qmap] Error 1
    10:45:52: Le processus "/usr/bin/make" s'est terminé avec le code 2.
    Erreur lors de la compilation/déploiement du projet kmap2qmap (kit : Desktop Qt 5.7.0 GCC 64bit)
    When executing step "Make"
    10:45:52: Temps écoulé : 00:01.

    When I open the projetct, this message appears :Error while parsing file /home/vincent/Téléchargements/qt-everywhere-opensource-src-5.7.1/qttools/src/kmap2qmap/ Giving up.


  • Lifetime Qt Champion

    You are trying to store the build result in /bin which you don't have access to (which is normal).

    You shouldn't do that, what version of Qt are you using to build that utility ?

  • I'm using Qt 5.7. How to change the output directory ?

  • Lifetime Qt Champion

    @VincentB Can you post the *.pro file of that project?

  • Sure :

    QT = core platformsupport-private
    CONFIG += console
    SOURCES += main.cpp

    This is the .pro file contains in qt sources (qttools/src/kmap2qmap)

  • When I copy/pastethe commands found in the output compilation sheet in QtCreator in console and modify -o /bin/kmap2qmap to -o ../../bin/kmap2qmap it works.

    But the output of executing kmap2qmap is :

    ./kmap2qmap: /usr/lib/x86_64-linux-gnu/ no version information available (required by ./kmap2qmap)
    ./kmap2qmap: relocation error: ./kmap2qmap: symbol _ZN7QString13toUtf8_helperERKS_, version Qt_5 not defined in file with link time reference

  • Lifetime Qt Champion

    Are you sure you are not mixing your distribution Qt with the one you installed from the official installer ?

  • I hope not...

    How I can check this point ?

    EDIT : Ouch.. I'm a little bit confused : On QtCreator in help menu --> based on Qt 5.7.0
    When I type in a console

    qmake -v

    It's output :

    QMake version 3.0
    Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu

    So I guess there is a conflict there...

  • Lifetime Qt Champion

    If you're on the command line, just calling qmake will call your system's qmake. Use the full path.

    If using Qt Creator, check the Kit you are using.

  • Kit is using Qt5.7.
    Even try with full path to qmake in Qt5.7 directory, still have the same issue :

    ./kmap2qmap: /usr/lib/x86_64-linux-gnu/ no version information available (required by ./kmap2qmap)

  • Lifetime Qt Champion

    Additional note: the Qt version used to build Qt Creator doesn't matter in regard to the version you use to build your application. You can use Qt Creator with several version of Qt for several different architectures, device etc.

    You can try with LD_LIBRARY_PATH=/path/to/your/Qt/5.7/lib/path ./kmap2qmap

  • Hi @SGaist ,

    Thanks for the tip, it works. But now, I have to clean my qt installations ...

  • Hi @VincentB
    can you explain how you did it?
    i gave myselv priviledges on /bin so that on QTCreator buld kmap2qmap without any errors.
    Now i am facing a problem with this example:

    kmap2qmap i386/qwertz/de-latin1-nodeadkeys.kmap include/ de-latin1-nodeadkeys.qmap

    It gives me this error:

    /bin/kmap2qmap: error while loading shared libraries: cannot open shared object file: No such file or directory

  • Hi,

    i made it work with the tool kmap2qmap and loaded like this on main:

    QEglFSFunctions myKeyboard_Layout;

    The keymaps on my embedded OS where all with .gz zipped. To make it work with the tool i had to "gunzip" all the files from
    /usr/share/keymaps/i386/qwertz and /usr/share/keymaps/i386/include
    /usr/share/keymaps/i386/qwertz and /usr/share/keymaps/i386/qwertz

    Than do:
    kmap2qmap /usr/share/keymaps/i386/qwertz/de-latin1-nodeadkeys.kmap de-latin1-nodeadkeys.qmap

    After that you have your .qmap file. Copy it to the directory where your application runs at and add the function in main to set the right keymap fo the keyboard.

  • Lifetime Qt Champion

    Thanks for sharing your solution !

    Happy hacking :)

Log in to reply