ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.14k stars 155 forks source link

Version 3.0.18 Build issues (icu56, "/usr/qml" No such file or directory.) #346

Open molaeiali opened 1 year ago

molaeiali commented 1 year ago

I'm trying to build this package for AUR, there are some problems:

The first problem is it depends on an old version of icu, I don't understand why it needs icu-56 and not using the latest version, the newest version is 72, but the program needs:

/usr/lib/libicui18n.so.56
/usr/lib/libicuuc.so.56
/usr/lib/libicudata.so.56

Second problem: When I proceed with icu 56 anyway, Looks like it's trying to install files from /usr/qml to somewhere, and it can't, there is /usr/bin/qml available and Qt6 is installed, Don't know why is it trying to do that. Here's the error log:

+ cmake --install ./cmake-build-release
-- Install configuration: "Release"
-- Installing: PATH/src/proton-bridge/cmd/Desktop-Bridge/deploy/linux/bridge-gui
-- Set runtime path of "PATH/src/proton-bridge/cmd/Desktop-Bridge/deploy/linux/bridge-gui" to "$ORIGIN:$ORIGIN/../lib:$ORIGIN/lib"
CMake Error at cmake-build-release/cmake_install.cmake:87 (file):
  file INSTALL cannot find "/usr/qml": No such file or directory.

Version Information

Proton Bridge 3.0.18 qt6-6.4.2 icu-56.2

themobiusproject commented 1 year ago

347 fixes the ICU issue.

I've been looking into the qml issue myself because I almost have this building on my own box. At the moment I have been copying bridge-gui from cmd/Desktop-Bridge/deploy/linux/bridge-gui to where I want it.

themobiusproject commented 1 year ago

As for the qml issue, I don't see anywhere that QT_DIR is ever defined. It is used in the Deploy${DEPLOY_OS}.cmake and FindQt.cmake files.

molaeiali commented 1 year ago

Any updates or comments about this issue? @cuthix

akiba-geek commented 1 year ago

Check PATH for qmake, it seems that it's necessary to define QT6DIR. Then, on terminal, check QT_INSTALL_PREFIX with qmake -query

I actually get QT_INSTALL_PREFIX:/usr there, which would explain this error. I use qt6-base from the Arch Linux extra repository.

https://stackoverflow.com/questions/913642/qmake-and-qt-install-prefix-how-can-i-select-a-new-location-for-qt-library

A temporary fix might be to add a qt.conf file in /usr/lib/qt6/bin/qmake with

[Paths] Prefix = /usr/bin

A better way to deal with this is to see if the environment variable QT_INSTALL_BINS:/usr/bin exists on other distros/windows/darwin. If it does, use that instead of QT_INSTALL_PREFIX. However, I don't see any issues being filed from other distros and OSes, which leads me to suspect this may be something upstream, exclusive to Arch Linux. :/

notes:

Up until v2.3.0, they seem to have been using .qml files bundled with the source code, but from v2.4.0, they seem to be using .qml files from the Qt Resource System. It must coincide with GODT-1551, the upgrade to Qt6.

In addition, there's something about QT6DIR having to be defined at build: https://github.com/ProtonMail/proton-bridge/issues/302#issuecomment-1281922370

Which was then fixed at v2.4.5 with GODT-1942: Use qmake to find the QT6DIR. It also then does this: https://github.com/ProtonMail/proton-bridge/blob/0ceee14952bfccb86550ab29c69d5e72c96ff39d/internal/frontend/bridge-gui/FindQt.cmake#L6

which queries QT_INSTALL_PREFIX in qmake. This returns /usr on my system. The output is then defined as QT_DIR.

They make this clear in the BUILDS.md https://github.com/ProtonMail/proton-bridge/blob/babb4412ae6f33ea7365fe69847eae72e1b1f2e1/BUILDS.md?plain=1#L21

The /qml part comes from here: https://github.com/ProtonMail/proton-bridge/blob/7be46a47402be596a8a1f8925c09ef26f9445fc3/internal/frontend/bridge-gui/bridge-gui/main.cpp#L139

maritz commented 1 year ago

I tried following your instructions and ended up with configuration failing because /usr/bin/qml is not a directory for me (it's the qml runtime), but now with the changed prefix it tries to install .qml files there or something?

CMake Error at DeployLinux.cmake:30 (install):
  install DIRECTORY given non-directory "/usr/bin/qml" to install.
Call Stack (most recent call first):
  CMakeLists.txt:185 (include)
akiba-geek commented 1 year ago

Ah, sorry. In that case, try /usr/lib/qt - I found this from QT_INSTALL_ARCHDATA:/usr/lib/qt when doing qmake -query. I haven't been able to get around to building this on my own - hoping this fixes the issue. If not, there's also a qml directory in /usr/lib/qt6

maritz commented 1 year ago

Okay, after adding a /usr/lib/qt6/bin/qt.conf with this:

[Paths]
Prefix = /usr/lib/qt6

And then - after making sure qt6 and not qt5 is in my $PATH - it builds. However the built binaries produce this error: (this is with QT_DEBUG_PLUGINS=1, which adds the first line)

qt.core.plugin.factoryloader: checking directory path "/home/maritz/dev/tools/protonmail-bridge/cmd/Desktop-Bridge/deploy/linux/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

[1]    2328641 IOT instruction (core dumped)  ./cmd/Desktop-Bridge/deploy/linux/bridge-gui
molaeiali commented 1 year ago

Any updates on this issue? @cuthix

molaeiali commented 10 months ago

Was able to build a working binary using these two patches: https://aur.archlinux.org/cgit/aur.git/tree/modern-icu.patch?h=protonmail-bridge https://aur.archlinux.org/cgit/aur.git/tree/qt-dir.patch?h=protonmail-bridge

I don't know if anything can be done on the upstream to fix these or it's just an Arch Linux related problem. If it cannot be fixed upstream, please feel free to close this issue @cuthix