如何在 ipad mini 3 上为 iOS8.x 交叉编译 clang/llvm 3.7.0?
How to cross-compile clang/llvm 3.7.0 for iOS8.x on ipad mini 3?
编辑,2015 年 10 月 24 日。 这终于奏效了:
../configure --prefix=/usr/local/lvm-cross/llvm-ios --with-default-sysroot=/usr/local/iPhoneOS8.4.sdk --host=arm-apple-darwin11 --enable-optimized --disable-assertions --disable-libedit
和
clang -isysroot /usr/local/iPhoneOS8.4.sdk/ -target arm64-apple-darwin11 testcpp.cpp -o testcpp
其中 testcpp.cpp
包含:
int main()
{
return 0;
}
现在如果我简单修改源代码如下:
#include <iostream> // I am not even calling << operator in code, just including
int main()
{
return 0;
}
出现以下问题:
Undefined symbols for architecture arm64:
"std::ios_base::Init::Init()", referenced from:
___cxx_global_var_init in testcpp-0b9c00.o
"std::ios_base::Init::~Init()", referenced from:
___cxx_global_var_init in testcpp-0b9c00.o
ld: symbol(s) not found for architecture arm64
Verbos与 -v
的关系给出了这个:
XXXXs-iPad:~/Documents/CODING/MY/TESTS/CPP mobile$ clang -v -isysroot /usr/local/iPhoneOS8.4.sdk -target arm64-apple-darwin11 testcpp.cpp -o testcpp
clang version 3.7.0 (tags/RELEASE_370/final)
Target: arm64-apple-darwin11
Thread model: posix
"/usr/local/llvm-ios/bin/clang" -cc1 -triple arm64-apple-ios5.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name testcpp.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -target-cpu generic -target-feature +neon -target-abi darwinpcs -target-linker-version 253.3.3 -v -dwarf-column-info -resource-dir /usr/local/llvm-ios/bin/../lib/clang/3.7.0 -isysroot /usr/local/iPhoneOS8.4.sdk -fdeprecated-macro -fdebug-compilation-dir /var/mobile/Documents/CODING/MY/TESTS/CPP -ferror-limit 19 -fmessage-length 132 -stack-protector 1 -mstackrealign -fallow-half-arguments-and-returns -fblocks -fobjc-runtime=ios-5.0.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/tmp/testcpp-b164d6.o -x c++ testcpp.cpp
clang -cc1 version 3.7.0 based upon LLVM 3.7.0 default target arm-apple-darwin14.0.0
ignoring nonexistent directory "/usr/local/iPhoneOS8.4.sdk/usr/include/c++/4.2.1/arm64-apple-darwin10/"
ignoring nonexistent directory "/usr/local/iPhoneOS8.4.sdk/usr/local/include"
ignoring nonexistent directory "/usr/local/iPhoneOS8.4.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/iPhoneOS8.4.sdk/usr/include/c++/4.2.1
/usr/local/iPhoneOS8.4.sdk/usr/include/c++/4.2.1/backward
/usr/local/llvm-ios/bin/../lib/clang/3.7.0/include
/usr/local/iPhoneOS8.4.sdk/usr/include
/usr/local/iPhoneOS8.4.sdk/System/Library/Frameworks (framework directory)
End of search list.
"/usr/bin/ld" -demangle -dynamic -arch arm64 -iphoneos_version_min 5.0.0 -syslibroot /usr/local/iPhoneOS8.4.sdk -o testcpp /var/tmp/testcpp-b164d6.o -lSystem
Undefined symbols for architecture arm64:
"std::ios_base::Init::Init()", referenced from:
___cxx_global_var_init in testcpp-b164d6.o
"std::ios_base::Init::~Init()", referenced from:
___cxx_global_var_init in testcpp-b164d6.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
编辑,2015-10-21。 这次我配置了:
../configure --prefix=/usr/local/lvm-cross/llvm-ios --target=arm-apple-darwin11 --host=arm-apple-darwin11 --with-default-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk --enable-optimized --disable-assertions --disable-libedit
再次尝试使用 clang++ -v testcpp.cpp -o testcpp
编译会抛出以下错误:
"ld" -demangle -dynamic -arch armv4t -macosx_version_min 10.10.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -o testcpp /var/tmp/testcpp-bb42e7.o -lc++ -lSystem
arm-apple-darwin11-clang++: error: unable to execute command: Executable "ld" doesn't exist!
arm-apple-darwin11-clang++: error: linker command failed with exit code 1 (use -v to see invocation)
我还有这个-macosx_version_min 10.10.0
东西:坏月亮升起;令人担忧。通过 Cydia 安装 org.coolstar.cctools
和 org.coolstar.ld64
并重新编译得到:
"/usr/bin/ld" -demangle -dynamic -arch armv4t -macosx_version_min 10.10.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -o testcpp /var/tmp/testcpp-5ae1b0.o -lc++ -lSystem
ld: library not found for -lc++
arm-apple-darwin11-clang++: error: linker command failed with exit code 1 (use -v to see invocation)
仍然是ld: library not found for -lc++
错误。请注意,将 -isysroot=/path/to/the/iphonesdk/that/i/copied/from/my/mac/to/my/idevice
添加到编译中并没有改变我上面所说的任何内容。
编辑,2015-10-18,IV. 通过 cydia 从 BigBoss 源安装包 "Darwin CC Tools" 提供 ld
命令行可执行文件。再次尝试使用 clang++ -v testcpp.cpp -o testcpp
进行编译会抛出以下错误:
"/usr/bin/ld" -demangle -dynamic -arch armv4t -macosx_version_min 10.10.0 -o testcpp /var/tmp/testcpp-ddd8d4.o -lc++ -lSystem
ld: library not found for -lc++
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
我猜这意味着ld
找不到c++
标准库文件所在的位置。如何处理?
EDIT, 2015-10-18, III. Retros我认为configure
步骤一定有问题。在 iPad 上,当我尝试使用 clang++ -v testcpp.cpp -o testcpp
进行编译时,它会产生一个自然错误,指出缺少 ld
,但它显示了一些奇怪的东西:"ld" -demangle -dynamic -arch armv4t -macosx_version_min 10.10.0 -o testcpp /var/tmp/testcpp-a74741.o -lc++ -lSystem
这是什么 -macosx_version_min 10.10.0
在这里做什么?就好像编译器正在寻找平台的 (mac os) 链接器,它是 cross-build 而不是 iOS 一个......
编辑,2015-10-18,II. 实际上我将整个 iOS8.4 sdk 复制到 iPad,我会 -isysroot
在编译期间添加到它。我试着编译最简单的c++代码
int main()
{
return 0;
}
in testcpp.cpp
with clang++ -v testcpp.cpp -o testcpp
这导致了自然链接错误(因为我还没有链接器!):
clang++: error: unable to execute command: Executable "ld" doesn't exist!
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
因为我不知道选择哪种策略,所以我创建了一个问题:
编辑,2015 年 10 月 18 日,I. 在配置步骤中传递 --disable-libedit
让我避免了 'histedit.h' file not found
错误。然后在 ProgramTest.cpp
中又出现了一个 crt_externs.h file not found
错误,我通过评论 #include
摆脱了它,这导致了这个错误
/Users/XXXX/Documents/CODING/src-cross/clang/llvm-3.7.0.src/unittests/Support/ProgramTest.cpp:62:18: error:
use of undeclared identifier '_NSGetEnviron'
char **envp = *_NSGetEnviron();
^
我通过简单地放置 char **envp = NULL;
(激烈)来修复。 make
就像一个符咒一样消失了,sudo make install
也很明显。然后我 scp
将整个目录编辑到我的 iPad,并尝试 /usr/local/llvm-ios/bin/clang
结果告诉我... clang: error: no input files
。成功。 ;-) 现在,由于裸安装,我需要找到所有标准库(iostream 等)...
编辑,2015 年 10 月 17 日。 在 Thomas 建议后我尝试了这个(只是使用 8.4 而不是 8.3 sdk 作为我的越狱 ipad mini 3 wifi 是在 iOS 8.4) 下:
curl -O http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
tar -Jxf llvm-3.7.0.src.tar.xz
cd llvm-3.7.0.src/tools/
curl -O http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz
tar -Jxf cfe-3.7.0.src.tar.xz
mv cfe-3.7.0.src clang
cd ..
export CC="clang -arch arm64 -mios-version-min=8.4 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk"
export CXX="clang++ -arch arm64 -mios-version-min=8.4 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk"
mkdir build && cd build
避免以下错误:
/Users/XXX/Documents/CODING/src-cross/clang/llvm-3.7.0.src/utils/unittest/googletest/src/gtest-death-test.cc:40:12: fatal error: 'crt_externs.h' file not found
# include <crt_externs.h>
^
Thomas 在 post How to cross-compile clang/llvm for iOS? 中警告我们,我去了 /Users/XXX/Documents/CODING/src-cross/clang/llvm-3.7.0.src/utils/unittest/googletest/src/gtest-death-test.cc
并评论了 #include <crt_externs.h>
。然后在
中找到了char** GetEnviron()
函数
# if GTEST_OS_MAC
inline char** GetEnviron() {
// When Google Test is built as a framework on MacOS X, the environ variable
// is unavailable. Apple's documentation (man environ) recommends using
// _NSGetEnviron() instead.
return *_NSGetEnviron();
}
并将原来的return *_NSGetEnviron();
替换为return NULL;
。然后我继续 configure
、unset
和 make VERBOSE=1 -j
:
../configure --prefix=/usr/local/XXX-cross/llvm-ios --host=arm-apple-darwin11 --enable-optimized --disable-assertions
unset CC CXX
make VERBOSE=1 -j
后者触发了以下错误:
/Users/XXXX/Documents/CODING/src-cross/clang/llvm-3.7.0.src/lib/LineEditor/LineEditor.cpp:17:10: fatal error: 'histedit.h' file not found
#include <histedit.h>
^
我不知道如何解决...
初始问题。 我正在尝试为 ipad 上的 iOS8.x cross-compile clang/llvm 3.7.0 ] mini 3,借助以下:
How to cross-compile clang/llvm for iOS?
我已经试过了:
curl -O http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
tar -Jxf llvm-3.7.0.src.tar.xz
cd llvm-3.7.0.src/tools/
curl -O http://llvm.org/releases/3.7/clang-3.7.src.tar.gz
tar -Jxf cfe-3.7.0.src.tar.xz
mv cfe-3.7.0.src clang
cd ..
export CC="clang -arch armv8a -mios-version-min=8.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk"
export CXX="clang++ -arch armv8a -mios-version-min=8.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk"
mkdir build && cd build
../configure --prefix=/usr/local/XXX-cross/llvm-ios --host=armv8a-apple-darwin-eabi --enable-optimized --disable-assertions
没有成功,
error: invalid arch name '-arch armv8a'
我尝试过与我的 iPad mini 3 相关的所有 arch
和 host
都遇到了这种错误,为此我发现了 infos here and there.
当我尝试为我的 iPad mini 3 构建 gcc 时,我遇到了同样的问题,我的印象是,目前,无论我尝试 "cross-build" 的编译器是什么此目标,不支持正确的 host
和 arch
选项。
我错了?我有一种方法可以传递处理 generic/unknown arch
和 host
的其他选项,如果有合适的其他选项,可以在我的 [=171= 上提供可行的 llvm-clang ] 迷你 3 ?
是-arch arm64
不是-arch armv8a
,把--host=armv8a-apple-darwin-eabi
改成--host=arm-apple-darwin11
。
此外,-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk
仅在您使用 Mac 交叉编译 iOS 时才有意义。
编辑,2015 年 10 月 24 日。 这终于奏效了:
../configure --prefix=/usr/local/lvm-cross/llvm-ios --with-default-sysroot=/usr/local/iPhoneOS8.4.sdk --host=arm-apple-darwin11 --enable-optimized --disable-assertions --disable-libedit
和
clang -isysroot /usr/local/iPhoneOS8.4.sdk/ -target arm64-apple-darwin11 testcpp.cpp -o testcpp
其中 testcpp.cpp
包含:
int main()
{
return 0;
}
现在如果我简单修改源代码如下:
#include <iostream> // I am not even calling << operator in code, just including
int main()
{
return 0;
}
出现以下问题:
Undefined symbols for architecture arm64:
"std::ios_base::Init::Init()", referenced from:
___cxx_global_var_init in testcpp-0b9c00.o
"std::ios_base::Init::~Init()", referenced from:
___cxx_global_var_init in testcpp-0b9c00.o
ld: symbol(s) not found for architecture arm64
Verbos与 -v
的关系给出了这个:
XXXXs-iPad:~/Documents/CODING/MY/TESTS/CPP mobile$ clang -v -isysroot /usr/local/iPhoneOS8.4.sdk -target arm64-apple-darwin11 testcpp.cpp -o testcpp
clang version 3.7.0 (tags/RELEASE_370/final)
Target: arm64-apple-darwin11
Thread model: posix
"/usr/local/llvm-ios/bin/clang" -cc1 -triple arm64-apple-ios5.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name testcpp.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -target-cpu generic -target-feature +neon -target-abi darwinpcs -target-linker-version 253.3.3 -v -dwarf-column-info -resource-dir /usr/local/llvm-ios/bin/../lib/clang/3.7.0 -isysroot /usr/local/iPhoneOS8.4.sdk -fdeprecated-macro -fdebug-compilation-dir /var/mobile/Documents/CODING/MY/TESTS/CPP -ferror-limit 19 -fmessage-length 132 -stack-protector 1 -mstackrealign -fallow-half-arguments-and-returns -fblocks -fobjc-runtime=ios-5.0.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/tmp/testcpp-b164d6.o -x c++ testcpp.cpp
clang -cc1 version 3.7.0 based upon LLVM 3.7.0 default target arm-apple-darwin14.0.0
ignoring nonexistent directory "/usr/local/iPhoneOS8.4.sdk/usr/include/c++/4.2.1/arm64-apple-darwin10/"
ignoring nonexistent directory "/usr/local/iPhoneOS8.4.sdk/usr/local/include"
ignoring nonexistent directory "/usr/local/iPhoneOS8.4.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/iPhoneOS8.4.sdk/usr/include/c++/4.2.1
/usr/local/iPhoneOS8.4.sdk/usr/include/c++/4.2.1/backward
/usr/local/llvm-ios/bin/../lib/clang/3.7.0/include
/usr/local/iPhoneOS8.4.sdk/usr/include
/usr/local/iPhoneOS8.4.sdk/System/Library/Frameworks (framework directory)
End of search list.
"/usr/bin/ld" -demangle -dynamic -arch arm64 -iphoneos_version_min 5.0.0 -syslibroot /usr/local/iPhoneOS8.4.sdk -o testcpp /var/tmp/testcpp-b164d6.o -lSystem
Undefined symbols for architecture arm64:
"std::ios_base::Init::Init()", referenced from:
___cxx_global_var_init in testcpp-b164d6.o
"std::ios_base::Init::~Init()", referenced from:
___cxx_global_var_init in testcpp-b164d6.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
编辑,2015-10-21。 这次我配置了:
../configure --prefix=/usr/local/lvm-cross/llvm-ios --target=arm-apple-darwin11 --host=arm-apple-darwin11 --with-default-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk --enable-optimized --disable-assertions --disable-libedit
再次尝试使用 clang++ -v testcpp.cpp -o testcpp
编译会抛出以下错误:
"ld" -demangle -dynamic -arch armv4t -macosx_version_min 10.10.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -o testcpp /var/tmp/testcpp-bb42e7.o -lc++ -lSystem
arm-apple-darwin11-clang++: error: unable to execute command: Executable "ld" doesn't exist!
arm-apple-darwin11-clang++: error: linker command failed with exit code 1 (use -v to see invocation)
我还有这个-macosx_version_min 10.10.0
东西:坏月亮升起;令人担忧。通过 Cydia 安装 org.coolstar.cctools
和 org.coolstar.ld64
并重新编译得到:
"/usr/bin/ld" -demangle -dynamic -arch armv4t -macosx_version_min 10.10.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -o testcpp /var/tmp/testcpp-5ae1b0.o -lc++ -lSystem
ld: library not found for -lc++
arm-apple-darwin11-clang++: error: linker command failed with exit code 1 (use -v to see invocation)
仍然是ld: library not found for -lc++
错误。请注意,将 -isysroot=/path/to/the/iphonesdk/that/i/copied/from/my/mac/to/my/idevice
添加到编译中并没有改变我上面所说的任何内容。
编辑,2015-10-18,IV. 通过 cydia 从 BigBoss 源安装包 "Darwin CC Tools" 提供 ld
命令行可执行文件。再次尝试使用 clang++ -v testcpp.cpp -o testcpp
进行编译会抛出以下错误:
"/usr/bin/ld" -demangle -dynamic -arch armv4t -macosx_version_min 10.10.0 -o testcpp /var/tmp/testcpp-ddd8d4.o -lc++ -lSystem
ld: library not found for -lc++
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
我猜这意味着ld
找不到c++
标准库文件所在的位置。如何处理?
EDIT, 2015-10-18, III. Retros我认为configure
步骤一定有问题。在 iPad 上,当我尝试使用 clang++ -v testcpp.cpp -o testcpp
进行编译时,它会产生一个自然错误,指出缺少 ld
,但它显示了一些奇怪的东西:"ld" -demangle -dynamic -arch armv4t -macosx_version_min 10.10.0 -o testcpp /var/tmp/testcpp-a74741.o -lc++ -lSystem
这是什么 -macosx_version_min 10.10.0
在这里做什么?就好像编译器正在寻找平台的 (mac os) 链接器,它是 cross-build 而不是 iOS 一个......
编辑,2015-10-18,II. 实际上我将整个 iOS8.4 sdk 复制到 iPad,我会 -isysroot
在编译期间添加到它。我试着编译最简单的c++代码
int main()
{
return 0;
}
in testcpp.cpp
with clang++ -v testcpp.cpp -o testcpp
这导致了自然链接错误(因为我还没有链接器!):
clang++: error: unable to execute command: Executable "ld" doesn't exist!
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
因为我不知道选择哪种策略,所以我创建了一个问题:
编辑,2015 年 10 月 18 日,I. 在配置步骤中传递 --disable-libedit
让我避免了 'histedit.h' file not found
错误。然后在 ProgramTest.cpp
中又出现了一个 crt_externs.h file not found
错误,我通过评论 #include
摆脱了它,这导致了这个错误
/Users/XXXX/Documents/CODING/src-cross/clang/llvm-3.7.0.src/unittests/Support/ProgramTest.cpp:62:18: error:
use of undeclared identifier '_NSGetEnviron'
char **envp = *_NSGetEnviron();
^
我通过简单地放置 char **envp = NULL;
(激烈)来修复。 make
就像一个符咒一样消失了,sudo make install
也很明显。然后我 scp
将整个目录编辑到我的 iPad,并尝试 /usr/local/llvm-ios/bin/clang
结果告诉我... clang: error: no input files
。成功。 ;-) 现在,由于裸安装,我需要找到所有标准库(iostream 等)...
编辑,2015 年 10 月 17 日。 在 Thomas 建议后我尝试了这个(只是使用 8.4 而不是 8.3 sdk 作为我的越狱 ipad mini 3 wifi 是在 iOS 8.4) 下:
curl -O http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
tar -Jxf llvm-3.7.0.src.tar.xz
cd llvm-3.7.0.src/tools/
curl -O http://llvm.org/releases/3.7.0/cfe-3.7.0.src.tar.xz
tar -Jxf cfe-3.7.0.src.tar.xz
mv cfe-3.7.0.src clang
cd ..
export CC="clang -arch arm64 -mios-version-min=8.4 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk"
export CXX="clang++ -arch arm64 -mios-version-min=8.4 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk"
mkdir build && cd build
避免以下错误:
/Users/XXX/Documents/CODING/src-cross/clang/llvm-3.7.0.src/utils/unittest/googletest/src/gtest-death-test.cc:40:12: fatal error: 'crt_externs.h' file not found
# include <crt_externs.h>
^
Thomas 在 post How to cross-compile clang/llvm for iOS? 中警告我们,我去了 /Users/XXX/Documents/CODING/src-cross/clang/llvm-3.7.0.src/utils/unittest/googletest/src/gtest-death-test.cc
并评论了 #include <crt_externs.h>
。然后在
char** GetEnviron()
函数
# if GTEST_OS_MAC
inline char** GetEnviron() {
// When Google Test is built as a framework on MacOS X, the environ variable
// is unavailable. Apple's documentation (man environ) recommends using
// _NSGetEnviron() instead.
return *_NSGetEnviron();
}
并将原来的return *_NSGetEnviron();
替换为return NULL;
。然后我继续 configure
、unset
和 make VERBOSE=1 -j
:
../configure --prefix=/usr/local/XXX-cross/llvm-ios --host=arm-apple-darwin11 --enable-optimized --disable-assertions
unset CC CXX
make VERBOSE=1 -j
后者触发了以下错误:
/Users/XXXX/Documents/CODING/src-cross/clang/llvm-3.7.0.src/lib/LineEditor/LineEditor.cpp:17:10: fatal error: 'histedit.h' file not found
#include <histedit.h>
^
我不知道如何解决...
初始问题。 我正在尝试为 ipad 上的 iOS8.x cross-compile clang/llvm 3.7.0 ] mini 3,借助以下:
How to cross-compile clang/llvm for iOS?
我已经试过了:
curl -O http://llvm.org/releases/3.7.0/llvm-3.7.0.src.tar.xz
tar -Jxf llvm-3.7.0.src.tar.xz
cd llvm-3.7.0.src/tools/
curl -O http://llvm.org/releases/3.7/clang-3.7.src.tar.gz
tar -Jxf cfe-3.7.0.src.tar.xz
mv cfe-3.7.0.src clang
cd ..
export CC="clang -arch armv8a -mios-version-min=8.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk"
export CXX="clang++ -arch armv8a -mios-version-min=8.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk"
mkdir build && cd build
../configure --prefix=/usr/local/XXX-cross/llvm-ios --host=armv8a-apple-darwin-eabi --enable-optimized --disable-assertions
没有成功,
error: invalid arch name '-arch armv8a'
我尝试过与我的 iPad mini 3 相关的所有 arch
和 host
都遇到了这种错误,为此我发现了 infos here and there.
当我尝试为我的 iPad mini 3 构建 gcc 时,我遇到了同样的问题,我的印象是,目前,无论我尝试 "cross-build" 的编译器是什么此目标,不支持正确的 host
和 arch
选项。
我错了?我有一种方法可以传递处理 generic/unknown arch
和 host
的其他选项,如果有合适的其他选项,可以在我的 [=171= 上提供可行的 llvm-clang ] 迷你 3 ?
是-arch arm64
不是-arch armv8a
,把--host=armv8a-apple-darwin-eabi
改成--host=arm-apple-darwin11
。
此外,-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk
仅在您使用 Mac 交叉编译 iOS 时才有意义。