You are not logged in.
Hi,
I want to make my C++23 project easy downloadable with a AppImage. Therefore I installed everything I need and modified the CMake file. I added a screenshot, so you can see my files.
Thanks a lot for your help : )
I get an error, when executing the AppImage:
./MemoryGame.AppImage
execv error: Permission denied
My CMake file:
cmake_minimum_required(VERSION 3.28)
project(Memory CXX)
set(CMAKE_CXX_STANDARD 23)
# Füge alle Quell- und Header-Dateien hinzu
set(SOURCES
main.cpp
LinkedList.cpp
MemorySpiel.cpp
)
set(HEADERS
LinkedList.h
MemorySpiel.h
)
# Erstelle das ausführbare Ziel
add_executable(Memory ${SOURCES} ${HEADERS})
# Finde das GTK4-Paket
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK4 REQUIRED gtk4)
# Füge die GTK4 Include-Verzeichnisse hinzu
target_include_directories(Memory PRIVATE ${GTK4_INCLUDE_DIRS})
# Verlinke die GTK4-Bibliotheken
target_link_libraries(Memory PRIVATE ${GTK4_LIBRARIES})
# Füge andere Compiler-Optionen hinzu (optional)
add_compile_options(${GTK4_CFLAGS_OTHER})
# Setup für AppImage
set(APPIMAGE_PATH "${CMAKE_BINARY_DIR}/MemoryGame.AppDir")
file(MAKE_DIRECTORY ${APPIMAGE_PATH}/usr/bin)
file(MAKE_DIRECTORY ${APPIMAGE_PATH}/usr/share/applications)
file(MAKE_DIRECTORY ${APPIMAGE_PATH}/usr/share/icons/hicolor/128x128/apps)
# Installiere das ausführbare Ziel
install(TARGETS Memory DESTINATION "${APPIMAGE_PATH}/usr/bin")
# Erstelle die .desktop-Datei
file(WRITE ${APPIMAGE_PATH}/MemoryGame.desktop "[Desktop Entry]
Name=Memory Game
Exec=./usr/bin/Memory
Icon=MemoryGame
Type=Application
Categories=Game;")
# Überprüfe, ob das Icon existiert und kopiere es
if(EXISTS "${CMAKE_SOURCE_DIR}/img/img.png")
configure_file(${CMAKE_SOURCE_DIR}/img/img.png ${APPIMAGE_PATH}/MemoryGame.png COPYONLY)
else()
message(WARNING "Icon file 'Memory.png' not found!")
endif()
if(EXISTS "${CMAKE_SOURCE_DIR}/AppRun-x86_64")
configure_file(${CMAKE_SOURCE_DIR}/AppRun-x86_64 ${APPIMAGE_PATH}/AppRun COPYONLY)
else()
message(WARNING "AppRun-x86_64 not found!")
endif()
add_custom_command(
TARGET Memory POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/Memory ${APPIMAGE_PATH}/usr/bin/Memory
)
# Erstelle die AppImage
add_custom_command(TARGET Memory POST_BUILD
COMMAND ARCH=x86_64 appimagetool ${APPIMAGE_PATH} ${CMAKE_BINARY_DIR}/MemoryGame.AppImage
COMMENT "Creating AppImage")
Last edited by Rotstein (2024-10-30 11:14:36)
Offline
Please wrap outputs and script files in [ code ] [ /code ] tags without spaces.
Did you forget make the appimage executable with "chmod +x"? https://wiki.archlinux.org/title/Help:R … executable
Offline
Sorry, this is my first post in this forum, I don't know how to format right. Yes I looked up if X was set and it was, but I made chmod +x additionally and it didn't change anything.
Offline
you are copying a file called AppRun-x86_64 to AppRun Is that marked as executable, the file name sounds as if it should be.
I want to make my C++23 project easy downloadable with a AppImage.
Make sure you include all libraries into the appimage that might not exist on the target system otherwise an appimage is not better than a binary in a simple archive.
Last edited by progandy (2024-10-30 11:28:08)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Good point. It wasnt executable. I made it, but it didn't change anything.
felix@laptop-felix ~/C/M/c/MemoryGame.AppDir (master)> ls -l
insgesamt 48
-rw-r--r-- 1 felix felix 30696 30. Okt 11:04 AppRun
-rw-r--r-- 1 felix felix 104 30. Okt 11:04 MemoryGame.desktop
-rw-r--r-- 1 felix felix 5449 30. Okt 11:04 MemoryGame.png
drwxr-xr-x 4 felix felix 4096 30. Okt 11:04 usr/
felix@laptop-felix ~/C/M/c/MemoryGame.AppDir (master)> chmod +X AppRun
felix@laptop-felix ~/C/M/c/MemoryGame.AppDir (master)> cd ..
felix@laptop-felix ~/C/M/cmake-build-debug (master)> ./MemoryGame.AppImage
execv error: Permission denied
felix@laptop-felix ~/C/M/cmake-build-debug (master) [127]>
Offline
The appimage itself needs to be executable as well. And case matters, +X will only work if it's already executable in some shape or form, the correct way to set this is with a lowercase x
Offline