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
539 stars 65 forks source link

support for linux as AppImage #30

Closed kanryu closed 7 years ago

kanryu commented 7 years ago

Hi,

QuickViewer is now support for linux distributions as portable AppImage.

It is 'QuickViewer-0.9.4-x86_64.AppImage' on releases. If you have linux pc, check it out :)

If you build on Linux PC you will be able to easily create AppImage. But it is a laborious work for me so it will not be added to the release every time.

Comments?

probonopd commented 7 years ago

What distribution did you build this on? Can you reduce the libstdc++.so.6 version used at build time to the one that comes with Ubuntu 14.04 (or any older distribution)?

Currently it crashes when trying to run on Ubuntu 14.04:

libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /run/firejail/appimage/.appimage-7064/AppRun)
AppRun: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /run/firejail/appimage/.appimage-7064/usr/bin/../lib/libfileloader.so.1)

Example on how to solve this using Travis CI and GitHub: https://github.com/probonopd/linuxdeployqt/#using-linuxdeployqt-with-travis-ci

Reference: https://travis-ci.org/AppImage/appimage.github.io/builds/271247348#L605-L606

Please ping me here once a new release is available for download.

kanryu commented 7 years ago

I use kubuntu-17.04 . I run checked also ubuntu-16.04.2 and Fedora Workstation 26, and works well.

I noticed that the -bundle-non-qt-libs parameter was missing, but nothing changed. And I updated linuxdeployqt, but nothing changed.

What do I? :(

probonopd commented 7 years ago

Please build on (K)Ubuntu 14.04.

kanryu commented 7 years ago

If we do not notice/solve the problem unless we build in the old environment, I think that the build tools are defective :(

If you call it a portable package in the first place it should include a complete C/C ++ runtime library. Actually, the Windows version of QuickViewer is doing so and it works normally even in the Windows OS immediately after installation.

probonopd commented 7 years ago

Nothing is defective, but Linux binaries in general can only run on target systems that are no older than the system they were built on. So please compile on an older system.

You also cannot compile on Windows 10 and expect it to run on Windows XP.

kanryu commented 7 years ago

That is sadness :( On Windows we can build programs on Windows 10 that work correctly on Windows XP if we do it carefully. Because the C runtime library is tightly coupled with each compiler and does not depend on the version of the Windows OS. So, we can distribute programs that run anywhere on Windows if we attach each C runtime library provided by VisualStudio or MingW-gcc to the program. (Of course we need to pay attention to the Windows API version)

I understood the culture of Linux developers, so let's prepare the old Linux in the future. Elderly people are the best!

probonopd commented 7 years ago

Or use a service like Travis CI that compiles it for you in the cloud.

kanryu commented 7 years ago

@probonopd I made it :)

I build on kubuntu-14.04.5, and use gcc-6 (Building QuickViewer requires gcc 6 or later.)

Automating the deployment work is an interesting proposal, but we have not challenged it because we need to actually test it manually due to the nature of the application.

probonopd commented 7 years ago

With QuickViewer-0.9.6-x86_64.AppImage, still getting QuickViewer: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version 'GLIBCXX_3.4.21' not found (required by /run/firejail/appimage/.appimage-7029/usr/bin/QuickViewer). Can you make sure that on your build machinelibstdc++.so.6` is no newer than what comes with Ubuntu 14.04 out of the box?

probonopd commented 7 years ago

Found the following on https://stackoverflow.com/a/42705277

Sometimes you don't control the target machine (e.g. your library needs to run on a locked-down enterprise system). In such a case you will need to recompile your code using the version of GCC that corresponds to their GLIBCXX version. In that case, you can do the following:

  1. Look up the latest version of GLIBCXX supported by the target machine: strings /usr/lib/libstdc++.so.6 | grep GLIBC ... Say the version is 3.4.19.
  2. Use https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html to find the corresponding GCC version. In our case, this is [4.8.3, 4.9.0).

Of course you can decide yourself which systems you still want to support and which you don't. Since AppImages are supposed to run on all still-supported LTS versions, my recommendation would be to target Ubuntu 14.04 at this point in time, which supports only GLIBCXX_3.4.19. Looking this up in the table means that you should use GCC 4.8.3 (or older, but not newer) if you want the resulting executable to run on Ubuntu 14.04.

kanryu commented 7 years ago

Thank you very much for testing every time.

As you know, gcc needs to specify the target C runtime library when building itself. gcc-6 available on Ubuntu 's package network seems to link with newer glibc.

As I wrote above, gcc-6 is required to build QuickViewer, and it will fail with gcc-5 or older. This is due to using C++11 and the CPU's new instructions.

There are mainly two solutions to this problem. One is to hand build gcc - 6 targeting glibc of Ubuntu 14.04. Another thing is to give up ;)

kanryu commented 7 years ago

@probonopd I checked on ubuntu-14.5-LTS LiveDVD and running OK. (QuickViewer-0.9.6-x86-64.AppImage has been updated.)

To summarize this problem is that libstdc++.so provided by gcc does not exist on the Linux PC we are running. Therefore we need to include libstdc++.so into AppImage. This solution is problematic if libc6.so is too old, but it works with ubuntu - 14 LTS.

probonopd commented 7 years ago

That is an option, but in this case we will run into trouble if the host needs a newer libstdc++ than what is contained in the AppImage. Then crashes will happen. So I do not recommend to bundle this library.

kanryu commented 7 years ago

I agree with your opinion, but that is to say to all the shared libraries shipped with AppImage, only libstdc ++. So is not an exception.

AppImage's startup script should compare the shared library in the archive with the ones on the host side and implement a mechanism to skip the archive side if the host side is new. I do not know if that is possible for SquashFS.

probonopd commented 7 years ago

Please check the solution given in https://github.com/AppImage/AppImages/issues/173.