为arm64 iOS构建C库(GMP)

为arm64 iOS构建C库(GMP),ios,clang,gmp,arm64,Ios,Clang,Gmp,Arm64,我正在尝试为arm64构建一个C库(GMP 6.0.0),以便在iOS上使用。我正在使用下面的调用运行configure脚本(编译器是使用xcrun--find找到的) 但是,在以下线路(“长期可靠性测试1”)中,该测试失败: 完整的config.log可用。它显示了长可靠性测试编译的多个警告和错误,包括以下内容: conftest.c:9:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] f(){sta

我正在尝试为arm64构建一个C库(GMP 6.0.0),以便在iOS上使用。我正在使用下面的调用运行configure脚本(编译器是使用xcrun--find找到的)

但是,在以下线路(“长期可靠性测试1”)中,该测试失败:

完整的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();}}
                                                                                                   ^
编辑2

@Marglisse:通过强制clang忽略建议的错误(-Wno-…),arm64通过配置,但在生成时失败(完全输出):

作为旁注:,我假设是为了消除抑制错误的需要,但似乎不起作用,即,在消除抑制时,我得到了相同的错误

对于armv7,按建议使用修复了.section错误,但make稍后会失败,并出现以下错误(完整输出):

编辑3

使用建议的编辑,armv7、armv7s、i386和x86_64现在都使用汇编进行编译

对于arm64,编辑使其通过上一个错误,但现在给出了关于无效输入约束“rZ”的几个错误,所有这些错误都在同一个文件中(完整输出):

编辑4

在longlong.h中注释掉
add_ssaaaa
sub_ddmmss
并在gcd_1.asm中编辑更多的装配说明(
blo
b.lo
等)后,它现在失败,出现以下几个错误(完整输出):

稍后我将发布一个总差异

编辑5

好的,这使我们又向前迈进了一步,但现在它进入(完整输出):


如果这种情况持续下去,那么最好通过电子邮件继续进行。

版权问题除外

GMP可能与苹果的专有CPU不兼容,也可能与Clang/LLVM不兼容。作为一个GNU项目,它可能会在非专有芯片组上使用GCC进行更彻底的测试

快速搜索显示,从历史上看,至少有一些关于clang的问题

您真的应该向GMP社区发送电子邮件,并就此寻求帮助。

“对ARM64别名Aarch64别名ARMv8的支持”


@Patrick我怀疑GMP可能还没有ARM64支持?另外,请注意,GMP是根据LGPL许可证分发的,这与苹果的应用商店协议不兼容。因此,尽管您可以在iOS应用程序中出于教育目的使用它,或者使用企业发行版,但您不能在应用商店中发布该应用程序。这也解释了为什么可能还没有对ARM64的支持-目前唯一主要可用的ARM64分发平台与许可证不兼容。请尝试第二个错误。对于第一个,我会尝试CC='clang-Wno error-Wno implicit function declaration'或类似的方法来说服clang忽略这一点。acinclude.m4编辑只有在重新运行.bootstrap时才会生效(下载稍后的快照()可能更容易)<代码>--禁用程序集也会有所帮助,但会损失很多性能。如果您只是使用
受保护的\uuuuu gmp\u binvert\u limb\u table
删除该行,会发生什么情况?(在名为mode1o.asm的文件中删除它,mpn/arm/subtree中有2个)对于mul_1错误,尝试查找相关的mul_1.asm文件,并用b.cc替换bcc,用b.eq替换beq,直到它停止抱怨为止。
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
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();}}
                                                                                                   ^
tmp-dive_1.s:165:18: error: unexpected token in '.section' directive
 .section .rodata
                 ^
tmp-mul_1.s:59:2: error: unrecognized instruction mnemonic
 bcc Lfi1
 ^
tmp-mul_1.s:60:2: error: unrecognized instruction mnemonic
 beq Lfi2
 ^
tmp-mode1o.s:64:2: error: unknown directive
 .protected ___gmp_binvert_limb_table
 ^
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)
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
                     ^
tmp-invert_limb.s:52:2: error: ADR/ADRP relocations must be GOT relative
 adrp x1, approx_tab
 ^