8

I'm trying to install the OpenSSL Cocoapod in Xcode 9.4 and I get the following:

[!] /bin/bash -c set -e VERSION="1.0.2h" 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."

cp: file.tgz: No such file or directory

This is the command I'm using in the podfile:

pod 'OpenSSL', '~> 1.0'

I've tried installing the Xcode Command Line Tools but this did not fix the problem.

Anyone have any idea what the problem is?

Ser Pounce
  • 14,196
  • 18
  • 84
  • 169

6 Answers6

3

First things first: If you can, try to switch to a different POD. That one is no longer maintained.

Workaround if you cannot switch:

curl https://www.openssl.org/source/openssl-<your-version>.tar.gz > file.tgz
cp file.tgz /tmp/openssl #create directory if needed
sed 's/cp \\"file.tgz\\" \\"${CURRENTPATH}\/file.tgz\\"//' `find ~/.cocoapods|grep "OpenSSL/<your-version>/OpenSSL.podspec.json"`
pod install

"< your version >" would be e.g. "1.0.2j" for the URL and "1.0.210" for the grep

patric.schenke
  • 942
  • 11
  • 19
1

I am seeing this issue also. Have not been able to resolve. Frustratingly this is happening on a Jenkins slave machine - whereas my own Mac has no issue with 'pod update' and seems to get OpenSSL without problem...

I since found out that the cocoapod-downloader had to be downgraded...for this to install... https://github.com/FredericJacobs/OpenSSL-Pod/issues/49

Jules Burt
  • 115
  • 2
  • 7
  • 1
    I ended up installing a different OpenSSL pod, the one in the answer to this question: https://stackoverflow.com/questions/50884744/reduce-size-of-openssl-binary. – Ser Pounce Jun 28 '18 at 19:06
1

I went around with several of the possible solutions, the one that worked for me was to downgrade cocoapods and the downloader. After OpenSSL is installed the pod install is done its fine to go back to the current ones. Exact steps:

sudo gem uninstall cocoapods-downloader
sudo gem install cocoapods-downloader -v 1.2.0
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.5.3
pod deintegrate
rm -rf /tmp/openssl
pod install
Andrew Smith
  • 2,919
  • 2
  • 22
  • 25
0

update: just use

pod 'OpenSSL', :git => 'https://github.com/isee15/OpenSSL.git'


replace pod OpenSSL with OpenSSL-XM

or

replace "prepare_command" in find ~/.cocoapods|grep "OpenSSL/1.0.2j/OpenSSL.podspec.json" with https://github.com/CocoaPods/Specs/blob/3b17051d7e0bbb5c97420a7a6d3aa9b1f6b601db/Specs/3/2/e/OpenSSL-XM/1.0.210.1/OpenSSL-XM.podspec.json

ProBlc
  • 111
  • 9
0

While I was trying to install a different cococapod, I got the same error. For me the solution was to downgrade cococapods downloader. This is the commands I used:

sudo gem uninstall cocoapods-downloader
sudo gem install cocoapods-downloader -v 1.2.0

Thnx

i.do.stuff
  • 207
  • 3
  • 11
0

Patric's answer works for me. But to make the answer a little bit more clear here:

rm -rf /tmp/openssl; mkdir /tmp/openssl && cd /tmp/openssl;
curl https://www.openssl.org/source/openssl-1.0.2j.tar.gz > file.tgz
cd -;
sed -i 's/cp \\"file.tgz\\" \\"${CURRENTPATH}\/file.tgz\\"//' `find ~/.cocoapods|grep "OpenSSL/1.0.210/OpenSSL.podspec.json"`

pod install

Note:

  • The pod install spent about 10 minutes on my mac air.
  • Replace 1.0.2j and 1.0.210 with your proper version if needed.
  • If you want to try, downgrade the cocoapods and cocoapods-downloader is another solution, please refer here.
gary
  • 1,569
  • 3
  • 20
  • 30