hyphanet / java_installer

The java-based installer
https://freenetproject.org/
25 stars 19 forks source link

Trying to start Freenet 0.7 on macOS 64bit fails #21

Closed tusalova closed 2 years ago

tusalova commented 2 years ago

I downloaded the new_installer_offline_1492.jar and ran successfully through the installation process. I installed Freenet to the folder /Applications/Freenet. After that I looked for some sort of start script and found run.sh. Therefore I executed the following command:

Freenet $ pwd
/Applications/Freenet
Freenet $ ./run.sh start
Your JAVA_HOME seems to be incompatible with your PATH, ignoring it.
Your java executable at /usr/bin/java seems suitable
Starting Freenet 0.7...
nice: /Applications/Freenet/./bin/wrapper-macosx-universal-32: Bad CPU type in executable

The script fails because it tries to run a 32bit binary but I'm on 64bit, at least I think that's the reason. I searched in the script /Applications/Freenet/run.sh for a solution because I found out that there exists a 64bit binary (/Applications/Freenet/bin/wrapper-macosx-universal-64).

After changing the env variable DIST_BIT in line 284 of run.sh from the hardcoded value 32 to 64 and running the script again with ./run.sh start freenet installed successfully. NICE.

Why do I post an issue if I already found the solution? I think it's probably easy to add a check for the system architecture to prevent such a failure for others trying to install freenet. Can this please be added?

I'm not sure if this issue should be created in this repo or in the freenet/fred repo. Please help.

tusalova commented 2 years ago

I'm not sure what the thumb up means. If it helps I would like to solve that problem and add a check for the system architecture. Is this wanted? :)

Thynix commented 2 years ago

Yes, please! This is the correct repository for that. There's a UNIX run.sh here - it'd probably make sense to modify that to account for MacOS bitness, as opposed to adding a Mac-specific run.sh.

Thynix commented 2 years ago

Looks like this was the part that didn't behave properly:

# Resolve the architecture
DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d " \t\r\n"`
case "$DIST_ARCH" in
    'amd64' | 'ia32' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
        DIST_ARCH="x86"
        ;;
    'ia64' | 'ia-64')
    DIST_ARCH="ia64"
    ;;
    'ip27' | 'mips')
        DIST_ARCH="mips"
        ;;
    'powermacintosh' | 'power' | 'powerpc' | 'power_pc' | 'ppc64')
        DIST_ARCH="ppc"
        ;;
    'pa_risc' | 'pa-risc')
        DIST_ARCH="parisc"
        ;;
    'sun4u' | 'sparcv9')
        DIST_ARCH="sparc"
        ;;
    '9000/800')
        DIST_ARCH="parisc"
        ;;
    armv*)
        if [ -z "`readelf -A /proc/self/exe | grep Tag_ABI_VFP_args`" ] ; then
            DIST_ARCH="armel"
        else
            DIST_ARCH="armhf"
        fi
        ;;
esac
tusalova commented 2 years ago

I just found out that this problem was already found and solved by desyncr in the following pull requests:

Unfortunately the second one was never merged. So there is no need for solving this again.

Thynix commented 2 years ago

Oh! Neat. Merged, thank you for bringing this up!