kanryu / quickviewer

A image/comic viewer application for Windows, Mac and Linux, it can show images very fast
https://kanryu.github.io/quickviewer/
GNU General Public License v3.0
536 stars 63 forks source link

ubuntu 18.04: compile fails #88

Closed revast closed 5 years ago

revast commented 6 years ago

inux-g++ -o fileoperator.o ../../QuickViewer/src/models/fileoperator.cpp ../../QuickViewer/src/models/fileoperator.cpp: In constructor ‘FileOperator::FileOperator(QString, QObject*)’: ../../QuickViewer/src/models/fileoperator.cpp:10:19: error: variable ‘QJsonDocument docc’ has initializer but incomplete type QJsonDocument docc = QJsonDocument::fromVariant(json); ^~~~ ../../QuickViewer/src/models/fileoperator.cpp:10:41: error: incomplete type ‘QJsonDocument’ used in nested name specifier QJsonDocument docc = QJsonDocument::fromVariant(json); ^~~ ../../QuickViewer/src/models/fileoperator.cpp:11:17: error: variable ‘QJsonObject doc’ has initializer but incomplete type QJsonObject doc = docc.object(); ^~~ ../../QuickViewer/src/models/fileoperator.cpp:12:16: error: variable ‘QJsonValue as’ has initializer but incomplete type QJsonValue as = doc["as"]; ^~ ../../QuickViewer/src/models/fileoperator.cpp:16:16: error: variable ‘QJsonValue mode’ has initializer but incomplete type QJsonValue mode = doc["mode"]; ^~~~ ../../QuickViewer/src/models/fileoperator.cpp:22:16: error: variable ‘QJsonValue command’ has initializer but incomplete type QJsonValue command = doc["command"]; ^~~ ../../QuickViewer/src/models/fileoperator.cpp: In member function ‘QVariant FileOperator::toVariant()’: ../../QuickViewer/src/models/fileoperator.cpp:28:34: error: return type ‘class QVariant’ is incomplete QVariant FileOperator::toVariant() ^ ../../QuickViewer/src/models/fileoperator.cpp:30:17: error: aggregate ‘QJsonObject obj’ has incomplete type and cannot be defined QJsonObject obj; ^~~ ../../QuickViewer/src/models/fileoperator.cpp:36:19: error: variable ‘QJsonDocument doc’ has initializer but incomplete type QJsonDocument doc = QJsonDocument(obj); ^~~ ../../QuickViewer/src/models/fileoperator.cpp:36:42: error: invalid use of incomplete type ‘class QJsonDocument’ QJsonDocument doc = QJsonDocument(obj); ^ In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:54:0, from /usr/include/x86_64-linux-gnu/qt5/QtCore/QObject:1, from ../../QuickViewer/src/models/fileoperator.h:4, from ../../QuickViewer/src/models/fileoperator.cpp:1: /usr/include/x86_64-linux-gnu/qt5/QtCore/qmetatype.h:1881:1: note: forward declaration of ‘class QJsonDocument’ QT_FOR_EACH_STATIC_CORE_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER) ^ Makefile:1494: recipe for target 'fileoperator.o' failed make[1]: [fileoperator.o] Error 1 make[1]: Leaving directory '/media/vault/compiles/quickviewer/quickviewer/build/QuickViewer' Makefile:209: recipe for target 'sub-QuickViewer-make_first' failed make: [sub-QuickViewer-make_first] Error 2

With git master... how do I compile the release tar when I am supposed to do the git submodule stuff??

also, I cannot open raw images with appimage version

kanryu commented 6 years ago

@revast Sorry, I found the problem.

This problem is caused by differences in the representation range of C++ that different compilers allow. Normally, g++ requires stricter C++ than cl (msvc). I noticed it when I created an AppImage, but I have not committed yet. I will correct it after I return home.

Another reason is not to display Raw images on AppImage version and Mac version. The application of Qt realizes image support with a plug-in and Windows QuickViewer bundles several plugins implemented outside the repository of this project.

For several reasons, the source code of these plugins has not been released and it is not bundled with derivations other than Windows version. Therefore, these QuickViewer do not display RAW images.

kanryu commented 6 years ago

@revast I commited :)

revast commented 6 years ago

ok will try asap ;-)

revast commented 6 years ago

ok now I get this when trying to execute build/bin/QuickViewer:


 build/bin/QuickViewer 
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".

Reinstalling the application may fix this problem.
Aborted

export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins helps. I guess this is because you compile for packing an appimage in first place.

As much as I like appimages, their (and linuxdeployqt's) inability to use the system's theme does give me enough headache to recompile the app (I am using a dark theme, so I literally mean headache when "White" QuckLauncher pops up in night sessions). So I would ask a a feature request to include a dark theme which can be switched on. There must be a way to include themes in the appimage, right? Or put it directly in the code?

kanryu commented 6 years ago

@revast you should run the below.

$ make install

To see detail for https://github.com/kanryu/quickviewer/blob/master/HowToBuild.md

kah0922 commented 5 years ago

Honestly, I'd much prefer if there was a way to build QuickViewer without making an appimage for distro packaging. I did try, but lib7z is static (even though it can apparently use the system's 7zip library if you simlink it).

kanryu commented 5 years ago

I am asking for QuickViewer to be portable. This is to enable users to quickly use all the functions of QuickViewer, regardless of OS or distribution such as Linux or Windows. Therefore on Linux it is also shaped as a package by AppImage format, which includes all the libraries (including 7zip) Normally, on Unix applications will be installed under /usr/local and executables will be placed in /usr/local/bin. I think that future QuickViewer can be in that form. But that is not my job. It is the work of each Linux distributor.

You will be able to do the first job for that. That is to make a package of QuickViewer that is installed in the same way as other applications for /usr/local.

Specifically, it does as follows.

  1. Define the switch to change the installation method to QVproject.pri (eg QV_INSTALL_USR_LOCAL)
  2. Define a new install event that replaces the conventional "linux:! CONFIG (debug, debug | release)" in QuickViewer.pro
  3. Enable [2] to be executed by the QV_INSTALL_USR_LOCAL switch
kanryu commented 5 years ago

@revast @kah0922 It is supported about QV_PORTABLE

If you build on Linux without QV_PORTABLE, it tries to install under /usr/local/bin of the system. Because Qt-related libraries and configuration files use those of the system, we recommend using system-standard Qt5 instead of Qt SDK.

in this case, type command the following:

$ sudo make install
kah0922 commented 5 years ago

That helped a lot. Now, for packaging purposes, I had to use sed to move everything from /usr/local to /usr. While this worked for the most part, lib7z.so seems to only want to be found in /usr/lib. I tested this by symlinking lib7z.so from /usr/lib64 to /usr/lib and the library loaded. This is a problem, as for 64bit systems, libraries are installed in /usr/lib64. Even if one were to install something in /usr/local, for 64bit libraries, they would be in /usr/local/lib64.

For the record, you can find the package I'm trying to build here. The package will compile, but archive loading is broken due to the missing lib7z.so

kanryu commented 5 years ago

Normally, on Unix, applications that you build yourself are installed in /usr/local/bin. However, you seem to be setting up as part of opensuse. If the application is included in the distribution, it will be installed in /usr/bin. If you modify the current quickviewer.pro recipe a bit, it will be a tool to create packages for major distributions.

You can change it if you want to use lib7z on your system. I will add a switch later.

kah0922 commented 5 years ago

For now I symlinked it, but now I've ran into an issue where the shaders will not work unless QuickViewer is ran as root, and it's frowned upon to run GUI apps as root on Linux.

I don't know what's causing this.

Edit: Turns out it was a Wayland issue.

Also if you do add that option the actual library name is just 7z.so

kanryu commented 5 years ago

First, the switch that switches between lib7z.so and 7z.so is USE_LIB7Z_DLL.

Next, 7z.so is a special shared library specifically designed for runtime loading, and it is not possible to specify the loading PATH with the linker.

The load sequence is fixed, if the environment variable P7ZIP_HOME_DIR is specified, it tries to open 7z.so in that directory, otherwise it tries to open it from the current directory.

The code that sets that environment variable is in line 331 of qt7zpackage.cpp.