Issues packaging a commercial app with WINE and .NET bundled

Questions about Wine on Linux
Locked
Vadi
Level 1
Level 1
Posts: 6
Joined: Mon Nov 20, 2017 8:24 am

Issues packaging a commercial app with WINE and .NET bundled

Post by Vadi »

I've got an app that runs well enough with Wine 2.4 using .NET 4.6 and I'd like to package it together into an AppImage so it can be distributable and work for a good majority of Linux users out of the box.

I've got my prefix and wine version in good order - the .NET verifier, when ran standalone, is happy with it. However when I run the .NET verifier from inside my script which extracts the AppImage, fails verification with the following:
****ERROR**** Process 'Netfx40TestApplication.exe' exited with return code -1073741502
What could be the problem? If I run the verifier using the same prefix outside of my script, it works fine. Inside the script, it does not. Could there be a difference in the environment variables that is affecting this... ?
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: Issues packaging a commercial app with WINE and .NET bun

Post by DarkShadow44 »

Shouldn't the AppImage extract itself instead of a script doing that? Mind showing how exactly you do it?
probono
Newbie
Newbie
Posts: 3
Joined: Mon Dec 04, 2017 4:26 pm

Re: Issues packaging a commercial app with WINE and .NET bun

Post by probono »

Why are you "extracting" an AppImage? AppImages are supposed to stay as a compressed filesystem all the time. Some trickery is needed to run a $WINEPREFIX from a read-only location, but it can be done.

Check https://github.com/AppImage/AppImageKit ... neprefix-1 to get some rough idea on how this works.
Vadi
Level 1
Level 1
Posts: 6
Joined: Mon Nov 20, 2017 8:24 am

Re: Issues packaging a commercial app with WINE and .NET bun

Post by Vadi »

I'll do the complicated trickery later, once I can actually run my application from a wineprefix inside the AppImage. For the time being, I'm extracting the wineprefix manually and trying to run my application from there - but without success.

@DarkShadow44:

This is what I'm doing right now:

Code: Select all

#!/bin/bash
# Author : Ismael Barros² <[email protected]>
# License : BSD http://en.wikipedia.org/wiki/BSD_license

export APPDIR="$(dirname "$(readlink -f "$0")")"
export APPPKG="$(basename "$APPIMAGE")"
LOGFILE=$(mktemp "/tmp/AppRun-log-${APPPKG}.XXXXXXXXXX")

BINARY="forge.exe"
BINARY_ARGS=
WINETRICKS="dotnet46"

. "$APPDIR/util.sh"

# Uncomment this if the app needs relative paths specified on the command line
#eval arguments="$(patch_relative_paths "$@")"
#set -- "${arguments[@]}"

export PATH="$APPDIR/opt/wine-staging/bin:${PATH}"

[ -z "$*" ] && show_usage "$APPDIR/usage.txt"

"$APPDIR/opt/wine-staging/bin/wineserver" -k
setup_keepResolution

# export WINEPREFIX="$HOME/.local/share/AppImage/forge_wine"
export WINEPREFIX="$HOME/.forge7"
export WINEARCH="win32"
export WINEDEBUG="-all"
export WINEDLLOVERRIDES="mshtml,mscoree=,winemenubuilder.exe=n"
export LD_LIBRARY_PATH=${APPDIR}/opt/wine-staging/lib64:${LD_LIBRARY_PATH}
export WINESERVER=${APPDIR}/opt/wine-staging/bin/wineserver
export WINELOADER=${APPDIR}/opt/wine-staging/bin/wine
export WINEDLLPATH=${APPDIR}/opt/wine-staging/lib:${APPDIR}/opt/wine-staging/lib/wine
export WINEDLLOVERRIDES="mscoree,mshtml="

# use wine from the AppImage
export WINE="$APPDIR/opt/wine-staging/bin/wine"


CONF=
for i in $@; do
    case $i in
        @conf) CONF=1; shift ;;
        @reset) rm -rfv "$WINEPREFIX"; shift ;;
    esac
done


if [ ! -d "$WINEPREFIX" ]; then
    echo "no wineprefix"

    cp -r "$APPDIR/.forge7" "$WINEPREFIX"
    echo "copied wineprefix in ($WINEPREFIX)"
    find "$WINEPREFIX" -type d -exec chmod 775 "{}" \;
    find "$WINEPREFIX" -type f -exec chmod 664 "{}" \;
#        chown -R "${USER}" "${WINEPREFIX}"
#        mkdir -p "${WINEPREFIX}/dosdevices"
#        mkdir -p "${WINEPREFIX}/drive_c"
#        mkdir -p "${WINEPREFIX}/drive_c/StarCraft"
#        ln -nfs "${WINEPREFIX}/drive_c" "${WINEPREFIX}/dosdevices/c:"
#        ln -nfs "${HOME}" "${WINEPREFIX}/dosdevices/y:"
#        ln -nfs "/" "${WINEPREFIX}/dosdevices/z:"

    for i in "${APPDIR}/"*.reg; do
        [ -f "$i" ] && cp -v "$i" "${WINEPREFIX}"
    done
    echo "copied .reg files in"

    mkdir -p ~/.cache/winetricks/
    echo "made winetricks dir"
    if [ "$WINETRICKS" ]; then
            for i in $APPDIR/winetricks/*; do
                    ln --symbolic --force "$i" ~/.cache/winetricks/
                    echo "created symbolink link for $i into winetricks cache"
            done
            # "$APPDIR/opt/wine-staging/bin/winetricks" --verbose --unattended $WINETRICKS
            # "$APPDIR/opt/wine-staging/bin/winetricks" --unattended "dotnet46"
            # echo "winetricks ran"
            run_withLocalLibs "$APPDIR/opt/wine-staging/bin/wineboot"
            WINEPREFIX="$HOME/.forge7" WINEARCH=win32 wine /home/vadi/Downloads/netfx_setupverifier_new/netfx_setupverifier.exe
            # run_withLocalLibs "$APPDIR/opt/wine-staging/bin/wine" /home/vadi/Downloads/netfx_setupverifier_new/netfx_setupverifier.exe
            # exit
    fi
fi

cd "$WINEPREFIX"

echo "cd into $WINEPREFIX"
"$APPDIR/opt/wine-staging/bin/wineboot"
echo "rebooted wine"

if [ $CONF ]; then
    run_withLocalLibs "$APPDIR/opt/wine-staging/bin/winecfg" $@
else
    run_withLocalLibs "$APPDIR/opt/wine-staging/bin/wine" "$APPDIR/$BINARY" $BINARY_ARGS "$@"
fi

echo "Ran app."
The strange thing is that if I run

Code: Select all

WINEPREFIX="$HOME/.forge7" WINEARCH=win32 wine /home/vadi/Downloads/netfx_setupverifier_new/netfx_setupverifier.exe
from the command line manually, after the AppImage is run, it works fine. I'm puzzled as to what could the difference be.
Vadi
Level 1
Level 1
Posts: 6
Joined: Mon Nov 20, 2017 8:24 am

Re: Issues packaging a commercial app with WINE and .NET bun

Post by Vadi »

Where else can I find help with debugging this problem?
Locked