我正在尝试使用LLVMGold和LTO构建一个C项目(krb5),以便将整个krb5输出到内联的LLVM .bc文件中。
按照以下说明操作:
https://llvm.org/docs/GoldPlugin.html
http://gbalats.github.io/2015/12/10/compiling-autotooled-projects-to-LLVM-bitcode.html
我设法让配置工作:
export RANLIB=/bin/true
./configure CFLAGS="-flto" LDFLAGS="-flto -fuse-ld=gold -Wl,-plugin-opt=save-temps"
-save-temps
选项似乎是将-also-emit-llvm
替换为输出.bc的选项。现在,当我尝试运行make
时,我收到此错误:
cc -L../lib -Wl,--enable-new-dtags -Wl,-rpath -Wl,/usr/local/lib -flto -flto -fuse-ld=gold -Wl,-plugin-opt=save-temps -o krb5kdc kdc5_err.o authind.o cammac.o dispatch.o do_as_req.o do_tgs_req.o fast_util.o kdc_util.o kdc_preauth.o kdc_preauth_ec.o kdc_preauth_encts.o main.o policy.o extern.o replay.o kdc_authdata.o kdc_audit.o kdc_transit.o tgs_policy.o kdc_log.o -lapputils -lkadm5srv_mit -lkdb5 -lgssrpc -lgssapi_krb5 -lgssrpc -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lkrb5support -lresolv -ldl -lverto
/usr/bin/ld.gold: error: apputils: no archive symbol table (run ranlib)
krb5kdc.o:ld-temp.o:function main: error: undefined reference to 'loop_init'
krb5kdc.o:ld-temp.o:function main: error: undefined reference to 'loop_add_udp_address'
krb5kdc.o:ld-temp.o:function main: error: undefined reference to 'loop_add_tcp_address'
krb5kdc.o:ld-temp.o:function main: error: undefined reference to 'loop_setup_signals'
krb5kdc.o:ld-temp.o:function main: error: undefined reference to 'loop_setup_network'
krb5kdc.o:ld-temp.o:function main: error: undefined reference to 'loop_free'
krb5kdc.o:ld-temp.o:function create_workers: error: undefined reference to 'loop_setup_signals'
krb5kdc.o:ld-temp.o:function create_workers: error: undefined reference to 'loop_free'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:699: recipe for target 'krb5kdc' failed
make[1]: *** [krb5kdc] Error 1
make[1]: Leaving directory '/root/src/kdc'
似乎很奇怪,因为ranlib
不是必需的,我尝试将ranlib
手动运行到每个.o,.h,.bc文件等,但似乎没有这样做。有什么想法吗?
ranlib: kdc/kdc_util.h: File format not recognized
ranlib: kdc/kdc_util.o: File format not recognized
ranlib: kdc/krb5kdc.0.4.opt.ll: File format not recognized
ranlib: kdc/krb5kdc.0.4.opt.bc: File format not recognized