probonopd / go-appimage

Go implementation of AppImage tools
MIT License
812 stars 71 forks source link

Error during build "Got empty qtPrfxpath, exiting" #300

Open AlbrechtL opened 2 months ago

AlbrechtL commented 2 months ago

Hi,

I'm trying to port my project https://github.com/AlbrechtL/welle.io/ to go-appimage . Unfortunately, I'm getting the errors Got empty qtPrfxpath, exiting

More logs

2024/08/30 18:30:22 libraryLocations: [/home/runner/work/welle.io/Qt/6.7.2/gcc_64/lib appdir/usr/bin /usr/lib64 /lib64 /usr/lib /lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /lib32 /usr/lib32 /opt/hostedtoolcache/Python/3.11.9/x64/lib /usr/lib/x86_64-linux-gnu/pulseaudio /lib/x86_64-linux-gnu/pulseaudio /lib/x86_64-linux-gnu/gconv]
2024/08/30 18:30:22 len(allELFs): 336
2024/08/30 18:30:22 Adding fontconfig symlink... (is this really the right thing to do?)
2024/08/30 18:30:22 Adding AppRun...
2024/08/30 18:30:22 Find out whether Qt is a dependency of the application to be bundled...
2024/08/30 18:30:22 Detected Qt 6
2024/08/30 18:30:22 Offset of qt_prfxpath: 4908300
2024/08/30 18:30:22 Length of value of qt_prfxpath: 0
2024/08/30 18:30:22 qt_prfxpath: 
2024/08/30 18:30:22 Could not get qt_prfxpath
2024/08/30 18:30:22 Got empty qtPrfxpath, exiting
Error: Process completed with exit code 1.

welle.io Github actions file: https://github.com/AlbrechtL/welle.io/blob/ed68a30a6d01e2feb73cdaf91c6a8c83bd241383/.github/workflows/linux.yml welle.io Github actions jobs: https://github.com/AlbrechtL/welle.io/actions/runs/10637457369/job/29491361238

Do you have a hint what is going wrong?

probonopd commented 2 months ago

It looks like qt_prfxpath is missing or cannot be read from your Qt installation. Where did you get your Qt from? Is the environment variable $QTDIR set, and where is it pointing? (If it is not set or to a wrong path, you might try to set it to the folder of your Qt install that contains /plugins, /qml,...

Related:

AlbrechtL commented 2 months ago

Here are all environment variables of the GitHub runner. So far I did not set $QTDIR explicitly because all QT related stuff should be done by https://github.com/marketplace/actions/install-qt.

ACCEPT_EULA=Y
ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE=/opt/actionarchivecache
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
ANDROID_HOME=/usr/local/lib/android/sdk
ANDROID_NDK=/usr/local/lib/android/sdk/ndk/27.0.12077973
ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/27.0.12077973
ANDROID_NDK_LATEST_HOME=/usr/local/lib/android/sdk/ndk/27.0.12077973
ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/27.0.12077973
ANDROID_SDK_ROOT=/usr/local/lib/android/sdk
ANT_HOME=/usr/share/ant
AZURE_EXTENSION_DIR=/opt/az/azcliextensions
BOOTSTRAP_HASKELL_NONINTERACTIVE=1
CHROMEWEBDRIVER=/usr/local/share/chromedriver-linux64
CHROME_BIN=/usr/bin/google-chrome
CI=true
CONDA=/usr/share/miniconda
DATE=20240831
DEBIAN_FRONTEND=noninteractive
DEPLOYMENT_BASEPATH=/opt/runner
DOTNET_MULTILEVEL_LOOKUP=0
DOTNET_NOLOGO=1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
EDGEWEBDRIVER=/usr/local/share/edge_driver
GECKOWEBDRIVER=/usr/local/share/gecko_driver
GHCUP_INSTALL_BASE_PREFIX=/usr/local
GITHUB_ACTION=__run_3
GITHUB_ACTIONS=true
GITHUB_ACTION_REF=
GITHUB_ACTION_REPOSITORY=
GITHUB_ACTOR=AlbrechtL
GITHUB_ACTOR_ID=11171787
GITHUB_API_URL=https://api.github.com/
GITHUB_BASE_REF=
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_46a53540-9c9b-43ec-884a-287250e8cb6f
GITHUB_EVENT_NAME=push
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=
GITHUB_JOB=qtbuild
GITHUB_OUTPUT=/home/runner/work/_temp/_runner_file_commands/set_output_46a53540-9c9b-43ec-884a-287250e8cb6f
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_46a53540-9c9b-43ec-884a-287250e8cb6f
GITHUB_REF=refs/heads/next
GITHUB_REF_NAME=next
GITHUB_REF_PROTECTED=true
GITHUB_REF_TYPE=branch
GITHUB_REPOSITORY=AlbrechtL/welle.io
GITHUB_REPOSITORY_ID=49383207
GITHUB_REPOSITORY_OWNER=AlbrechtL
GITHUB_REPOSITORY_OWNER_ID=11171787
GITHUB_RETENTION_DAYS=90
GITHUB_RUN_ATTEMPT=1
GITHUB_RUN_ID=10643074444
GITHUB_RUN_NUMBER=19
GITHUB_SERVER_URL=https://github.com/
GITHUB_SHA=d4f3cefc1439ad884f8b20b1d6df90056d463c07
GITHUB_STATE=/home/runner/work/_temp/_runner_file_commands/save_state_46a53540-9c9b-43ec-884a-287250e8cb6f
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_46a53540-9c9b-43ec-884a-287250e8cb6f
GITHUB_TRIGGERING_ACTOR=AlbrechtL
GITHUB_WORKFLOW=Linux build
GITHUB_WORKFLOW_REF=AlbrechtL/welle.io/.github/workflows/linux.yml@refs/heads/next
GITHUB_WORKFLOW_SHA=d4f3cefc1439ad884f8b20b1d6df90056d463c07
GITHUB_WORKSPACE=/home/runner/work/welle.io/welle.io
GIT_HASH=d4f3cefc
GOROOT_1_20_X64=/opt/hostedtoolcache/go/1.20.14/x64
GOROOT_1_21_X64=/opt/hostedtoolcache/go/1.21.13/x64
GOROOT_1_22_X64=/opt/hostedtoolcache/go/1.22.6/x64
GRADLE_HOME=/usr/share/gradle-8.10
HOME=/home/runner
HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=3650
HOMEBREW_NO_AUTO_UPDATE=1
INVOCATION_ID=a0daf5e489fb46818f8fa86666462c4f
ImageOS=ubuntu22
ImageVersion=20240825.1.0
JAVA_HOME=/usr/lib/jvm/temurin-11-jdk-amd64
JAVA_HOME_11_X64=/usr/lib/jvm/temurin-11-jdk-amd64
JAVA_HOME_17_X64=/usr/lib/jvm/temurin-17-jdk-amd64
JAVA_HOME_21_X64=/usr/lib/jvm/temurin-21-jdk-amd64
JAVA_HOME_8_X64=/usr/lib/jvm/temurin-8-jdk-amd64
JOURNAL_STREAM=8:19809
LANG=C.UTF-8
LD_LIBRARY_PATH=/opt/hostedtoolcache/Python/3.11.9/x64/lib:/home/runner/work/welle.io/Qt/6.7.2/gcc_64/lib
LEIN_HOME=/usr/local/lib/lein
LEIN_JAR=/usr/local/lib/lein/self-installs/leiningen-2.11.2-standalone.jar
NVM_DIR=/home/runner/.nvm
PATH=/home/runner/work/welle.io/Qt/6.7.2/gcc_64/bin:/opt/hostedtoolcache/Python/3.11.9/x64/bin:/opt/hostedtoolcache/Python/3.11.9/x64:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PERFLOG_LOCATION_SETTING=RUNNER_PERFLOG
PIPX_BIN_DIR=/opt/pipx_bin
PIPX_HOME=/opt/pipx
PKG_CONFIG_PATH=/opt/hostedtoolcache/Python/3.11.9/x64/lib/pkgconfig:/home/runner/work/welle.io/Qt/6.7.2/gcc_64/lib/pkgconfig
POWERSHELL_DISTRIBUTION_CHANNEL=GitHub-Actions-ubuntu22
***
Python2_ROOT_DIR=/opt/hostedtoolcache/Python/3.11.9/x64
Python3_ROOT_DIR=/opt/hostedtoolcache/Python/3.11.9/x64
Python_ROOT_DIR=/opt/hostedtoolcache/Python/3.11.9/x64
QML2_IMPORT_PATH=/home/runner/work/welle.io/Qt/6.7.2/gcc_64/qml
QT_PLUGIN_PATH=/home/runner/work/welle.io/Qt/6.7.2/gcc_64/plugins
QT_ROOT_DIR=/home/runner/work/welle.io/Qt/6.7.2/gcc_64
RUNNER_ARCH=X64
RUNNER_ENVIRONMENT=github-hosted
RUNNER_NAME=GitHub Actions 17
RUNNER_OS=Linux
RUNNER_PERFLOG=/home/runner/perflog
RUNNER_TEMP=/home/runner/work/_temp
RUNNER_TOOL_CACHE=/opt/hostedtoolcache
RUNNER_TRACKING_ID=github_395a7dc5-d6e2-4622-9119-2b206fc4aa2b
RUNNER_USER=runner
RUNNER_WORKSPACE=/home/runner/work/welle.io
SELENIUM_JAR_PATH=/usr/share/java/selenium-server.jar
SGX_AESM_ADDR=1
SHLVL=0
STATS_D=true
STATS_D_D=true
STATS_EXT=true
STATS_EXTP=https://provjobdsettingscdn.blob.core.windows.net/settings/provjobdsettings-0.5.181+6/provjobd.data
STATS_RDCL=true
STATS_TRP=true
STATS_UE=true
STATS_V3PS=true
STATS_VMD=true
STATS_VMFE=true
SWIFT_PATH=/usr/share/swift/usr/bin
SYSTEMD_EXEC_PID=593
USER=runner
VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg
XDG_CONFIG_HOME=/home/runner/.config
XDG_RUNTIME_DIR=/run/user/1001
_=/usr/bin/env
pythonLocation=/opt/hostedtoolcache/Python/3.11.9/x64
probonopd commented 2 months ago

What happens if you use a Qt from https://launchpad.net/~beineri? Those are the ones I used for testing this. I see you are using Qt6. Unfortunately I don't think they are providing Qt6 there. Would your code build with Qt5, at least for testing?

AlbrechtL commented 2 months ago

Honestly, I do not want to spend time in Qt 5.15 anymore. Of course the old code base is working with Qt 5.15. But Qt5 will be EOL in a few months (May 2025, https://www.qt.io/blog/qt-5.15-extended-support-for-subscription-license-holders) and https://launchpad.net/~beineri seems to be no active. For these reasons started the welle.io porting actives to Qt6 3 years ago and I would like to finish it soon. Ideally with a welle.io AppImage :-).

probonopd commented 2 months ago

So, what happens if you export QTDIR=$QT_ROOT_DIR? If that works, we could change go-appimage to use that variable directly, if it is what gets used nowadays.

AlbrechtL commented 2 months ago

So, what happens if you export QTDIR=$QT_ROOT_DIR?

It is looking much better. See the log file: 10_Create AppImage.txt

If that works, we could change go-appimage to use that variable directly, if it is what gets used nowadays.

That could be an idea. When I was looking for an alternative for Travis-CI and https://launchpad.net/~beineri I landed at https://github.com/marketplace/actions/install-qt but I don't have any idea how often this is used. But this project as well as the background project https://github.com/miurahr/aqtinstall/ are having a lot of stars and both are having recent commits.

AlbrechtL commented 2 months ago

Just a short update.

I'm getting an AppImage (https://github.com/AlbrechtL/welle.io/actions/runs/10657499437/artifacts/1879934610) but the AppImage itself is not fully working (see welle.io output below). The AppImage build logs are here (10_Create AppImage.txt)


/20240901_a89f1b80_Linux_welle-io-x86_64.AppImage 
2024-09-01T23:43:00.704 Debug: main: Set language "de_DE"
2024-09-01T23:43:00.767 Warning: No QtMultimedia backends found. Only QMediaDevices, QAudioDevice, QSoundEffect, QAudioSink, and QAudioSource are available.
2024-09-01T23:43:00.783 Debug: Audio: Current sound output "Built-in Audio Analog Stereo"
2024-09-01T23:43:01.162 Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QColorSpace(), profile  QSurfaceFormat::NoProfile)
2024-09-01T23:43:01.166 Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QColorSpace(), profile  QSurfaceFormat::NoProfile)
2024-09-01T23:43:01.170 Warning: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QColorSpace(), profile  QSurfaceFormat::NoProfile)
2024-09-01T23:43:01.175 Fatal: Could not initialize GLX
Abgebrochen (Speicherabzug geschrieben)

But I think this is most likely something for a new issue. My initial issue is solved. Thanks for that!

kevle commented 2 months ago

I got the same problem and realized that if you manually set $QTDIR, appimagetool will corrupt libQt6Core.so because there is no check for the return value of prfxpathPos := ScanFile(f, search) in patchQtPrfxpath.

Here is a patch adding a check, I have no idea how to write go code so I don't feel quite confident enough to create a PR from this:

diff --git a/src/appimagetool/appdirtool.go b/src/appimagetool/appdirtool.go
index 842704d..7ecf421 100644
--- a/src/appimagetool/appdirtool.go
+++ b/src/appimagetool/appdirtool.go
@@ -511,7 +511,12 @@ func patchQtPrfxpath(appdir helpers.AppDir, lib string, libraryLocationsInAppDir
    f.Seek(0, 0)
    // Search from the beginning of the file
    search := []byte("qt_prfxpath=")
-   offset := ScanFile(f, search) + int64(len(search))
+   prfxpathPos := ScanFile(f, search)
+   if prfxpathPos < 0 {
+       helpers.PrintError("Could not find offset for " + string(search), errors.New("no " + string(search) + " token in binary"))
+       os.Exit(1)
+   }
+   offset := prfxpathPos + int64(len(search))
    log.Println("Offset of qt_prfxpath:", offset)
    /*
        What does qt_prfxpath=. actually mean on a Linux system? Where is "."?
probonopd commented 2 months ago

Thanks @kevle, I added your patch to the PR at https://github.com/probonopd/go-appimage/pull/302; if everything goes well a new build for testing should appear there in the next minues. Would appreciate if you could test the build there that has the patch applied and let me know whether it works as intended. Thank you very much!