probonopd / go-appimage

Go implementation of AppImage tools
MIT License
676 stars 69 forks source link

Do not hardcode Qt 5 #259

Closed probonopd closed 1 year ago

probonopd commented 1 year ago

Maybe we can get it to work for Qt 6 applications?

Prior art: https://github.com/probonopd/linuxdeployqt/commit/edbf092e73285d7f532082f8852b2b4b03cc399e

@CalebQ42 what do you think?

probonopd commented 1 year ago

Download for testing: artifacts

CalebQ42 commented 1 year ago

Looks like it should work. The only thing I would say is change for for loop checking for qt version to something like this to prevent iterating over the list potentially 94 times.

for _, e := range allELFs{
  if isQt, _ := path.Match("libQt*Core.so.*", e); isQt{
    qtVersionDetected, err = strconv.Atoi(path.Ext(e))
    if err != nil{
      log.Fatal(err)
    }
  }
}
CalebQ42 commented 1 year ago

I haven't done much with appimagetool, so it's mostly just a cursory look without much knowledge of the exact workings of it. My for loop does have the potential issue of also detecting other QT libraries that end in Core instead of the Core library, but it should still get the correct version. If we don't need to check for the core library first we could also potentially look for just "libQt*.so.*" to find any Qt library.

probonopd commented 1 year ago

Tried it on a Qt 6 application and in principle it works.