robotmedia / RMStore

A lightweight iOS library for In-App Purchases
Apache License 2.0
2.43k stars 450 forks source link

pod install for AppReceiptVerificator fails on OpenSSL #185

Open intari opened 8 years ago

intari commented 8 years ago

pod install --verbose with RMStore/AppReceiptVerificator in podfile results in

-> Installing OpenSSL (1.0.207) Http download $ /usr/bin/curl -f -L -o /var/folders/cf/4y9l8z090v77w4lbplglvgbh0000gn/T/d20160428-39990-1lo1hc9/file.tgz https://openssl.org/source/openssl-1.0.2g.tar.gz --create-dirs % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5142k 100 5142k 0 0 1900k 0 0:00:02 0:00:02 --:--:-- 1900k $ /usr/bin/tar xfz /var/folders/cf/4y9l8z090v77w4lbplglvgbh0000gn/T/d20160428-39990-1lo1hc9/file.tgz -C /var/folders/cf/4y9l8z090v77w4lbplglvgbh0000gn/T/d20160428-39990-1lo1hc9 Running prepare command $ /bin/bash -c set -e VERSION="1.0.2g" SDKVERSION=xcrun --sdk iphoneos --show-sdk-version 2> /dev/null MIN_SDK_VERSION_FLAG="-miphoneos-version-min=7.0" BASEPATH="${PWD}" CURRENTPATH="/tmp/openssl" ARCHS="i386 x86_64 armv7 armv7s arm64" DEVELOPER=xcode-select -print-path mkdir -p "${CURRENTPATH}" mkdir -p "${CURRENTPATH}/bin" cp "file.tgz" "${CURRENTPATH}/file.tgz" cd "${CURRENTPATH}" tar -xzf file.tgz cd "openssl-${VERSION}" for ARCH in ${ARCHS} do CONFIGURE_FOR="iphoneos-cross" if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ] ; then PLATFORM="iPhoneSimulator" if [ "${ARCH}" == "x86_64" ] ; then CONFIGURE_FOR="darwin64-x86_64-cc" fi else sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" PLATFORM="iPhoneOS" fi export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}" echo "Please stand by..." export CC="${DEVELOPER}/usr/bin/gcc -arch ${ARCH} ${MIN_SDK_VERSION_FLAG}" mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log" LIPO_LIBSSL="${LIPO_LIBSSL} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libssl.a" LIPO_LIBCRYPTO="${LIPO_LIBCRYPTO} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libcrypto.a" ./Configure ${CONFIGURE_FOR} --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} !" "Makefile" make >> "${LOG}" 2>&1 make all install_sw >> "${LOG}" 2>&1 make clean >> "${LOG}" 2>&1 done echo "Build library..." rm -rf "${BASEPATH}/lib/" mkdir -p "${BASEPATH}/lib/" lipo -create ${LIPO_LIBSSL} -output "${BASEPATH}/lib/libssl.a" lipo -create ${LIPO_LIBCRYPTO} -output "${BASEPATH}/lib/libcrypto.a" echo "Copying headers..." rm -rf "${BASEPATH}/opensslIncludes/" mkdir -p "${BASEPATH}/opensslIncludes/" cp -RL "${CURRENTPATH}/openssl-${VERSION}/include/openssl" "${BASEPATH}/opensslIncludes/" cd "${BASEPATH}" echo "Building done." echo "Cleaning up..." rm -rf "${CURRENTPATH}" echo "Done." Building openssl-1.0.2g for iPhoneSimulator 9.3 i386 Please stand by... [!] /bin/bash -c set -e VERSION="1.0.2g" SDKVERSION=xcrun --sdk iphoneos --show-sdk-version 2> /dev/null MIN_SDK_VERSION_FLAG="-miphoneos-version-min=7.0"

BASEPATH="${PWD}" CURRENTPATH="/tmp/openssl" ARCHS="i386 x86_64 armv7 armv7s arm64" DEVELOPER=xcode-select -print-path

mkdir -p "${CURRENTPATH}" mkdir -p "${CURRENTPATH}/bin"

cp "file.tgz" "${CURRENTPATH}/file.tgz" cd "${CURRENTPATH}" tar -xzf file.tgz cd "openssl-${VERSION}"

for ARCH in ${ARCHS} do CONFIGURE_FOR="iphoneos-cross"

if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ] ; then PLATFORM="iPhoneSimulator" if [ "${ARCH}" == "x86_64" ] ; then CONFIGURE_FOR="darwin64-x86_64-cc" fi else sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" PLATFORM="iPhoneOS" fi

export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"

echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}" echo "Please stand by..."

export CC="${DEVELOPER}/usr/bin/gcc -arch ${ARCH} ${MIN_SDK_VERSION_FLAG}" mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log"

LIPO_LIBSSL="${LIPO_LIBSSL} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libssl.a" LIPO_LIBCRYPTO="${LIPO_LIBCRYPTO} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libcrypto.a"

./Configure ${CONFIGURE_FOR} --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} !" "Makefile"

make >> "${LOG}" 2>&1 make all install_sw >> "${LOG}" 2>&1 make clean >> "${LOG}" 2>&1 done

echo "Build library..." rm -rf "${BASEPATH}/lib/" mkdir -p "${BASEPATH}/lib/" lipo -create ${LIPO_LIBSSL} -output "${BASEPATH}/lib/libssl.a" lipo -create ${LIPO_LIBCRYPTO} -output "${BASEPATH}/lib/libcrypto.a"

echo "Copying headers..." rm -rf "${BASEPATH}/opensslIncludes/" mkdir -p "${BASEPATH}/opensslIncludes/" cp -RL "${CURRENTPATH}/openssl-${VERSION}/include/openssl" "${BASEPATH}/opensslIncludes/"

cd "${BASEPATH}" echo "Building done."

echo "Cleaning up..." rm -rf "${CURRENTPATH}" echo "Done."

Building openssl-1.0.2g for iPhoneSimulator 9.3 i386 Please stand by...

/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/executable.rb:70:in execute_command' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/executable.rb:27:inblock in executable' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/pod_source_preparer.rb:64:in block (2 levels) in run_prepare_command' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/pod_source_preparer.rb:60:inchdir' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/pod_source_preparer.rb:60:in block in run_prepare_command' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:insection' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/pod_source_preparer.rb:59:in run_prepare_command' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/pod_source_preparer.rb:37:inprepare!' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/downloader/cache.rb:201:in copy_and_clean' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/downloader/cache.rb:158:inblock (2 levels) in uncached_pod' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/downloader/cache.rb:156:in each' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/downloader/cache.rb:156:inblock in uncached_pod' bash-3.2$ /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/downloader/cache.rb:180:in call' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/downloader/cache.rb:180:inin_tmpdir' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/downloader/cache.rb:152:in uncached_pod' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/downloader/cache.rb:33:indownload_pod' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/downloader.rb:34:in download' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/pod_source_installer.rb:113:indownload_source' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer/pod_source_installer.rb:53:in install!' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:339:ininstall_source_of_pod' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:306:in block (2 levels) in install_pod_sources' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:80:intitled_section' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:305:in block in install_pod_sources' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:297:ineach' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:297:in install_pod_sources' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:146:inblock in download_dependencies' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:in section' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:144:indownload_dependencies' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:106:in install!' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:71:inrun_install_with_update' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:101:in run' /Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:312:inrun' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/command.rb:47:in run' /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/bin/pod:44:in<top (required)>' /usr/local/bin/pod:23:in load' /usr/local/bin/pod:23:in

'

Tibbs commented 8 years ago

I have the same issue. Any workaround?

wfratczak commented 7 years ago

I have the same? Any idea?

Phunk87 commented 7 years ago

I have the same issue.

DoctorG commented 7 years ago

me too

yvsbb95 commented 7 years ago

Did anyone find any solution for this?

FranDepascuali commented 7 years ago

We had an issue in https://getmimo.com/ with this. I'll share our solution.

Problem When adding OpenSSL pod and running pod install, it fails with this error:

[!] /bin/bash -c
set -e
    ARCHS="i386 x86_64 armv7 armv7s arm64"

    BASEPATH="${PWD}"
    BUILDDIR="${TMPDIR}OpenSSL"
    SRCDIR="${BUILDDIR}/src"

    SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version`
    CLANG=`xcrun --find clang`
    DEVELOPER=`xcode-select --print-path`

    rm -rf "${BUILDDIR}"
    mkdir -p "${SRCDIR}"
    cp -R "${BASEPATH}/." "${SRCDIR}"
    cd "${SRCDIR}"

    for ARCH in ${ARCHS}
    do
      if [ "${ARCH}" == "i386" -o "${ARCH}" == "x86_64" ];
      then
        PLATFORM="iPhoneSimulator"
      else
        sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "${SRCDIR}/crypto/ui/ui_openssl.c"
        PLATFORM="iPhoneOS"
      fi

      CONF="no-asm"

      if [ "${ARCH}" == "arm64" -o "${ARCH}" == "x86_64" ];
      then
        HOST="BSD-generic64"
        CONF="${CONF} enable-ec_nistp_64_gcc_128"
      else
        HOST="BSD-generic32"
      fi

      OPENSSLDIR="${BUILDDIR}/${PLATFORM}${SDK_VERSION}-${ARCH}"

      LIPO_LIBSSL="${LIPO_LIBSSL} ${OPENSSLDIR}/lib/libssl.a"
      LIPO_LIBCRYPTO="${LIPO_LIBCRYPTO} ${OPENSSLDIR}/lib/libcrypto.a"

      rm -rf "${OPENSSLDIR}"
      mkdir -p "${OPENSSLDIR}"

      LOG="${OPENSSLDIR}/build.log"

      export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
      export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${SDK_VERSION}.sdk"
      export CC="${CLANG}"

      ./Configure ${HOST} ${CONF} --openssldir="${OPENSSLDIR}" > "${LOG}" 2>&1

      sed -ie "s!^CFLAG=!CFLAG=-isysroot ${SDKROOT} -arch ${ARCH} -mios-version-min=7.0 !" "Makefile"

      make >> "${LOG}" 2>&1
      make all install_sw >> "${LOG}" 2>&1
      make clean >> "${LOG}" 2>&1
    done

    rm -f "${BASEPATH}/libssl.a"
    rm -f "${BASEPATH}/libcrypto.a"
    lipo -create ${LIPO_LIBSSL}    -output "${BASEPATH}/libssl.a"
    lipo -create ${LIPO_LIBCRYPTO} -output "${BASEPATH}/libcrypto.a"

    cp -RL "${SRCDIR}/include/." "${BASEPATH}/"

    cd "${BASEPATH}"
    rm -rf "${BUILDDIR}"

    MODULE="module.modulemap"
    BEFORE_HEADERS="rc2.h rc4.h"
    AFTER_HEADERS="dtls1.h"
    EXCLUDE_HEADERS="${BEFORE_HEADERS} ${AFTER_HEADERS}"

    function print_submodule {
        echo -e "    explicit module $(basename $1 | cut -d"." -f1) {
        header \"$1\"
    }
"
    }

    echo "module OpenSSL {" > $MODULE

    for HEADER in openssl/*.h; do
        if [[ $BEFORE_HEADERS =~ $(basename $HEADER) ]]; then
          print_submodule $HEADER >> $MODULE
        fi
    done

    for HEADER in openssl/*.h; do
        if [[ ! $EXCLUDE_HEADERS =~ $(basename $HEADER) ]]; then
          print_submodule $HEADER >> $MODULE
        fi
    done

    for HEADER in openssl/*.h; do
        if [[ $AFTER_HEADERS =~ $(basename $HEADER) ]]; then
          print_submodule $HEADER >> $MODULE
        fi
    done

    echo -e "    link \"ssl\"
    link \"crypto\"
}" >> $MODULE

xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'SDKVersion' in SDK 'iphoneos'

The last three lines induce that there is a problem with the xcode command line tools/simulators.

xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'SDKVersion' in SDK 'iphoneos'

Solution Reinstall or update xcode so it installs the command line tools.

Detailed explanation While updating the system software (one of the app store update), something got broken* in the command line tools. This tool is the one that allows to build xcode from command line. At the same time, this tool is used by the openssl pod, so it failed because of openssl pod not being able to use it.

Our first error was:

xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'SDKVersion' in SDK 'iphoneos'

which, if we search for it in google, the first link mentions an issue here: https://github.com/bazelbuild/bazel/issues/2097. One of the answers of the issue says:

Looks due to xcode not being installed on the CI machine.
Command line tools are the only requirement for bazel in general, but, if we want to actually build objc / ios targets, as is done in these tests, we require xcode to be installed.

So again, they had a problem with the command line tools. (They mention xcode not being installed because by default command line tools come with xcode installation).

From the error snippet of the pod, (I’m pretty sure) these depend on the command line tools:

…
    SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version`
    CLANG=`xcrun --find clang`
    DEVELOPER=`xcode-select --print-path`
…

So by (re)installing xcode (or installing the command line tools) it get fixed.

strictlyd commented 7 years ago

I came something fairly similar except that there was no actual errors being outputted when I was installing the OpenSSL pod. The output was just a cat of a script. After debugging, it seems that errors were being swallowed from this script.

A solution that worked for me was switching to the regular terminal and bash shell when running pod install.