BandageNG icon indicating copy to clipboard operation
BandageNG copied to clipboard

Question regarding command line options

Open paoloczi opened this issue 2 years ago • 24 comments

Are any command line options supported? For example, to change defaults, etc. I tried --help but got the following. I am on Ubuntu 20.04.

./BandageNG-3b69a79-x86_64.AppImage --help
qt.qpa.plugin: Could not find the Qt platform plugin "minimal" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)

paoloczi avatar Jun 02 '22 19:06 paoloczi

Smells like a problem with AppImage. Does it run properly w/o any cmdline options?

asl avatar Jun 02 '22 19:06 asl

Yes, no problem running without options.

The original Bandage also had problems if any options were specified, even though there were several documented options. I filed an issue on that a long time ago on the original repository, but there was no action on it.

paoloczi avatar Jun 02 '22 19:06 paoloczi

well, all unfixed bugs of https://github.com/rrwick/Bandage are inherited :)

asl avatar Jun 02 '22 19:06 asl

There seems to be more to this than just inherited bugs. I can start both the "original" Bandage as well as BandageNG from the CLI, and I can also display the version numbers of both of them:

$ /Applications/Bandage.app/Contents/MacOS/Bandage --version 
Version: 0.9.0
$ /Applications/BandageNG.app/Contents/MacOS/BandageNG --version
Version: 0.9.6-dev

But other options dont seem to work with BandageNG:

$ /Applications/Bandage.app/Contents/MacOS/Bandage --help

  ____                  _                  
 |  _ \                | |                 
 | |_) | __ _ _ __   __| | __ _  __ _  ___ 
 |  _ < / _` | '_ \ / _` |/ _` |/ _` |/ _ \
 | |_) | (_| | | | | (_| | (_| | (_| |  __/
 |____/ \__,_|_| |_|\__,_|\__,_|\__, |\___|
                                 __/ |     
                                |___/      
Version: 0.9.0

Usage:    Bandage <command> [options]
          
Commands: <blank>      Launch the Bandage GUI
          load         Launch the Bandage GUI and load a graph file
          info         Display information about a graph
          image        Generate an image file of a graph
          querypaths   Output graph paths for BLAST queries
          reduce       Save a subgraph of a larger graph
          
Options:  --help       View this help message
          --helpall    View all command line settings
          --version    View Bandage version number
          
Online Bandage help: https://github.com/rrwick/Bandage/wiki









          
$ /Applications/BandageNG.app/Contents/MacOS/BandageNG --help
qt.qpa.plugin: Could not find the Qt platform plugin "minimal" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: cocoa.

zsh: abort      /Applications/BandageNG.app/Contents/MacOS/BandageNG --help

or as another example:

$ /Applications/Bandage.app/Contents/MacOS/Bandage image assembly.gfa test.png --colour uniform
--> succesfully creates the image


$ /Applications/BandageNG.app/Contents/MacOS/BandageNG image assembly.gfa test.png --colour uniform
qt.qpa.plugin: Could not find the Qt platform plugin "minimal" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: cocoa.

zsh: abort      /Applications/BandageNG.app/Contents/MacOS/BandageNG image   --colour uniform

EDIT: This behaviour is also present in the new release

$ /Applications/BandageNG.app/Contents/MacOS/BandageNG --version      
Version: 2022.6-dev

$ /Applications/BandageNG.app/Contents/MacOS/BandageNG --help   
qt.qpa.plugin: Could not find the Qt platform plugin "minimal" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: cocoa.

zsh: abort      /Applications/BandageNG.app/Contents/MacOS/BandageNG --help

richardstoeckl avatar Jul 20 '22 11:07 richardstoeckl

@richardstoeckl What is the version of MacOS you're using?

asl avatar Jul 20 '22 12:07 asl

I am using macOS Monterey Version 12.4 on a Intel based Macbook

richardstoeckl avatar Jul 20 '22 13:07 richardstoeckl

Thanks! I'll try to check. Note that we're testing cmdline on Mac on every commit on GitHub, so cmdline interface certainly works... There must be something else :)

asl avatar Jul 20 '22 13:07 asl

As I mentioned when originally opening this issue, I have the same problem on Ubuntu.

paoloczi avatar Jul 20 '22 14:07 paoloczi

@richardstoeckl Thanks, I was able to reproduce the problem. It seems to be connected how we're building the final DMG image...

asl avatar Jul 20 '22 20:07 asl

@paoloczi Does passing "-platform xcb" fix the problem for you?

asl avatar Jul 20 '22 21:07 asl

I recently upgraded my laptop to Ubuntu 22.04, and I just tried again, using your latest release. If I run it without options I get this message, but then it starts, apparently without problems:

./BandageNG-2022.06-x86_64.AppImage
Warning: Ignoring WAYLAND_DISPLAY on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

However, I can load a graph without problem, but when I try to display it I get an Illegal instruction trap. This is similar to what @rlorigro reported the other day, so it may be the same issue:

./BandageNG-2022.06-x86_64.AppImage
Warning: Ignoring WAYLAND_DISPLAY on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Illegal instruction (core dumped)

If I set that environment variable as suggested by that message, I get:

./BandageNG-2022.06-x86_64.AppImage
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)

Running without the environment variable and with -platform xcb gives:

./BandageNG-2022.06-x86_64.AppImage -platform xcb
Bandage-NG error: Invalid options: -platform, xcb

This is strange because if I invoke it with --help I get:

./BandageNG-2022.06-x86_64.AppImage --help
qt.qpa.plugin: Could not find the Qt platform plugin "minimal" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)

paoloczi avatar Jul 20 '22 21:07 paoloczi

@paoloczi Consider using AppImage from https://github.com/asl/BandageNG/releases/tag/v2022.07.16 As for "minimal" platform – this is exactly inherited stuff ;) Looking into it

asl avatar Jul 20 '22 21:07 asl

Here is what I get with the build you suggested.

Without options, it runs fine, I get the same message about WAYLAND_DISPLAY, and it can display a graph without problem.

With -platform xcb I get the following:

./BandageNG-f3ca6e0-x86_64.AppImage -platform xcb

Bandage-NG error: Invalid options: -platform, xcb

With --help I get this:

./BandageNG-f3ca6e0-x86_64.AppImage --help
qt.qpa.plugin: Could not find the Qt platform plugin "minimal" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)

So this is weird because it says that xcb is the only available plugin, but if you request it it tells you that it is invalid.

paoloczi avatar Jul 20 '22 21:07 paoloczi

this is appimage problem apparently (separate one). Does export QT_QPA_PLATFORM=xcb work ?

asl avatar Jul 20 '22 21:07 asl

This is what I get if I set that and I invoke it with --help:

export QT_QPA_PLATFORM=xcb
./BandageNG-f3ca6e0-x86_64.AppImage --help
qt.qpa.plugin: Could not find the Qt platform plugin "minimal" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)

paoloczi avatar Jul 20 '22 21:07 paoloczi

aha, ok. AppImage isolates env variables.

So, we're having complete mess here:

  1. If we're running headless (e.g. on server w/o X or Wayland) then we need to ensure we are using headless Qt platform integration plugin (minimal / offscreen).
  2. However some features related to text / image rendering are only available with full GUI platform. We cannot run them headless at all.
  3. Deployment tools seem to explicitly ignore minimal Qt platform plugin. So we're missing it in DMG / AppImage and therefore these images require complete GUI, which might be unavailable

asl avatar Jul 20 '22 22:07 asl

Just to clarify - I was running that locally from my Ubuntu 22.04 laptop, with a Gnome environment running on top of Wayland.

paoloczi avatar Jul 21 '22 02:07 paoloczi

Ok, here is full explanation: Qt has a dedicated platform abstraction layer in order to implement GUI primitives. For example, one could even instead of drawing everything on screen, run a kind of lightweight VNC server and connect from outside creating "remote monitor". The latter is a typical thing for e.g. embedded applications.

For CLI applications running on headless servers there are special platform plugins: minimal and offscreen. Currently Bandage force switches to a minimal platform plugin if only CLI features are desired (e.g. --help).

Now the key details: we are making a self-contained images: AppImage on Linux and app bundle on MacOS X. The tools we're using for this bundling copies only native platform plugin into a target image: xcb on Linux and cocoa on Mac. As a result, switching to minimal plugin does not work hence the error message.

The solution is simple on Mac platform as it cannot be headless: simply switch off such switching. This is what #100 implements and it should resolve #99 as a result (@richardstoeckl so your issue will be fixed). Unfortunately it will not work on Linux as xcb (default) platform plugin cannot initialize itself on a headless system. But we do not have other platform abstraction layer plugins because they were not bundled. I filled an issue about this (https://github.com/linuxdeploy/linuxdeploy-plugin-qt/issues/117) – hopefully it will be resolved. I will try to figure out whether there is a way to rewrite current Bandage code to gracefully switch to default platform plugin in case if the system is not headless (like in @paoloczi case).

asl avatar Jul 21 '22 11:07 asl

I submitted a fix for the bundling issue into upstream project (https://github.com/linuxdeploy/linuxdeploy-plugin-qt/pull/118). Hopefully it will be merged before our release so we can close this issue ;)

asl avatar Jul 21 '22 13:07 asl

@paoloczi Unfortunately it is still not merged, so we will need to proceed to the next Bandage-NG release without the fix :(

asl avatar Aug 01 '22 17:08 asl

@paoloczi Finally this was merged: https://github.com/linuxdeploy/linuxdeploy-plugin-qt/pull/118, so likely the issue will be fully resolved with Bandage 2022.08

asl avatar Aug 26 '22 13:08 asl

@paoloczi Will you please check if https://github.com/asl/BandageNG/releases/tag/v2022.08 works for you now?

asl avatar Sep 01 '22 04:09 asl

This works partially. I can now run it with --help or --helpall to get help information and a list of options, and it no longer crashes.

However, it looks like it is not honoring the options that I specify. For example, I tried invoking it with --minnodlen 88. But when I checked the Settings menu, the Minimum node length value was still the default 5.

paoloczi avatar Sep 01 '22 14:09 paoloczi

@paoloczi Oh, the cmdline interface requires lots of care.... it's broken in many places and not quite complete. But this is a separate issue – #50

asl avatar Sep 06 '22 07:09 asl

@paoloczi I just double checked and it seems that --minnodlen 88 case is working now (after https://github.com/asl/BandageNG/pull/128)

asl avatar Jan 30 '23 17:01 asl

Thank you! Can you remind me how I can get a current pre-built executable? The README says "Pre-built Linux and Mac binaries are available from Releases page", but the latest release is from last October. I know you have pre-built binaries somewhere else. Perhaps change that comment in the README with instructions on how to get to a current build outside of the release builds? I checked GitHub Actions and there are builds but no downloadable artifacts.

paoloshasta avatar Jan 30 '23 17:01 paoloshasta

@paoloshasta The snapshots are posted at https://github.com/asl/BandageNG/releases as "pre-releases". As soon as they are built which takes some time.

asl avatar Jan 30 '23 17:01 asl

Thanks - I will check your fix as soon as that becomes available.

paoloshasta avatar Jan 30 '23 17:01 paoloshasta

@paoloshasta It was just built: https://github.com/asl/BandageNG/releases/tag/continuous

asl avatar Jan 30 '23 17:01 asl

Nice, the options work now!

paoloshasta avatar Jan 30 '23 17:01 paoloshasta