Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flatpak] Fails to start in Ubuntu Unity with "Invalid tesseract version" #290

Closed
archisman-panigrahi opened this issue Oct 19, 2022 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@archisman-panigrahi
Copy link

Here is the error message. I am running Ubuntu Unity 22.10.

$ flatpak run com.github.dynobo.normcap 
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Gtk-Message: 18:33:58.284: Failed to load module "xapp-gtk3-module"
Gtk-Message: 18:33:58.284: Failed to load module "unity-gtk-module"
Gtk-Message: 18:33:58.345: Failed to load module "canberra-gtk-module"
Gtk-Message: 18:33:58.345: Failed to load module "canberra-gtk-module"
18:33:58 - CRITICAL - normcap.gui.utils:160 - Uncaught exception! Quitting NormCap!
18:33:58 - WARNING - normcap.screengrab.utils:92 - Exception when trying to get gnome version from xml 

System:

{  'cli_args': '/app/bin/normcap',
   'config_directory': PosixPath('/home/REDACTED/.var/app/com.github.dynobo.normcap/config/normcap'),
   'desktop_environment': <DesktopEnvironment.GNOME: 1>,
   'display_manager_is_wayland': False,
   'envs': {  'LD_LIBRARY_PATH': '',
              'TESSDATA_PREFIX': '/app/share',
              'TESSERACT_CMD': None,
              'TESSERACT_VERSION': None},
   'gnome_version': None,
   'is_flatpak_package': True,
   'is_prebuild_package': None,
   'normcap_version': '0.3.12',
   'platform': 'linux',
   'pyside6_version': '6.4.0',
   'qt_library_path': '/usr/share/runtime/lib/plugins, '
                      '/app/lib/python3.9/site-packages/PySide6/Qt/plugins',
   'qt_version': '6.4.0',
   'screens': {},
   'tessdata_path': '/home/REDACTED/.var/app/com.github.dynobo.normcap/config/normcap/tessdata'}

Variables:

                  '__builtins__': <module 'builtins' (built-in)>,
                  '__cached__': None,
                  '__doc__': None,
                  '__file__': '/app/bin/normcap',
                  '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7facee1eaf70>,
                  '__name__': '__main__',
                  '__package__': None,
                  '__spec__': None,
                  'main': <function main at 0x7facee13b3a0>,
                  're': <module 're' from '/usr/lib/python3.9/re.py'>,
                  'sys': <module 'sys' (built-in)>},
   'main': {  'args': Namespace(color=None, language=None, mode=None, notification=None, tray=None, update=None, reset=False, verbosity='warning'),
              'logger': <Logger normcap (WARNING)>},
   'qt_log_wrapper': {  '_': <PySide6.QtCore.QMessageLogContext object at 0x7face71867c0>,
                        'message': 'QApplication: invalid style override '
                                   "'kvantum' passed, ignoring it.\n"
                                   '\tAvailable styles: Windows, Fusion',
                        'mode': <QtMsgType.QtWarningMsg: 1>}}

Exception:

  AttributeError: 'str' object has no attribute 'decode'

Traceback:

  File "/app/bin/normcap", line 8, in <module>
    sys.exit(main())
  File "/app/lib/python3.9/site-packages/normcap/app.py", line 54, in main
    app = QtWidgets.QApplication(sys.argv)
  File "/app/lib/python3.9/site-packages/normcap/gui/utils.py", line 53, in qt_log_wrapper
    level = mode.name.decode("utf8").lower()

18:33:58 - CRITICAL - normcap.gui.utils:227 - Please open an issue with the output above on https://github.com/dynobo/normcap/issues

@archisman-panigrahi
Copy link
Author

The appimage works normally after installing fuse. https://techpiezo.com/linux/error-appimages-require-fuse-to-run-in-ubuntu-22-04/

@dynobo dynobo self-assigned this Oct 20, 2022
@dynobo dynobo added the bug Something isn't working label Oct 20, 2022
@archisman-panigrahi archisman-panigrahi changed the title Fails to start in Ubuntu Unity (X.Org) [flatpak] Fails to start in Ubuntu Unity (X.Org) Oct 20, 2022
dynobo added a commit that referenced this issue Oct 22, 2022
Add FAQ entry on how to solve missing fuse mentioned in #290
@dynobo
Copy link
Owner

dynobo commented Oct 22, 2022

@apandada1, Could you please try updating the FlatPak to NormCap v0.3.13 and check, if the issue is fixed? (At least the line that caused the error got changed in the meanwhile...)
I'd be happy to hear, if that helped!

@archisman-panigrahi
Copy link
Author

archisman-panigrahi commented Oct 22, 2022 via email

@dynobo dynobo removed the bug Something isn't working label Oct 23, 2022
@archisman-panigrahi
Copy link
Author

Still does not work.

$ flatpak run com.github.dynobo.normcap
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Gtk-Message: 12:22:56.122: Failed to load module "xapp-gtk3-module"
Gtk-Message: 12:22:56.122: Failed to load module "unity-gtk-module"
Gtk-Message: 12:22:56.183: Failed to load module "canberra-gtk-module"
Gtk-Message: 12:22:56.183: Failed to load module "canberra-gtk-module"
12:22:56 - WARNING - normcap.screengrab.utils:94 - Exception when trying to get gnome version from xml 
Invalid tesseract version: "ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
tesseract 5.2.0
 leptonica-1.82.0
  libgif 5.2.1 : libjpeg 6b (libjpeg-turbo 2.1.3) : libpng 1.6.37 : libtiff 4.3.0 : zlib 1.2.11 : libwebp 1.2.1 : libopenjp2 2.4.0
 Found AVX
 Found SSE4.1
 Found libarchive 3.5.2 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.8
 Found libcurl/7.82.0-DEV GnuTLS/3.7.2 zlib/1.2.11 libidn2/2.3.1 nghttp2/1.44.0
"

@dynobo
Copy link
Owner

dynobo commented Oct 24, 2022

Hi @apandada1, thanks for trying it again. This is now a different error. I'm able to reproduce it in Ubuntu Unity, but unfortunately I don't know how to fix it.

Contributions, ideas or further observations are very welcome!

Here's what I found out so far:

  1. The root problem for NormCap is the error message (ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded [...]) that gets printed on any command evocation...
  2. ... because this additional text breaks pytesseract's parsing of the output of tesseract --version to identify the Tesseract version.
  3. The error itself probably isn't an issue for NormCap or pytesseract, only the error message that gets printed!
  4. The root cause of the error itself seems to be, that gtk3-nocsd tries to wrap every application-call in order to remove the client side decorations, but everything running inside the Flatpak container is not allowed to access libgtk3-nocsd.so.0 on the system.
  5. Some people suggest to just uninstall gtk3-nocsd: ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. flathub/org.qownnotes.QOwnNotes#109
  6. Unfortunately, this seems not a good solution for Unity, which seems to depend on it quite heavily. For other desktop environment's this might be a good option.

Some thoughts on potential solutions:

  1. Can flatpak somehow be executed without being wrapped by gtk3-nocsd? So libgtk3-nocsd.so.0 isn't preloaded at all?
  2. Can the output of the error be suppressed somehow?
  3. Can the version parsing in pytesseract be made more robust to not break in case of such additional output?

@dynobo dynobo removed their assignment Oct 24, 2022
@dynobo dynobo added the help wanted Looking for contributors to work on this issue label Oct 24, 2022
@dynobo dynobo changed the title [flatpak] Fails to start in Ubuntu Unity (X.Org) [flatpak] Fails to start in Ubuntu Unity with "Invalid tesseract version" Oct 24, 2022
@archisman-panigrahi
Copy link
Author

archisman-panigrahi commented Oct 24, 2022

Thank you for putting the effort to find out the cause of the error.

Can the version parsing in pytesseract be made more robust to not break in case of such additional output?

Yeah, if pytesseract can be made to search for the version number in the whole error message, instead of searching in the very first line, then this can be solved. However, I don't know enough python to fix that.

I don't know if the error message can be somehow suppressed.

@dynobo
Copy link
Owner

dynobo commented Oct 24, 2022

Right after posting my last comment, I had an idea how to do (1) of the potential solutions, tried it, and it worked:
LD_PRELOAD="" flatpak run com.github.dynobo.normcap
Starting the flatpak like this disables nocsd for this single call and fixes the issue.

PS: Unfortunately, NormCap looks quite ugly on Unity: It seems like Unity prevents it from going fullscreen...

@archisman-panigrahi
Copy link
Author

Yeah, it works!!

@dynobo dynobo closed this as completed in 4f8cc56 Oct 25, 2022
dynobo added a commit that referenced this issue Oct 25, 2022
…d-within-flatpak

Clear LD_PRELOAD env inside flatpak to fix #290
@dynobo dynobo reopened this Oct 25, 2022
@dynobo dynobo removed the help wanted Looking for contributors to work on this issue label Oct 25, 2022
@dynobo dynobo self-assigned this Oct 25, 2022
dynobo added a commit that referenced this issue Oct 25, 2022
Fix fullscreen issue in Unity DE mentioned in #290
@dynobo dynobo added the bug Something isn't working label Oct 30, 2022
@dynobo
Copy link
Owner

dynobo commented Oct 30, 2022

Hi @apandada1, the latest v0.3.14 release adds some improvements for Unity:

  • Fullscreen should be working properly now
  • No need to set LD_PRELOAD="" anymore.
    (You might still see ERROR: ld.so: object 'libgtk3-nocsd.so.0' in the CLI, but it should't have any negative effect in NormCap.)

Do you want to give it a try and report back your experience?

@archisman-panigrahi
Copy link
Author

Works perfectly!! I verified both the flatpak the appimage also works properly with fullscreen, and neither crashes.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants