2012-03-01 17 views
5

iSOS用OpenSSL(armv6、armv7、i386)を実行スクリプトとして実行しようとしています。 XcodeのフェーズXcode内で 'スクリプト実行'フェーズとして実行すると、OpenSSLビルドスクリプトが失敗する(Xcode外で成功)

スクリプトは、コマンドラインからスタンドアロンスクリプトとして実行すると正常に構築されます。結果は、ヘッダ付きのlibcrypto.alibssl.aおよびincludeディレクトリにコンパイルされます。

しかし、Xcodeで実行スクリプトフェーズとしてスクリプトを実行すると、libcryptoから参照されているシンボルが見つからないことを示すmakeとエラーの最後に向かっています。

shlib_target=; if [ -n "" ]; then \ 
     shlib_target="bsd-gcc-shared"; \ 
    fi; \ 
    LIBRARIES="-L.. -lssl -L.. -lcrypto" ; \ 
    make -f ../Makefile.shared -e \ 
     APPNAME=openssl OBJECTS="openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o" \ 
     LIBDEPS=" $LIBRARIES " \ 
     link_app.${shlib_target} 
(:; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto }"; LDCMD="${LDCMD:-/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386}"; LDFLAGS="${LDFLAGS:--isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall}"; LIBPATH=`for x in $LIBDEPS; do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:=openssl} openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o ${LIBDEPS}) 

Undefined symbols for architecture i386: 
    "_ENGINE_load_gost", referenced from: 
     _ENGINE_load_builtin_engines in libcrypto.a(eng_all.o) 
ld: symbol(s) not found for architecture i386 
collect2: ld returned 1 exit status 
make[2]: *** [link_app.] Error 1 
make[1]: *** [openssl] Error 2 
make: *** [build_apps] Error 1 

私は、これはパスの問題であることはほぼ確実だけど、私はパスが使用するXcodeの(またはスクリプト)を伝える方法を見つけ出すことはできません。 Xcodeの4.3での開発ツールの場所(開発者/ルートで、実際Xcode.appの内側もはやであること、すなわち事実)への最近の変化を考慮するように変更する必要が

スクリプト、available here、 。

#!/bin/sh 

# Automatic build script for libssl and libcrypto 
# for iPhoneOS and iPhoneSimulator 
# 
# Created by Felix Schulze on 16.12.10. 
# Copyright 2010 Felix Schulze. All rights reserved. 
# 
# Licensed under the Apache License, Version 2.0 (the "License"); 
# you may not use this file except in compliance with the License. 
# You may obtain a copy of the License at 
# 
# http://www.apache.org/licenses/LICENSE-2.0 
# 
# Unless required by applicable law or agreed to in writing, software 
# distributed under the License is distributed on an "AS IS" BASIS, 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
# See the License for the specific language governing permissions and 
# limitations under the License. 
# 
########################################################################### 
# Change values here              # 
#                   # 
VERSION="1.0.0c"               # 
SDKVERSION="5.0"               # 
#                   # 
########################################################################### 
#                   # 
# Don't change anything under this line!         # 
#                   # 
########################################################################### 



CURRENTPATH=`pwd` 
CURRENTPATH="${CURRENTPATH}/openssl" 

set -e 
if [ ! -e openssl-${VERSION}.tar.gz ]; then 
echo "Downloading openssl-${VERSION}.tar.gz" 
curl -O http://www.openssl.org/source/openssl-${VERSION}.tar.gz 
else 
echo "Using openssl-${VERSION}.tar.gz" 
fi 

mkdir -p "${CURRENTPATH}/src" 
tar zxf openssl-${VERSION}.tar.gz -C "${CURRENTPATH}/src" 
rm openssl-${VERSION}.tar.gz 
cd "${CURRENTPATH}/src/openssl-${VERSION}" 


############ 
# iPhone Simulator 
echo "Building openssl for iPhoneSimulator ${SDKVERSION} i386" 
echo "Please stand by..." 

export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386" 
mkdir -p "${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk" 

LOG="${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/build-openssl-${VERSION}.log" 

./configure BSD-generic32 --openssldir="${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk" > "${LOG}" 2>&1 
# add -isysroot to CC= 
sed -ie "s!^CFLAG=!CFLAG=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVERSION}.sdk !" "Makefile" 

make >> "${LOG}" 2>&1 
make install >> "${LOG}" 2>&1 
make clean >> "${LOG}" 2>&1 
############# 

############# 
# iPhoneOS armv6 
echo "Building openssl for iPhoneOS ${SDKVERSION} armv6" 
echo "Please stand by..." 

export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6" 
mkdir -p "${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk" 

LOG="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk/build-openssl-${VERSION}.log" 

./configure BSD-generic32 --openssldir="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk" > "${LOG}" 2>&1 

sed -ie "s!^CFLAG=!CFLAG=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdk !" "Makefile" 
# remove sig_atomic for iPhoneOS 
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" 

make >> "${LOG}" 2>&1 
make install >> "${LOG}" 2>&1 
make clean >> "${LOG}" 2>&1 
############# 

############# 
# iPhoneOS armv7 
echo "Building openssl for iPhoneOS ${SDKVERSION} armv7" 
echo "Please stand by..." 

export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7" 
mkdir -p "${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk" 

LOG="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/build-openssl-${VERSION}.log" 


./configure BSD-generic32 --openssldir="${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk" >> "${LOG}" 2>&1 

sed -ie "s!^CFLAG=!CFLAG=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdk !" "Makefile" 
# remove sig_atomic for iPhoneOS 
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" 

make >> "${LOG}" 2>&1 
make install >> "${LOG}" 2>&1 
make clean >> "${LOG}" 2>&1 
############# 

echo "Build library..." 
lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk/lib/libssl.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libssl.a -output ${CURRENTPATH}/libssl.a 

lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv6.sdk/lib/libcrypto.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libcrypto.a -output ${CURRENTPATH}/libcrypto.a 

mkdir -p ${CURRENTPATH}/include 
cp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}.sdk/include/openssl ${CURRENTPATH}/include/ 
echo "Building done." 

答えて

1

それはopenssl上の問題として記録されています:

は、ここで質問完全性についてスクリプトです。

あなたのconfigure行を調整します。

./Configure darwin64-x86_64-cc zlib no-asm no-krb5 shared 
+2

64ビットMac OS X用にビルドする場合にはうまくいくかもしれませんが、iOS用にビルドしようとしています(したがって、armv6、armv7、i386が必要です)。 'darwin-x86_64'ではなく' BSD-generic32'を指定する必要があり、iOSでは共有ライブラリも許可されません。私は私のBSDと共有オプションなしで設定しようとしましたが、私は元の質問で述べたのと同じエラーを受け取ります。 – Jasarien

1

これは古い記事ですが、私は問題はまだ存続と思います。しかし、私は非常に簡単な解決策を見つけたと思う。ただ、「設定」の前に、ビルド・スクリプトに次の行を追加したり、「作る」と呼ばれている:

export COMMAND_MODE=unix2003 

これはトリックを行う必要があります。

関連する問題