Project

General

Profile

Actions

Bug #6213

closed

Mac OS X 20181018 won't run (contains failed patch)

Added by M T over 5 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
10/18/2018
Due date:
% Done:

0%

Estimated time:
Chirp Version:
daily
Model affected:
(All models)
Platform:
MacOS
Debug Log:
I read the instructions above:

Description

Double-clicking the app won't launch it.

Running from the command line gives:

% ./chirp-daily-20181018.app/Contents/MacOS/chirp
./chirp-daily-20181018.app/Contents/MacOS/chirp: line 19: /opt/kk7ds/bin/python2.7: No such file or directory

Apparently there are a few patches that didn't take in that build:

% find ./chirp-daily-20181018.app -name \*.rej
./chirp-daily-20181018.app/Contents/MacOS/chirp.rej
./chirp-daily-20181018.app/Contents/Resources/chirp/chirpui/mainapp.py.rej
% cat ./chirp-daily-20181018.app/Contents/MacOS/chirp.rej
--- build/chirp.app/Contents/MacOS/chirp        Tue Apr 17 21:15:28 2012 -0700
+++ build/chirp.app/Contents/MacOS/chirp        Wed Apr 18 17:09:06 2012 -0700
@@ -2,4 +2,14 @@

 LOCATION=$(dirname ${BASH_SOURCE})

-exec /opt/kk7ds/bin/python2.7 ${LOCATION}/../Resources/chirp/chirpw
+PYTHON=/opt/kk7ds//Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
+
+if [ -x $PYTHON ]; then
+    ln -s $PYTHON ${LOCATION}/../CHIRP
+    PYTHON=${LOCATION}/../CHIRP
+    export PYTHONPATH="/opt/kk7ds//Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/"
+else
+    PYTHON=/opt/kk7ds/bin/python2.7
+fi
+
+exec $PYTHON ${LOCATION}/../Resources/chirp/chirpw
Actions #1

Updated by M T over 5 years ago

I now see this problem goes back to at least the beginning of 2018 (probably further; see 20180104 build). Has the daily Mac OS X build ever worked?

Actions #2

Updated by M T over 5 years ago

Confirmed that this is also a problem with the first available 2017 build:

% find ./chirp-daily-20170108.app -name \*.rej
./chirp-daily-20170108.app/Contents/MacOS/chirp.rej
./chirp-daily-20170108.app/Contents/Resources/chirp/chirpui/mainapp.py.rej
% ./chirp-daily-20170108.app/Contents/MacOS/chirp
./chirp-daily-20170108.app/Contents/MacOS/chirp: line 15: /opt/kk7ds/bin/python2.7: No such file or directory
Actions #3

Updated by Dan Smith over 5 years ago

This error looks like you haven't followed the instructions regarding the runtime that needs to be installed before the app will run. If that is the case, please see:

https://chirp.danplanet.com/projects/chirp/wiki/Download#MacOS-Users

Actions #4

Updated by M T over 5 years ago

I think you're going to need to package Python with the @.app@. Getting @libxml2@ installed natively is a chore, and I highly recommend not trying to do it in the global installation. Here's as far as I got in editing @….app/Contents/MacOS/chirp@ before giving up on trying to install a workable version at run time:

#!/bin/bash

ME="${0}"
LOCATION="$( cd "$( dirname "${ME}" )" && pwd )"

_VENVSETUP_BASE_PYTHON="${PYTHON:-python}"

for _VENVSETUP_BASE_PYTHON in \
        '/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python' \
        '/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python' \
        /opt/kk7ds/bin/python2.7 \
        python2.7 \
        python \
        '' ; do
    if [ -z "${_VENVSETUP_BASE_PYTHON}" ] ; then
        _VENVSETUP_BASE_PYTHON_SHORT_VERS=
        break
    else
        if [ ! -x "$(which 2>/dev/null "${_VENVSETUP_BASE_PYTHON}")" ] ; then
            continue
        fi

        _VENVSETUP_BASE_PYTHON_SHORT_VERS="$("${_VENVSETUP_BASE_PYTHON}" -c 'import sys; print(".".join(str(i) for i in sys.version_info[:2]))')"

        if [ "${_VENVSETUP_BASE_PYTHON_SHORT_VERS}" = 2.7 ] ; then
            break
        fi
    fi
done

if [ -z "${_VENVSETUP_BASE_PYTHON}" ] ; then
    echo 1>&1 "${ME}: can't find a suitable Python installation; giving up"
    exit 1
fi

_VENVSETUP_BASE_PYTHON_VERS="$("${_VENVSETUP_BASE_PYTHON}" -c 'import sys; print(".".join(str(i) for i in sys.version_info))')"
_VENVSETUP_DIR="${VIRTUAL_ENV:-${LOCATION}/.venv-${_VENVSETUP_BASE_PYTHON_VERS}}"
_VENVSETUP_PYTHON="${_VENVSETUP_DIR}/bin/python"
_VENVSETUP_PIP="${_VENVSETUP_DIR}/bin/pip"

_venvsetup() {
    (
        set -e

        local _VENVSETUP_BOOTSTRAP_VERS=16.1.0
        local _VENVSETUP_BOOTSTRAP_URL="https://files.pythonhosted.org/packages/4e/8b/75469c270ac544265f0020aa7c4ea925c5284b23e445cf3aa8b99f662690/virtualenv-${_VENVSETUP_BOOTSTRAP_VERS}.tar.gz"
        local _VENVSETUP_BOOTSTRAP_TGZ="/tmp/$( basename "${_VENVSETUP_BOOTSTRAP_URL}" )"
        local _VENVSETUP_BOOTSTRAP_TGZ_CHECKSUM=f899fafcd92e1150f40c8215328be38ff24b519cd95357fa6e78e006c7638208
        local _VENVSETUP_BOOTSTRAP_TGZ_DIR="${_VENVSETUP_BOOTSTRAP_TGZ%.tar.gz}"

        if [ ! -e "${_VENVSETUP_PYTHON}" ] \
                || [ ! -e "${_VENVSETUP_PIP}" ] ; then
            if "${_VENVSETUP_BASE_PYTHON}" >/dev/null 2>&1 -m virtualenv --version ; then
                "${_VENVSETUP_BASE_PYTHON}" -m virtualenv "${_VENVSETUP_DIR}"
            else
                echo 1>&2 "${ME}: can't find suitable virtualenv; attempting to bootstrap ${_VENVSETUP_BOOTSTRAP_VERS}"
                curl -o "${_VENVSETUP_BOOTSTRAP_TGZ}" "${_VENVSETUP_BOOTSTRAP_URL}"

                if ! which >/dev/null 2>&1 openssl ; then
                    echo 1>&2 "${ME}: can't find openssl; giving up"

                    return 1
                fi

                tgz_checksum="$( openssl dgst -r -sha256 "${_VENVSETUP_BOOTSTRAP_TGZ}" | cut -c 1-64 )"

                if [ "${tgz_checksum}" != "${_VENVSETUP_BOOTSTRAP_TGZ_CHECKSUM}" ] ; then
                    echo 1>&2 "${ME}: checksum mismatch for ${_VENVSETUP_BOOTSTRAP_TGZ} (expected ${_VENT_TGZ_CHECKSUM}; got ${tgz_checksum}); giving up"

                    return 1
                fi

                tar -xv -C /tmp -pf "${_VENVSETUP_BOOTSTRAP_TGZ}"
                "${_VENVSETUP_BASE_PYTHON}" "${_VENVSETUP_BOOTSTRAP_TGZ_DIR}/src/virtualenv.py" "${_VENVSETUP_DIR}"
            fi
        fi

        "${_VENVSETUP_PIP}" install --upgrade python-libxml2
        [ ! -f requirements.txt ] \
            || "${_VENVSETUP_PIP}" install -rrequirements.txt
    ) \
            || return "${?}"
}

if [ ! -x "${_VENVSETUP_PIP}" ] ; then
    xcode-select --install
    _venvsetup
fi

exec "${_VENVSETUP_PYTHON}" "${LOCATION}/../Resources/chirp/chirpw"
Actions #5

Updated by M T over 5 years ago

Brew provides some help, but not for the average user:

# /usr/bin/env bash
set -ex
cd …/chirp-daily-20181018.app/Contents/MacOS
cat >chirp </dev/null "${PYTHON}")" ] ; then
            continue
        fi

        PYTHON_SHORT_VERS="$("${PYTHON}" -c 'import sys; print(".".join(str(i) for i in sys.version_info[:2]))')"

        if [ "${PYTHON_SHORT_VERS}" = 2.7 ] ; then
            break
        fi
    fi
done

if [ -z "${PYTHON}" ] ; then
    echo 1>&1 "${ME}: can't find a suitable Python installation; giving up"
    exit 1
fi

exec "${PYTHON}" "${LOCATION}/../Resources/chirp/chirpw"
EOF
xcode-select --install
git clone https://github.com/Homebrew/brew.git
cd brew
git co 1.8.1
./bin/brew update
./bin/brew doctor
./bin/brew install python@2
./bin/brew install --with-python libxml2
./bin/brew install --with-python libxslt
./bin/brew link libxml2 --force
./bin/brew link libxslt --force
./brew/bin/brew install pygtk

Assuming that all works, one now gets the following error:

$ …/chirp-daily-20181018.app/Contents/MacOS/chirp
2018-11-03 17:14:59.052 Python[26721:17492107] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
WARNING: Icon  not found
Traceback (most recent call last):
  File "/Users/matt/Desktop/chirp-daily-20181018.app/Contents/MacOS/../Resources/chirp/chirpw", line 128, in 
    a = mainapp.ChirpMain()
  File "/Users/matt/Desktop/chirp-daily-20181018.app/Contents/Resources/chirp/chirp/ui/mainapp.py", line 2091, in __init__
    self._init_macos(mbar)
  File "/Users/matt/Desktop/chirp-daily-20181018.app/Contents/Resources/chirp/chirp/ui/mainapp.py", line 2033, in _init_macos
    LOG.error("No MacOS support: %s" % e)
NameError: global name 'e' is not defined

I don't understand how CHIRP can claim MacOS support if this is the state of things?

Actions #6

Updated by M T over 5 years ago

Okay, I found a work-around using brew:

set -ex
cd …/chirp-daily-20181018.app/Contents/MacOS
cat >chirp </dev/null "${PYTHON}")" ] ; then
            continue
        fi

        PYTHON_SHORT_VERS="$("${PYTHON}" -c 'import sys; print(".".join(str(i) for i in sys.version_info[:2]))')" 

        if [ "${PYTHON_SHORT_VERS}" = 2.7 ] ; then
            break
        fi
    fi
done

if [ -z "${PYTHON}" ] ; then
    echo 1>&1 "${ME}: can't find a suitable Python installation; giving up" 
    exit 1
fi

exec "${PYTHON}" "${LOCATION}/../Resources/chirp/chirpw" 
EOF
xcode-select --install
git clone https://github.com/Homebrew/brew.git
(cd brew && git checkout 1.8.1)
./brew/bin/brew update
./brew/bin/brew doctor
./brew/bin/brew install --with-python libxml2
./brew/bin/brew install --with-python libxslt
./brew/bin/brew link libxml2 --force
./brew/bin/brew link libxslt --force
./brew/bin/brew install gtk-mac-integration
open …/chirp-daily-20181018.app  # should work now
Actions #7

Updated by M T over 5 years ago

M B wrote:

Okay, I found a work-around using brew:

[...]

Should have included:

./brew/bin/pip install --upgrade pyserial
Actions #8

Updated by M T about 5 years ago

This should probably be closed as invalid, but it looks like I don't have sufficient privileges to do that.

Actions #9

Updated by Bernhard Hailer almost 4 years ago

  • Status changed from New to Closed

Closed as suggested by submitter.

Actions

Also available in: Atom PDF