Building OpenSSL and CURL for iOS 64-bit platform

We provide here instructions to build OpenSSL and CURL third party libraries to work with RMSDK 10 and RMSDK 11.

Note that CURL library used in RMSDK 11 needs to be compiled with SSL option. For RMSDK 10, it is optional. The build flag in the script below uses without-ssl for RMSDK 10. The flag to build for SSL is with-darwinssl.

For customers who are accustomed to using the make file DLBuildIOSExternals.mak, to build both OpenSSL and CURL, please note that the new scripts replace this makefile.

System requirements:

  • Xcode 6.1.1
  • iOS SDK 8.1
  • OpenSSL 1.0.1j or newer (tested with 1.0.1j, for newer, modify the script)
  • CURL 7.36.0 (for different version, modify the build script)

The scripts are pasted as text in this solution. A copy of the scripts are posted here for download (check back later if the links are not working yet).

Building OpenSSL

The script is used to build OpenSSL for iOS using an Apple MacBookPro running Mac OS 10.9.5, with XCode 6.1.1 with iOS 8.1 SDK.

  1. Obtain the source if needed. Select "openssl-1.0.1j.tar.gz" and save the tar file to a folder. The build script will extract the archive.
  2. Set up build.sh in the same folder as the tar file. Copy and paste the script text below to this build.sh file, or use the downloaded version. The .sh file name does not have to be precisely called "build."
  3. Build OpenSSL. Run build.sh script from command line from a terminal window on Mac, and it will create include and lib folder with appropriate contents.
  4. To book2png, as part of the RMSDK build, copy the include and lib folders to thirdparty\openssl\public\ios directory in the RMSDK source tree. You may have to modify the path and the file names for the newly built OpenSSL in your own reader app project.
  5. Continue with building RMSDK from this point on.
 ===========START of OPENSSL SCRIPT ==========
#!/bin/bash

#This script builds a static version of
# OpenSSL ${OPENSSL_VERSION} for iOS 7.1 that contains code for
# arm64, armv7, arm7s, i386 and x86_64.

set -x

# Setup paths to stuff we need

OPENSSL_VERSION="1.0.1j"

DEVELOPER="/Applications/Xcode.app/Contents/Developer"

SDK_VERSION="8.1"
MIN_VERSION="8.1"

IPHONEOS_PLATFORM="${DEVELOPER}/Platforms/iPhoneOS.platform"
IPHONEOS_SDK="${IPHONEOS_PLATFORM}/Developer/SDKs/iPhoneOS${SDK_VERSION}.sdk"
IPHONEOS_GCC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"

IPHONESIMULATOR_PLATFORM="${DEVELOPER}/Platforms/iPhoneSimulator.platform"
IPHONESIMULATOR_SDK="${IPHONESIMULATOR_PLATFORM}/Developer/SDKs/iPhoneSimulator${SDK_VERSION}.sdk"
IPHONESIMULATOR_GCC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"

# Make sure things actually exist

if [ ! -d "$IPHONEOS_PLATFORM" ]; then
 echo "Cannot find $IPHONEOS_PLATFORM"
 exit 1
fi

if [ ! -d "$IPHONEOS_SDK" ]; then
 echo "Cannot find $IPHONEOS_SDK"
 exit 1
fi

if [ ! -x "$IPHONEOS_GCC" ]; then
 echo "Cannot find $IPHONEOS_GCC"
 exit 1
fi

if [ ! -d "$IPHONESIMULATOR_PLATFORM" ]; then
 echo "Cannot find $IPHONESIMULATOR_PLATFORM"
 exit 1
fi
if [ ! -d "$IPHONESIMULATOR_SDK" ]; then
 echo "Cannot find $IPHONESIMULATOR_SDK"
 exit 1
fi

if [ ! -x "$IPHONESIMULATOR_GCC" ]; then
 echo "Cannot find $IPHONESIMULATOR_GCC"
 exit 1
 fi

# Clean up whatever was left from our previous build

rm -rf include lib
rm -rf /tmp/openssl-${OPENSSL_VERSION}-*
rm -rf /tmp/openssl-${OPENSSL_VERSION}-*.*-log

build()
{
   TARGET=$1
    ARCH=$2
    GCC=$3
    SDK=$4
    EXTRA=$5
    rm -rf "openssl-${OPENSSL_VERSION}"
    tar xfz "openssl-${OPENSSL_VERSION}.tar.gz"
    pushd .
    cd "openssl-${OPENSSL_VERSION}"
    /Configure ${TARGET} --openssldir="/tmp/openssl-${OPENSSL_VERSION}-${ARCH}" ${EXTRA} &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.log"
    perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
    perl -i -pe "s|^CC= gcc|CC= ${GCC} -arch ${ARCH} -miphoneos-version-min=${MIN_VERSION}|g" Makefile
   perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDK} \$1|g" Makefile
   make &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.build-log"
   make install &> "/tmp/openssl-${OPENSSL_VERSION}-${ARCH}.install-log"
   popd
   rm -rf "openssl-${OPENSSL_VERSION}"
}

build "BSD-generic32" "armv7" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}" ""
build "BSD-generic32" "armv7s" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}" ""
build "BSD-generic64" "arm64" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}" ""
build "BSD-generic32" "i386" "${IPHONESIMULATOR_GCC}" "${IPHONESIMULATOR_SDK}" ""
build "BSD-generic64" "x86_64" "${IPHONESIMULATOR_GCC}" "${IPHONESIMULATOR_SDK}" "-DOPENSSL_NO_ASM"

#

mkdir include
cp -r /tmp/openssl-${OPENSSL_VERSION}-i386/include/openssl include/

mkdir lib
lipo \
"/tmp/openssl-${OPENSSL_VERSION}-armv7/lib/libcrypto.a" \
"/tmp/openssl-${OPENSSL_VERSION}-armv7s/lib/libcrypto.a" \
"/tmp/openssl-${OPENSSL_VERSION}-arm64/lib/libcrypto.a" \
"/tmp/openssl-${OPENSSL_VERSION}-i386/lib/libcrypto.a" \
"/tmp/openssl-${OPENSSL_VERSION}-x86_64/lib/libcrypto.a" \
-create -output lib/libcrypto.a
lipo \
"/tmp/openssl-${OPENSSL_VERSION}-armv7/lib/libssl.a" \
"/tmp/openssl-${OPENSSL_VERSION}-armv7s/lib/libssl.a" \
"/tmp/openssl-${OPENSSL_VERSION}-arm64/lib/libssl.a" \
"/tmp/openssl-${OPENSSL_VERSION}-i386/lib/libssl.a" \
"/tmp/openssl-${OPENSSL_VERSION}-x86_64/lib/libssl.a" \
-create -output lib/libssl.a

rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*"
rm -rf "/tmp/openssl-${OPENSSL_VERSION}-*.*-log"

=========== END OF OPENSSL BUILD SCRIPT =========

Building libcurl

  1. Obtain the source if needed. Save "curl-7.36.0.zip" to a folder.
  2. Set up build.sh in the same folder as the tar file. Copy and paste the script text below to this build.sh file, or, use the downloaded version. The .sh file name does not have to be called "build."
  3. Build CURL. Run the build.sh script from command line from a terminal window on Mac, and it will include-32, include-64 and lib folder with appropriate contents.
  4. For the RMSDK build, to build book2png, copy include-32, include-64 and lib folders to thirdparty\curl\public\ios directory in the RMSDK source tree. You may have to modify the path and the file names for the newly built CURL libraries in your own reader app project.
  5. Continue with building RMSDK from this point on.
========== START OF CURL BUILD SCRIPT ==========
#!/bin/bash

# This script builds a static version of
# curl ${CURL_VERSION} for iOS 7.1 that contains code for
# arm64, armv7, arm7s, i386 and x86_64.

set -x

# Setup paths to stuff we need

CURL_VERSION="7.36.0"

DEVELOPER="/Applications/Xcode.app/Contents/Developer"

SDK_VERSION="8.1"
MIN_VERSION="8.1"

IPHONEOS_PLATFORM="${DEVELOPER}/Platforms/iPhoneOS.platform"
IPHONEOS_SDK="${IPHONEOS_PLATFORM}/Developer/SDKs/iPhoneOS${SDK_VERSION}.sdk"
IPHONEOS_GCC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"

IPHONESIMULATOR_PLATFORM="${DEVELOPER}/Platforms/iPhoneSimulator.platform"
IPHONESIMULATOR_SDK="${IPHONESIMULATOR_PLATFORM}/Developer/SDKs/iPhoneSimulator${SDK_VERSION}.sdk"
IPHONESIMULATOR_GCC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"

# Make sure things actually exist

if [ ! -d "$IPHONEOS_PLATFORM" ]; then
 echo "Cannot find $IPHONEOS_PLATFORM"
 exit 1
fi

if [ ! -d "$IPHONEOS_SDK" ]; then
 echo "Cannot find $IPHONEOS_SDK"
 exit 1
fi

if [ ! -x "$IPHONEOS_GCC" ]; then
 echo "Cannot find $IPHONEOS_GCC"
 exit 1
fi
if [ ! -d "$IPHONESIMULATOR_PLATFORM" ]; then
 echo "Cannot find $IPHONESIMULATOR_PLATFORM"
 exit 1
fi

if [ ! -d "$IPHONESIMULATOR_SDK" ]; then
 echo "Cannot find $IPHONESIMULATOR_SDK"
 exit 1
fi

if [ ! -x "$IPHONESIMULATOR_GCC" ]; then
 echo "Cannot find $IPHONESIMULATOR_GCC"
 exit 1
fi

# Clean up whatever was left from our previous build

rm -rf lib include-32 include-64
rm -rf /tmp/curl-${CURL_VERSION}-*
rm -rf /tmp/curl-${CURL_VERSION}-*.*-log

build()
{
  HOST=$1
  ARCH=$2
  GCC=$3
  SDK=$4
  MOREFLAGS=$5
 rm -rf "curl-${CURL_VERSION}"
 unzip "curl-${CURL_VERSION}.zip" -d "."
 pushd .
 cd "curl-${CURL_VERSION}"
 export IPHONEOS_DEPLOYMENT_TARGET=${MIN_VERSION}
 export CC=${GCC}
 export CFLAGS="-arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SDK}"
 export CPPFLAGS=${MOREFLAGS}
 export LDFLAGS="-arch ${ARCH} -isysroot ${SDK}"
 ./configure --disable-shared --enable-static --host=${HOST} --without-ssl --without-libssh2 --without-ca-bundle --without-ldap --disable-ldap --prefix="/tmp/curl-${CURL_VERSION}-${ARCH}" &> "/tmp/curl-${CURL_VERSION}-${ARCH}.log"
 make -j `sysctl -n hw.logicalcpu_max` &> "/tmp/curl-${CURL_VERSION}-${ARCH}.build-log"
 make install &> "/tmp/curl-${CURL_VERSION}-${ARCH}.install-log"
 popd
 rm -rf "curl-${CURL_VERSION}"
}

build "armv7-apple-darwin"  "armv7"  "${IPHONEOS_GCC}"        "${IPHONEOS_SDK}" ""
build "armv7s-apple-darwin" "armv7s" "${IPHONEOS_GCC}"        "${IPHONEOS_SDK}" ""
build "arm-apple-darwin"    "arm64"  "${IPHONEOS_GCC}"        "${IPHONEOS_SDK}" ""
build "i386-apple-darwin"   "i386"   "${IPHONESIMULATOR_GCC}" "${IPHONESIMULATOR_SDK}" "-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IPHONEOS_DEPLOYMENT_TARGET%%.*}0000"
build "x86_64-apple-darwin" "x86_64" "${IPHONESIMULATOR_GCC}" "${IPHONESIMULATOR_SDK}" "-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IPHONEOS_DEPLOYMENT_TARGET%%.*}0000"

#

mkdir -p lib include-32 include-64
cp -r /tmp/curl-${CURL_VERSION}-i386/include/curl include-32/
cp -r /tmp/curl-${CURL_VERSION}-x86_64/include/curl include-64/
lipo \
"/tmp/curl-${CURL_VERSION}-armv7/lib/libcurl.a" \
"/tmp/curl-${CURL_VERSION}-armv7s/lib/libcurl.a" \
"/tmp/curl-${CURL_VERSION}-arm64/lib/libcurl.a" \
"/tmp/curl-${CURL_VERSION}-i386/lib/libcurl.a" \
"/tmp/curl-${CURL_VERSION}-x86_64/lib/libcurl.a" \
-create -output lib/libcurl.a

rm -rf "/tmp/curl-${CURL_VERSION}-*"
rm -rf "/tmp/curl-${CURL_VERSION}-*.*-log"

========== END OF CURL BUILD SCRIPT =========

Reader Mobile SDK

  1. Reader Mobile Software Development Kit (SDK)
  2. Building RMSDK 9 or 10 with Android NDKr10
  3. Building OpenSSL and CURL for iOS 64-bit platform
  4. Certification
  5. Download file locations
  6. Languages supported by RMSDK
  7. Upgrading to the most recent version of libpng for RMSDK
  8. Activations
  9. Adobe ID and Vendor ID accounts
  10. Activating a device using book2png as a host
  11. Deactivating a device
  12. Guidelines for supporting multiple activations in RMSDK
  13. RMSDK and Digital Rights Management (DRM)
  14. Open Mobile Alliance (OMA)
  15. Processing an ePub file that is passhash protected
  16. Removing and re-installing an application
  17. Transferring eBook content
  18. Working with content restricted to a mobile device
  19. RMSDK Errors and Error Messages
  20. Activating devices using an Adobe ID, and potential problems
  21. Application times out when downloading large files
  22. Bus error when attempting to open eBook
  23. DL Reader fails. Error appears, "Class android.content.Context could not be found"
  24. E_ACT_NOT_READY error
  25. E_ACT_TOO_MANY_ACTIVATIONS error
  26. E_ADEPT_CORE_DECRYPT_LICENSE_KEY error
  27. E ADEPT_REQUEST_EXPIRED workflow SIGN_IN error
  28. Images are blank when opening a PDF document in Adobe Digital Editions
  29. No document generated for book2png fulfillment (Windows xp 32)
  30. RMSDK Build Error: LINK : fatal error LNK1181: cannot open input file 'libeay32.lib'
  31. Slow performance, iPAD sample application
  32. Undefined reference to __dso_handle
  33. RMSDK: Rendering
  34. Applying a User Style Sheet (userStyle.CSS) to edit fonts and properties in an ePub file
  35. Displaying multiple pages in columns
  36. Displaying screen numbers
  37. Dynamically changing styles using the RMSDK userStyle.css style sheet
  38. Flash support in RMSDK
  39. Highlights with RMSDK
  40. Image Objects, Highlighting and the Hit test
  41. Rendering a password protected PDF document
  42. Threads and rendering in RMSDK

Feedback and Knowledge Base