probonopd / go-appimage

Go implementation of AppImage tools
MIT License
812 stars 71 forks source link

AppDir could not be identified: ./usr/bin does not exist #267

Closed VioletGiraffe closed 1 year ago

VioletGiraffe commented 1 year ago

What does this error mean? I'm trying to create (deploy) an AppImage on Rasbperry OS (Raspberry Pi4, ARM64). Here is my command: ~/appimagetool-815-aarch64.AppImage deploy AppDir/app.desktop AppDir contains a binary (with its name specified in the app.desktop), the .desktop file, and icon.png (also specified in the desktop).

Changing the command to absolute path ... deploy /home/pi/my-app/AppDir/appdesktop results in AppDir could not be identified: /home/usr/bin does not exist

probonopd commented 1 year ago

Can you please paste all the commands you are using so that we can better help you. I can use your application as an example if you like (and if you like to share it).

VioletGiraffe commented 1 year ago

Thanks for responding! I just tested with the simplest program, no specific project is required to reproduce it. First, I create main.cpp:

#include <iostream>
int main()
{
   std::cout << "Hello!\n";
   return 0;
}

Then g++ -O2 main.cpp, this creates a binary a.out that runs and prints the message. Then I create a folder "AppDir" and cp a.out AppDir/, then I add a.desktop with the following contents:

[Desktop Entry]
Type=Application
Name=A
Comment=A
Exec=a.out
Icon=icon
Terminal=true
Categories=Office;
X-AppImage-Version=1.0.0

This is taken from another project which works fine with linuxdeployqt, except I changed to Terminal=true from false. I assume this means a console/non-GUI app, and it doesn't make a difference to the error in question. Now I go back one level and call ~/appimagetool-815-aarch64.AppImage -s -o deploy AppDir/a.desktop This results in the same "ERROR AppDir: AppDir could not be identified: ./usr/bin does not exist".

Note that I skipped the icon, the error doesn't seem to be about that.

This is a lightly customized Raspberry OS 12 (current latest), in the sense that I installed some packages with apt and built/installed a couple libraries from source (one or two). Otherwise I did not mess with it in any way. I can try on a bone stock fresh system if you want me to. But I do need to get it working on the Pi, which is why I was forced to turn to the go-appimagetool in the first place.

probonopd commented 1 year ago

Verified on Raspberry Pi 5:

# Compile
g++ -O2 main.cpp

# Create the AppDir structure
mkdir -p AppDir/usr/bin
mv a.out AppDir/usr/bin/
mkdir -p AppDir/usr/share/applications
nano AppDir/usr/share/applications/a.desktop # Your desktop file from above
mkdir -p AppDir/usr/share/icons/hicolor/128x128/apps
cp /usr/share/icons/hicolor/256x256/apps/chromium-browser.png AppDir/usr/share/icons/hicolor/256x256/apps/ # Use your icon instead

# Check the AppDir structure
find AppDir
AppDir
AppDir/usr
AppDir/usr/share
AppDir/usr/share/icons
AppDir/usr/share/icons/hicolor
AppDir/usr/share/icons/hicolor/256x256
AppDir/usr/share/icons/hicolor/256x256/apps
AppDir/usr/share/icons/hicolor/256x256/apps/chromium-browser.png
AppDir/usr/share/applications
AppDir/usr/share/applications/a.desktop
AppDir/usr/bin
AppDir/usr/bin/a.out

# Get 64-bit ARM version of appimagetool
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-aarch64.AppImage" | head -n 1 | cut -d '"' -f 2)
chmod +x appimagetool-*.AppImage

# Deploy the dependencies into the AppDir
./appimagetool-*.AppImage deploy ./AppDir/usr/share/applications/a.desktop

# Check the AppDir structure again
find AppDir
AppDir
AppDir/usr
AppDir/usr/share
AppDir/usr/share/icons
AppDir/usr/share/icons/hicolor
AppDir/usr/share/icons/hicolor/256x256
AppDir/usr/share/icons/hicolor/256x256/apps
AppDir/usr/share/icons/hicolor/256x256/apps/icon.png
AppDir/usr/share/applications
AppDir/usr/share/applications/a.desktop
AppDir/usr/bin
AppDir/usr/bin/a.out
AppDir/usr/lib
AppDir/usr/lib/ld-linux-aarch64.so.1
AppDir/etc
AppDir/etc/fonts
AppDir/etc/fonts/fonts.conf
AppDir/AppRun
AppDir/a.desktop

# Turn AppDir into AppImage:
VERSION=1.0 ./appimagetool-*.AppImage ./AppDir

# Done, test it:
./A-1.0-aarch64.AppImage

NOTE: On my Raspberry Pi 5 the a.out crashes as soon as go-appimage worked on it. This is a bug. I don't know yet what is causing it. Possibly patchelf. Need to test this on an amd64 machine to see if it happens only on ARM.

probonopd commented 1 year ago

AppDir could not be identified: ./usr/bin does not exist

This literally means that you didn't have a AppDir/usr/bin.

VioletGiraffe commented 1 year ago

Update: this does work! I expected that the tool will create the structure, same as linuxdeployqt did. Thanks, trying it now. Would you consider adding a "simple" mode akin to linuxdeployqt?

P. S. Earlier today I was looking for the reference on AppDir structure, and couldn't find it. This link is sort of useless, and this one is hardly better.

probonopd commented 1 year ago

Glad that it is working for you!

Are you getting no segfault?

Would you consider adding a "simple" mode akin to linuxdeployqt?

So far no, because: Unlike in your example, most software has a make install command that can be used to create the needed structure automatically. So it shouldn't really be that much of a hassle in "the real world".