ios - 交叉构建 binutils 2.25.1 for iOS8.4 (arm64-apple-darwin14.0.0)

标签 ios cross-compiling arm64 binutils

编辑。 2015-30-10. 我试过这个:

../configure --prefix=/usr/local/GNU-CROSS/binutils-2.25.1/ CC="clang -fembed-bitcode -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -Wno-error -Wno-implicit-function-declaration -mios-version-min=8.4 -no-integrated-as -arch arm64 -target arm64-apple-darwin" CPP="clang -E" CPPFLAGS="-fembed-bitcode -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -Wno-error -Wno-implicit-function-declaration -mios-version-min=8.4 -no-integrated-as -arch arm64 -target arm64-apple-darwin" --host=aarch64-apple-darwin --disable-assembly --enable-static --disable-shared
make -j 4

配置正常,但是 make 触发了这个:

BFD does not support target aarch64-apple-darwin

初始问题。

我正在尝试为 iOS (8.4) 64 位目标交叉构建 binutils 2.25.1。我将 binutils-2.25.1 文件夹放在目标和 config.guess 脚本上,它给了我 arm64-apple-darwin14.0.0。在我的主机 (x86_64-apple-darwin14.4.0) 上,我在 binutils-2.25.1 中创建了一个构建文件夹并在那里运行:

CCFLAGS="--arch arm64" LDFLAGS="--arch arm64" ../configure --prefix=/usr/local/lvm-cross/ --host=arm-apple-darwin

这给了我这个:

configure: error: in `/Users/XXXX/Documents/src/gcc-5.2.0-cross/binutils-2.25.1/build':
configure: error: C compiler cannot create executables

所有详细信息都在末尾的 config.log 文件中。

我的问题如下:如何为这个 64 位目标构建 binutils?

config.log 文件包含以下内容:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.64.  Invocation command line was

  $ ../configure --prefix=/usr/local/lvm-cross/ --host=arm-apple-darwin

## --------- ##
## Platform. ##
## --------- ##

hostname = XXXXs-MacBook-Air.local
uname -m = x86_64
uname -r = 14.4.0
uname -s = Darwin
uname -v = Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
     Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3
Primary memory available: 4.00 gigabytes
Default processor set: 239 tasks, 978 threads, 4 processors
Load average: 1.62, Mach factor: 2.37
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /sw/bin
PATH: /sw/sbin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /opt/X11/bin
PATH: /usr/local/git/bin
PATH: /Library/TeX/texbin
PATH: /Users/XXXX/.opam/4.02.2/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2322: checking build system type
configure:2336: result: x86_64-apple-darwin14.4.0
configure:2383: checking host system type
configure:2396: result: arm-apple-darwin
configure:2416: checking target system type
configure:2429: result: arm-apple-darwin
configure:2483: checking for a BSD-compatible install
configure:2551: result: /usr/bin/install -c
configure:2562: checking whether ln works
configure:2584: result: yes
configure:2588: checking whether ln -s works
configure:2592: result: yes
configure:2599: checking for a sed that does not truncate output
configure:2663: result: /usr/bin/sed
configure:2672: checking for gawk
configure:2702: result: no
configure:2672: checking for mawk
configure:2702: result: no
configure:2672: checking for nawk
configure:2702: result: no
configure:2672: checking for awk
configure:2688: found /usr/bin/awk
configure:2699: result: awk
configure:3941: checking for arm-apple-darwin-gcc
configure:3971: result: no
configure:3981: checking for gcc
configure:3997: found /usr/bin/gcc
configure:4008: result: gcc
configure:4237: checking for C compiler version
configure:4246: gcc --version >&5
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
configure:4257: $? = 0
configure:4246: gcc -v >&5
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
configure:4257: $? = 0
configure:4246: gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:4257: $? = 1
configure:4246: gcc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:4257: $? = 1
configure:4277: checking for C compiler default output file name
configure:4299: gcc   --arch arm64 conftest.c  >&5
clang: error: unsupported option '--arch'
clang: error: no such file or directory: 'arm64'
configure:4303: $? = 1
configure:4340: result: 
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:4346: error: in `/Users/XXXX/Documents/src/gcc-5.2.0-cross/binutils-2.25.1/build':
configure:4350: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-apple-darwin14.4.0
ac_cv_env_AR_FOR_TARGET_set=
ac_cv_env_AR_FOR_TARGET_value=
ac_cv_env_AR_set=
ac_cv_env_AR_value=
ac_cv_env_AS_FOR_TARGET_set=
ac_cv_env_AS_FOR_TARGET_value=
ac_cv_env_AS_set=
ac_cv_env_AS_value=
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_FOR_TARGET_set=
ac_cv_env_CC_FOR_TARGET_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_FOR_TARGET_set=
ac_cv_env_CXX_FOR_TARGET_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_DLLTOOL_FOR_TARGET_set=
ac_cv_env_DLLTOOL_FOR_TARGET_value=
ac_cv_env_DLLTOOL_set=
ac_cv_env_DLLTOOL_value=
ac_cv_env_GCC_FOR_TARGET_set=
ac_cv_env_GCC_FOR_TARGET_value=
ac_cv_env_GCJ_FOR_TARGET_set=
ac_cv_env_GCJ_FOR_TARGET_value=
ac_cv_env_GFORTRAN_FOR_TARGET_set=
ac_cv_env_GFORTRAN_FOR_TARGET_value=
ac_cv_env_GOC_FOR_TARGET_set=
ac_cv_env_GOC_FOR_TARGET_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='--arch arm64'
ac_cv_env_LD_FOR_TARGET_set=
ac_cv_env_LD_FOR_TARGET_value=
ac_cv_env_LD_set=
ac_cv_env_LD_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LIPO_FOR_TARGET_set=
ac_cv_env_LIPO_FOR_TARGET_value=
ac_cv_env_LIPO_set=
ac_cv_env_LIPO_value=
ac_cv_env_NM_FOR_TARGET_set=
ac_cv_env_NM_FOR_TARGET_value=
ac_cv_env_NM_set=
ac_cv_env_NM_value=
ac_cv_env_OBJCOPY_set=
ac_cv_env_OBJCOPY_value=
ac_cv_env_OBJDUMP_FOR_TARGET_set=
ac_cv_env_OBJDUMP_FOR_TARGET_value=
ac_cv_env_OBJDUMP_set=
ac_cv_env_OBJDUMP_value=
ac_cv_env_RANLIB_FOR_TARGET_set=
ac_cv_env_RANLIB_FOR_TARGET_value=
ac_cv_env_RANLIB_set=
ac_cv_env_RANLIB_value=
ac_cv_env_READELF_FOR_TARGET_set=
ac_cv_env_READELF_FOR_TARGET_value=
ac_cv_env_READELF_set=
ac_cv_env_READELF_value=
ac_cv_env_STRIP_FOR_TARGET_set=
ac_cv_env_STRIP_FOR_TARGET_value=
ac_cv_env_STRIP_set=
ac_cv_env_STRIP_value=
ac_cv_env_WINDMC_FOR_TARGET_set=
ac_cv_env_WINDMC_FOR_TARGET_value=
ac_cv_env_WINDMC_set=
ac_cv_env_WINDMC_value=
ac_cv_env_WINDRES_FOR_TARGET_set=
ac_cv_env_WINDRES_FOR_TARGET_value=
ac_cv_env_WINDRES_set=
ac_cv_env_WINDRES_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_build_configargs_set=
ac_cv_env_build_configargs_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=arm-apple-darwin
ac_cv_env_host_configargs_set=
ac_cv_env_host_configargs_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_env_target_configargs_set=
ac_cv_env_target_configargs_value=
ac_cv_host=arm-apple-darwin
ac_cv_path_SED=/usr/bin/sed
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=awk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_target=arm-apple-darwin
acx_cv_prog_LN=ln

## ----------------- ##
## Output variables. ##
## ----------------- ##

AR=''
AR_FOR_BUILD='ar'
AR_FOR_TARGET=''
AS=''
AS_FOR_BUILD='as'
AS_FOR_TARGET=''
AWK='awk'
BISON=''
BUILD_CONFIG=''
CC='gcc'
CC_FOR_BUILD='gcc'
CC_FOR_TARGET=''
CFLAGS=''
CFLAGS_FOR_BUILD=''
CFLAGS_FOR_TARGET=''
COMPILER_AS_FOR_TARGET=''
COMPILER_LD_FOR_TARGET=''
COMPILER_NM_FOR_TARGET=''
CONFIGURE_GDB_TK=''
CPPFLAGS=''
CXX=''
CXXFLAGS=''
CXXFLAGS_FOR_BUILD=''
CXXFLAGS_FOR_TARGET=''
CXX_FOR_BUILD='g++'
CXX_FOR_TARGET=''
DEBUG_PREFIX_CFLAGS_FOR_TARGET=''
DEFS=''
DLLTOOL=''
DLLTOOL_FOR_BUILD='dlltool'
DLLTOOL_FOR_TARGET=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EXEEXT=''
EXPECT=''
EXTRA_CONFIGARGS_LIBJAVA='--disable-static'
FLAGS_FOR_TARGET=''
FLEX=''
GCC_FOR_TARGET=''
GCC_SHLIB_SUBDIR=''
GCJ_FOR_BUILD='gcj'
GCJ_FOR_TARGET=''
GDB_TK=''
GFORTRAN_FOR_BUILD='gfortran'
GFORTRAN_FOR_TARGET=''
GNATBIND=''
GNATMAKE=''
GOC_FOR_BUILD='gccgo'
GOC_FOR_TARGET=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_GDB_TK=''
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
LD=''
LDFLAGS='--arch arm64'
LDFLAGS_FOR_BUILD=''
LDFLAGS_FOR_TARGET=''
LD_FOR_BUILD='ld'
LD_FOR_TARGET=''
LEX=''
LIBOBJS=''
LIBS=''
LIPO=''
LIPO_FOR_TARGET=''
LN='ln'
LN_S='ln -s'
LTLIBOBJS=''
M4=''
MAINT=''
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE=''
MAKEINFO=''
NM=''
NM_FOR_BUILD='nm'
NM_FOR_TARGET=''
OBJCOPY=''
OBJDUMP=''
OBJDUMP_FOR_TARGET=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RANLIB_FOR_BUILD='ranlib'
RANLIB_FOR_TARGET=''
RAW_CXX_FOR_TARGET=''
READELF=''
READELF_FOR_TARGET=''
RPATH_ENVVAR=''
RUNTEST=''
SED='/usr/bin/sed'
SHELL='/bin/sh'
STRIP=''
STRIP_FOR_TARGET=''
SYSROOT_CFLAGS_FOR_TARGET=''
TOPLEVEL_CONFIGURE_ARGUMENTS='../configure --prefix=/usr/local/lvm-cross/ --host=arm-apple-darwin'
WINDMC=''
WINDMC_FOR_BUILD='windmc'
WINDMC_FOR_TARGET=''
WINDRES=''
WINDRES_FOR_BUILD='windres'
WINDRES_FOR_TARGET=''
YACC=''
ac_ct_CC='gcc'
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build='x86_64-apple-darwin14.4.0'
build_alias=''
build_configargs=''
build_configdirs='build-libiberty build-texinfo build-flex build-bison build-m4 build-fixincludes'
build_cpu='x86_64'
build_libsubdir='build-x86_64-apple-darwin14.4.0'
build_noncanonical='x86_64-apple-darwin14.4.0'
build_os='darwin14.4.0'
build_subdir='build-x86_64-apple-darwin14.4.0'
build_tooldir=''
build_vendor='apple'
clooginc=''
clooglibs=''
compare_exclusions=''
configdirs='intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl cloog libelf libiconv texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
do_compare=''
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
extra_host_libiberty_configure_flags=''
extra_isl_gmp_configure_flags=''
extra_mpc_gmp_configure_flags=''
extra_mpc_mpfr_configure_flags=''
extra_mpfr_configure_flags=''
gmpinc=''
gmplibs=''
host='arm-apple-darwin'
host_alias='arm-apple-darwin'
host_configargs=''
host_cpu='arm'
host_noncanonical='arm-apple-darwin'
host_os='darwin'
host_shared=''
host_subdir='.'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
islinc=''
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
poststage1_ldflags=''
poststage1_libs=''
prefix='/usr/local/lvm-cross'
program_transform_name='s,y,y,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
stage1_cflags=''
stage1_checking=''
stage1_languages=''
stage1_ldflags=''
stage1_libs=''
stage2_werror_flag=''
sysconfdir='${prefix}/etc'
target='arm-apple-darwin'
target_alias=''
target_configargs=''
target_configdirs='target-libgcc target-libbacktrace target-libgloss target-newlib target-libgomp target-libcilkrts target-libatomic target-libitm target-libstdc++-v3 target-libsanitizer target-libvtv target-libssp target-libquadmath target-libgfortran target-boehm-gc target-libffi target-zlib target-libjava target-libobjc target-libada target-libgo target-rda'
target_cpu='arm'
target_noncanonical='arm-apple-darwin'
target_os='darwin'
target_subdir='arm-apple-darwin'
target_vendor='apple'
tooldir=''

## ------------------- ##
## File substitutions. ##
## ------------------- ##

alphaieee_frag=''
host_makefile_frag='config/mh-darwin'
ospace_frag=''
serialization_dependencies=''
target_makefile_frag=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""

configure: exit 77

最佳答案

TL;DR:我认为您可能永远不会看到任何针对 iOS 的 binutils 版本。

  1. Apple 从未在 iOS 上公开 Mach-O 的规范。
  2. 您不太可能将包含 libbfd 的代码放入 App Store(因为明确指出 GNU GPL 从根本上与 App Store 法规不兼容,尤其是在 VLC for iOS 争议中)
  3. 您不太可能将使用 Apple 版本的 clang 以外的任何东西编译的代码放入 App Store(App Store 审查指南明确禁止)
  4. 即使针对 OS X,binutils 也无法实际链接和构建代码。

如果您的目标是 iOS,则必须使用 Apple 提供的工具链,或者从 Apple 发布的源代码构建您自己的等效工具(ldclang 和 LLVM都是开源项目,而底层的 iOS 库可以从 Mac 复制过来,尽管仅供您个人使用)。

关于ios - 交叉构建 binutils 2.25.1 for iOS8.4 (arm64-apple-darwin14.0.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31899386/

相关文章:

ios - 如何检查用户是否已从“设置”返回

ios - 在点击它之后但在使用 IOS 操作之前更改 UIview 颜色

java - Android SDK跨平台

windows - 玩耍/学习——QEMU(适用于 ARM)、Angstrom Linux(或 Debian)

macos - 为什么我不能在 ARM64 MacOS 上的 .text 部分组装绝对地址?

ios - iPad 1 上的应用程序分配是 iPad 2 的 4 倍

ios - spritekit,纹理图像有时加载有时不加载

openssl - 为 ARM 交叉编译 OpenSSH

ios - 架构 arm64 的重复符号(Xcode 错误)

linux - 在 ARM (armv7l/arm64/aarch64) 上构建 mongo shell 3.2.x - 段错误