Pat*_*pel 6 clang gmp ios arm64
我正在尝试为arm64构建一个用于iOS的C库(GMP 6.0.0).我正在使用下面的调用运行configure脚本(使用xcrun --find找到编译器).
./configure \
CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" \
CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E" \
CPPFLAGS="-target arm64-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -miphoneos-version-min=7.0" \
--host=aarch64-apple-darwin
Run Code Online (Sandbox Code Playgroud)
然而,这在以下行失败("长期可靠性测试1"):
checking compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -O2 -pedantic -target arm64-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -miphoneos-version-min=7.0... no, long long reliability test 1
configure: error: could not find a working compiler, see config.log for details
Run Code Online (Sandbox Code Playgroud)
完整的config.log 在这里可用.它显示了长期可靠性测试编译的多个警告和错误,包括以下内容:
conftest.c:9:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
^
conftest.c:10:44: error: implicit declaration of function 'h' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
conftest.c:10:48: error: implicit declaration of function 'g' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
conftest.c:10:100: warning: control reaches end of non-void function [-Wreturn-type]
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
^
Run Code Online (Sandbox Code Playgroud)
使用--host=none它工作正常,但我真的想弄清楚如何使用针对arm64优化的程序集来构建它.
我的系统是x86_64-apple-darwin13.1.0(或者根据config.guess的coreisbr-apple-darwin13.1.0),一个运行OS X v10.9.2的早期'11 Core i7 MBP.我正在使用Xcode 5.1(5B130a).
任何帮助赞赏.
编辑1
编译对ARMv7经过配置,但未能对化妆品(满配置/输出使这里),显然在编译一些组件:
tmp-dive_1.s:165:18: error: unexpected token in '.section' directive
.section .rodata
^
Run Code Online (Sandbox Code Playgroud)
编辑2
@MarcGlisse:通过强制clang忽略所建议的错误(-Wno -...)arm64传递configure,但是make make失败(这里完全输出):
tmp-mul_1.s:59:2: error: unrecognized instruction mnemonic
bcc Lfi1
^
tmp-mul_1.s:60:2: error: unrecognized instruction mnemonic
beq Lfi2
^
Run Code Online (Sandbox Code Playgroud)
作为旁注:这些提交,我假设打算删除抑制错误的需要,似乎没有工作,即我在删除抑制时得到相同的错误.
对于armv7,使用这些提交修复了.section错误,但稍后使用以下内容失败(此处为完整输出):
tmp-mode1o.s:64:2: error: unknown directive
.protected ___gmp_binvert_limb_table
^
Run Code Online (Sandbox Code Playgroud)
编辑3
使用建议的编辑,armv7,armv7s,i386和x86_64现在全部用程序集编译!
对于arm64,编辑使它超过上一个错误,但现在给出了一个关于无效输入约束'rZ'的几个错误,所有错误都在同一个文件中(这里是完整输出):
divrem_1.c:237:5: error: invalid input constraint 'rZ' in asm
udiv_qrnnd_preinv (*qp, r, r, nshift, d, dinv);
^
../gmp-impl.h:3062:2: note: expanded from macro 'udiv_qrnnd_preinv'
add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \
^
../longlong.h:551:7: note: expanded from macro 'add_ssaaaa'
: "rZ" (ah), "rZ" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
Run Code Online (Sandbox Code Playgroud)
编辑4
注释掉后add_ssaaaa,并sub_ddmmss在longlong.h和gcd_1.asm编辑一些汇编指令(blo对b.lo等),现在失败,以下几个误区(全光输出这里):
tmp-invert_limb.s:75:22: error: immediate value expected for shifter operand
add x1, x1, x2, lsr 1
^
tmp-invert_limb.s:75:22: error: invalid operand for instruction
add x1, x1, x2, lsr 1
^
Run Code Online (Sandbox Code Playgroud)
我稍后会发布一个完全差异.
编辑5
好吧,这会让我们又迈进了一步进一步,但现在碰到到(全光输出这里):
tmp-invert_limb.s:52:2: error: ADR/ADRP relocations must be GOT relative
adrp x1, approx_tab
^
Run Code Online (Sandbox Code Playgroud)
如果这种情况继续下去,最好通过电子邮件继续这样做.
Abh*_*ert -1
抛开版权问题...
GMP 可能与 Apple 专有的 CPU 不兼容,并且可能与 Clang/LLVM 不兼容。作为一个 GNU 项目,它可能在非专有芯片组上使用 GCC 进行了更彻底的测试。
快速搜索显示历史上至少存在使用 clang 编译 GMP 的问题。
您确实应该向 GMP 社区发送电子邮件并寻求有关此问题的帮助。