1

我尝试为我在 OSX Yosemite 10.10.3 上的 Mac 编译 XNU-2782.1.97,但在编译结束时出现以下错误。

我认为通常我拥有做这件事所需的一切。

...
clang: error: optimization flag '-freorder-blocks' is not supported
make[7]: *** [device_tree.o] Error 1
make[6]: *** [build_all] Error 2
make[5]: *** [do_all] Error 2
clang: error: optimization flag '-freorder-blocks' is not supported
make[4]: *** [build_all] Error 2
clang: error: optimization flag '-freorder-blocks' is not supported
make[3]: *** [build_all_recurse_into_conf] Error 2
make[7]: *** [IOLib.cpo] Error 1
make[2]: *** [build_all_recurse_into_pexpert] Error 2
make[2]: *** Waiting for unfinished jobs....
make[6]: *** [build_all] Error 2
make[5]: *** [do_all] Error 2
make[4]: *** [build_all] Error 2
make[3]: *** [build_all_recurse_into_conf] Error 2
make[2]: *** [build_all_recurse_into_iokit] Error 2
make[7]: *** [OSRuntimeSupport.o] Error 1
make[7]: *** Waiting for unfinished jobs....
C++ OSSerialize.cpo
clang: error: optimization flag '-freorder-blocks' is not supported
make[7]: *** [OSSerialize.cpo] Error 1
make[6]: *** [build_all] Error 2
make[5]: *** [do_all] Error 2
make[4]: *** [build_all] Error 2
make[3]: *** [build_all_recurse_into_conf] Error 2
make[2]: *** [build_all_recurse_into_libkern] Error 2
MIG atm_notification_user.c
MIG device_server.h
MIG default_pager_alerts_user.c
Generating audit_kevents.c from /Users/Martin/xnu-2782.1.97/bsd/kern/syscalls.master
MIG audit_triggers_user.c
MIG device_server.c
CC audit_mac.o
clang: error: optimization flag '-freorder-blocks' is not supported
make[7]: *** [audit_mac.o] Error 1
make[6]: *** [build_all] Error 2
make[5]: *** [do_all] Error 2
make[4]: *** [build_all] Error 2
make[3]: *** [build_all_recurse_into_conf] Error 2
make[2]: *** [build_all_recurse_into_bsd] Error 2
MIG default_pager_object_server.c
MIG UNDRequest.c
MIG clock_reply_user.c
MIG gssd_mach.c
MIG UNDReplyServer.c
MIG coalition_notification_user.c
MIG kextd_mach.c
MIG gssd_mach.h
MIG lockd_mach.c
MIG exc_user.c
MIG kextd_mach.h
MIG lockd_mach.h
MIG host_notify_reply_user.c
MIG mach_exc_user.c
MIG mach_notify_user.c
MIG memory_object_user.c
MIG memory_object_control_user.c
MIG memory_object_default_user.c
MIG task_access_user.c
MIG telemetry_notification_user.c
MIG upl_user.c
MIG vm_map_user.c
MIG clock_server.c
MIG clock_priv_server.c
MIG exc_server.c
MIG host_priv_server.c
MIG host_security_server.c
MIG lock_set_server.c
MIG mach_exc_server.c
MIG mach_host_server.c
MIG mach_notify_server.c
MIG mach_port_server.c
MIG mach_vm_server.c
MIG mach_voucher_server.c
MIG mach_voucher_attr_control_server.c
MIG memory_object_server.c
MIG memory_object_control_server.c
MIG memory_object_default_server.c
MIG processor_server.c
MIG processor_set_server.c
MIG task_server.c
MIG thread_act_server.c
MIG upl_server.c
MIG vm_map_server.c
MIG vm32_map_server.c
CC vm_compressor_backing_store.o
CC default_pager.o
CC dp_backing_store.o
CC dp_memory_object.o
clang: error: optimization flag '-freorder-blocks' is not supportedclang
: error: optimization flag '-freorder-blocks' is not supported
clang: error: optimization flag '-freorder-blocks' is not supported
clang: error: optimization flag '-freorder-blocks' is not supported
make[7]: *** [dp_memory_object.o] Error 1
make[7]: *** Waiting for unfinished jobs....
make[7]: *** [dp_backing_store.o] Error 1
make[7]: *** [default_pager.o] Error 1
make[7]: *** [vm_compressor_backing_store.o] Error 1
CC default_pager_alerts_user.o
clang: error: optimization flag '-freorder-blocks' is not supported
make[7]: *** [default_pager_alerts_user.o] Error 1
make[6]: *** [build_all] Error 2
make[5]: *** [do_all] Error 2
make[4]: *** [build_all] Error 2
make[3]: *** [build_all_recurse_into_conf] Error 2
make[2]: *** [build_all_recurse_into_osfmk] Error 2
make[1]: *** [build_all_bootstrap_RELEASE^X86_64^NONE] Error 2
make: *** [all] Error 2
4

2 回答 2

2

您很可能使用了错误的 Xcode 版本。Apple 内核工程师 Shantonu Sen维护了一个关于从源代码编译 xnu 的博客,他告诉您每个 xnu 版本使用的确切工具链版本。我建议检查你是否完全按照他所说的那样做。您可能需要使用xcode-select来设置xcodebuild将使用的 Xcode 版本。

于 2015-05-23T08:44:42.037 回答
0

这是我为编译它所做的步骤。

Last login: Sat May 16 20:39:26 on ttys006
iMac-de-Martin:~ Martin$ curl -O http://opensource.apple.com/tarballs/xnu/xnu-2782.1.97.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9655k  100 9655k    0     0  48145      0  0:03:25  0:03:25 --:--:-- 64335
iMac-de-Martin:~ Martin$ tar zxf xnu-2782.1.97.tar.gz
iMac-de-Martin:~ Martin$ cd xnu-2782.1.97
iMac-de-Martin:xnu-2782.1.97 Martin$ make SDKROOT=macosx ARCH_CONFIGS=X86_64 KERNEL_CONFIGS=RELEASE
于 2015-05-20T11:51:48.287 回答