flatpak-builder icon indicating copy to clipboard operation
flatpak-builder copied to clipboard

qmake buildsystem fails to install libraries

Open kebekus opened this issue 3 years ago • 8 comments

Linux distribution and version

fedora 34

Flatpak version

1.10.2

Description of the problem

I am trying to build the QtWebview as a module for my project "Enroute Flight Navigation". The library builds fine, but flatpak-builder fails at the install step. I have not been able to fix the issue or find a workaround, and I would be extremely grateful for any help that I could get. I attach the manifest file that I use.

{
    "app-id": "de.akaflieg_freiburg.enroute",
    "runtime": "org.kde.Platform",
    "runtime-version": "5.15",
    "sdk": "org.kde.Sdk",
    "command": "enroute",
    "finish-args": [
        "--share=ipc",
        "--share=network",
        "--socket=x11",
        "--socket=wayland",
        "--system-talk-name=org.freedesktop.GeoClue2",
        "--talk-name=org.freedesktop.Notifications"
    ],
    "modules": [
        {
            "name": "qt5-qtwebview",
            "buildsystem": "qmake",
            "cleanup-platform": [ "/bin" ],
            "sources": [ { "type": "git", "url": "https://invent.kde.org/qt/qt/qtwebview.git", "commit": "920de5f" } ]
        },
        {
            "name": "enroute",
            "buildsystem": "cmake-ninja",
            "config-opts": ["-DCMAKE_BUILD_TYPE=RelWithDebInfo"],
            "sources": [
                {
                    "type": "git",
                    "url": "https://github.com/Akaflieg-Freiburg/enroute.git",
                    "commit": "5ff9fbf6ea6f6649e60639838dd7225bf1d0b972"
                }
            ]
        }
    ]
}

Steps to reproduce

  • Save the manifest file as de.akaflieg_freiburg.enroute.json
  • Run flatpak-builder as flatpak-builder flatpakBuildDirectory de.akaflieg_freiburg.enroute.json
  • flatpak-builder will download all sources, build the QtWebview module and abort on installation with the error message mentioned below
/usr/bin/qmake -install qinstall -exe ../../lib/libQt5WebView.so.5.15.3 /usr/lib/x86_64-linux-gnu/libQt5WebView.so.5.15.3
Error copying ../../lib/libQt5WebView.so.5.15.3 to /usr/lib/x86_64-linux-gnu/libQt5WebView.so.5.15.3: Cannot create /usr/lib/x86_64-linux-gnu/libQt5WebView.so.5.15.3 for output

kebekus avatar Jul 27 '21 05:07 kebekus

This would be a flatpak-builder bug, but you actually just need to set make-install-args as done here. (Not sure if this something that f-b should be doing, though.)

refi64 avatar Aug 23 '21 21:08 refi64

Dear refi64,

I tried that. The problem is now that the install step installs all libraries to /app/usr/lib/x86_64-linux-gnu. This is problematic for a number of reasons.

  • QMake does not find the libraries when building dependent modules.
  • CMake does not find the libraries and development files when building my app.
  • The programs that get eventually compiled cannot find the libraries.

I have tried to copy the libraries manually to /app/lib and other places, but that never worked. I suspect that QMake hardcodes the install path somehow into the libraries…

Best

Stefan.

kebekus avatar Aug 24 '21 11:08 kebekus

Looking at this again, it seems like there is already a Flatpak of this application that solves the issue by setting Qt5WebView_DIR. (If you want to take ownership if the existing manifest on Flathub, see here.)

That being said, it does seem like better qmake support was intended at some point, so I'm moving this into the flatpak-builder repo.

refi64 avatar Aug 24 '21 16:08 refi64

Dear refi64,

thanks for your reply. The manifest is exactly the app that I am currently packaging. The problem is not solved, though because

  • the app compiles, but still does not find the library
  • I need another component, QtWebEngine, and I have so far failed to package the two components together

Any help is greatly appreciated.

Best,

Stefan.

kebekus avatar Aug 24 '21 18:08 kebekus

Same problem here, when building another qt library needed as dependency.

app-id: com.savvycan.SavvyCAN
runtime: org.kde.Platform
runtime-version: "5.15-22.08"
sdk: org.kde.Sdk
command: SavvyCAN
finish-args:
  - --share=ipc
  - --socket=wayland
  - --socket=fallback-x11
  - --filesystem=host
  - --device=all
  - --share=network
modules:
  - name: qt5-qtserialbus
    buildsystem: qmake
# does not work either
#    make-install-args:
#      - PREFIX=/app
    cleanup-platform:
      - /bin
    sources:
      - type: git
        url: https://invent.kde.org/qt/qt/qtserialbus.git
        tag: "5.15"
        commit: 180cb13048a24510f9a1b20796772d27da762bdd
# - name: SavvyCAN
#   buildsystem: qmake
#   sources:
#     - type: git
#       url: https://github.com/collin80/SavvyCAN.git
#       sha256: 8a929c1763d5df8859a2d0582cd2e1531b6a64db

qmake gives this summary when flatpak-builder runs it:

Configure summary:

Qt SerialBus:
  Socket CAN ............................. yes
  Socket CAN FD .......................... yes
  SerialPort Support ..................... yes

Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into '/usr'.
                          ^^^^^^

The installation prefix is seemingly not set correctly, because the build breaks with:

cd src/ && ( test -e Makefile || /usr/bin/qmake -o Makefile /run/build/qt5-qtserialbus/src/src.pro 'PREFIX='\''/app'\''' ) && make -f Makefile install
make[1]: Entering directory '/run/build/qt5-qtserialbus/src'
cd serialbus/ && ( test -e Makefile || /usr/bin/qmake -o Makefile /run/build/qt5-qtserialbus/src/serialbus/serialbus.pro 'PREFIX='\''/app'\''' ) && make -f Makefile install
make[2]: Entering directory '/run/build/qt5-qtserialbus/src/serialbus'
/usr/bin/qmake -install qinstall -exe ../../lib/libQt5SerialBus.so.5.15.7 /usr/lib/x86_64-linux-gnu/libQt5SerialBus.so.5.15.7
Error copying ../../lib/libQt5SerialBus.so.5.15.7 to /usr/lib/x86_64-linux-gnu/libQt5SerialBus.so.5.15.7: Cannot create /usr/lib/x86_64-linux-gnu/libQt5SerialBus.so.5.15.7 for output
make[2]: *** [Makefile:1324: install_target] Error 3
make[2]: Leaving directory '/run/build/qt5-qtserialbus/src/serialbus'
make[1]: *** [Makefile:61: sub-serialbus-install_subtargets] Error 2
make[1]: Leaving directory '/run/build/qt5-qtserialbus/src'
make: *** [Makefile:61: sub-src-install_subtargets] Error 2
Error: module qt5-qtserialbus: Child process exited with code 2

This seems like a bug to me, is there a workaround available?

mbodmer avatar Nov 22 '22 21:11 mbodmer

@mbodmer That project supports cmake so use that. qmake is dead.

TingPing avatar Nov 26 '22 16:11 TingPing

@TingPing Unfortunately not on the QT5 Branches, but thanks anyway

mbodmer avatar Nov 26 '22 20:11 mbodmer