构建库时make [1]错误1

时间:2017-03-28 14:58:16

标签: c++ makefile

我使用以下脚本来构建C ++库。对于i386架构,一切正常,但对于arm64,我收到一条错误消息。

错误:

make[1]: *** [base/low/cl_low_div.lo] Error 1
make: *** [install-recursive] Error 1

剧本:

#!/bin/bash

PLATFORMPATH="/Applications/Xcode.app/Contents/Developer/Platforms"
TOOLSPATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
export IPHONEOS_DEPLOYMENT_TARGET="10.1"
pwd=`pwd`

findLatestSDKVersion()
{
sdks=`ls $PLATFORMPATH/$1.platform/Developer/SDKs`
arr=()
for sdk in $sdks
do
   arr[${#arr[@]}]=$sdk
done

# Last item will be the current SDK, since it is alpha ordered
count=${#arr[@]}
if [ $count -gt 0 ]; then
   sdk=${arr[$count-1]:${#1}}
   num=`expr ${#sdk}-4`
   SDKVERSION=${sdk:0:$num}
else
   SDKVERSION="10.1"
fi
}

buildit()
{
target=$1
hosttarget=$1
platform=$2

if [[ $hosttarget == "x86_64" ]]; then
    hostarget="i386"
elif [[ $hosttarget == "arm64" ]]; then
    hosttarget="arm"
fi

export CC="$(xcrun -sdk iphoneos -find clang)"
export CPP="$CC -E"
export CFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
export AR=$(xcrun -sdk iphoneos -find ar)
export RANLIB=$(xcrun -sdk iphoneos -find ranlib)
export CPPFLAGS="-arch ${target}  -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
export LDFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk"

mkdir -p $pwd/output/$target

 ./configure --prefix="$pwd/output/$target" --disable-shared --disable-sqlite --host=$hosttarget-apple-darwin

make clean
make
make install
}

findLatestSDKVersion iPhoneOS

buildit arm64 iPhoneOS

lipo -create ./output/arm64/lib/libcln.a -output libcln.a

其中一个错误(都是相似的):

base/low/cl_low_div.cc:210:8: error: declaration of 'divu_64_rest' in global
  scope conflicts with declaration with C language linkage
  uint64 divu_64_rest;
         ^
./base/cl_low.h:982:21: note: declared with C language linkage here
  extern "C" uint64 divu_64_rest;                         // -> Rest r

我找不到有关它与构建库的架构之间的连接的信息。

提前致谢。

1 个答案:

答案 0 :(得分:0)

请在您的问题中发布错误,而不是在其他地方发布,尤其不是那些不允许纯文本复制/粘贴的地方。选择完整输出的相关部分并仅发布,而不是大量无用的内容。

您的问题是在头文件cl_low.h中声明了一个如下变量:

extern "C" uint64 divu_64_rest;

但在源文件cl_low_div.cc中,您将其定义为:

uint64 divu_64_rest;

那些不一样。在声明变量和定义变量时,必须同时具有extern "C"(或不)extensions.conf [test] exten => *300,1,NoOp(login/logout) ${DB(Queue/PersistentMembers/empfang)} ${REGEX("PJSIP/1001"),${DB(/Queue/PersistentMembers/empfang)}} same => n,GotoIf(${REGEX("PJSIP/1001",${DB(Queue/PersistentMembers/empfang)})}?*300-logout,1:*300-login,1) same => n,Hangup exten => *300-logout,1,NoOp(1001 exists, logout) same => n,RemoveQueueMember(empfang,PJSIP/1001) same => n,Playback(beep) same => n,Hangup() exten => *300-login,1,NoOp(1001 doesn't exists, login) same => n,AddQueueMember(empfang,PJSIP/1001) same => n,Playback(beep) same => n,Hangup() 。你所有的错误似乎都很相似。