我尝试为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
答案 0 :(得分:2)
您最有可能使用错误的Xcode版本。 Apple内核工程师Shantonu Sen maintains a blog关于从源代码编译xnu,他告诉你每个版本的xnu使用的确切工具链版本。我建议你检查一下你是否正如他所说的那样做。您可能需要使用xcode-select
来设置xcodebuild
将使用的Xcode版本。
答案 1 :(得分: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