我正在尝试从LLVM中间文件编译apache2。
我能够用clang编译apache2,并生成带有LLVM中间文件的apaches可执行文件。我能够在一些LLVM IR中间文件上运行一些优化。现在,我想从新的/修改过的LLVM-IR文件重新生成apache2可执行文件,以比较两个可执行文件的性能。
我使用llvm-llc从生成的llvm-files生成目标文件,现在当我尝试使用clang链接所有目标文件时,我得到了错误。下面是我得到的错误的一个示例:
/apache/httpd-2.4.46/srclib/apr-util/ldap/apr_ldap_init.c:92: undefined reference to `ldap_err2string'
/apache/httpd-2.4.46/srclib/apr-util/ldap/apr_ldap_option.c:603: undefined reference to `ldap_set_option'
/home/yousif/fuzz-testing/apache/httpd-2.4.46/srclib/apr-util/xml/apr_xml.c:380: undefined reference to `XML_StopParser'
dso.o: In function `dso_cleanup':
/apache/httpd-2.4.46/srclib/apr/dso/unix/dso.c:72: undefined reference to `dlclose'
dso.o: In function `apr_dso_load':
/apache/httpd-2.4.46/srclib/apr/dso/unix/dso.c:139: undefined reference to `dlopen'
/apache/httpd-2.4.46/srclib/apr/dso/unix/dso.c:153: undefined reference to `dlerror'
dso.o: In function `apr_dso_sym':
/apache/httpd-2.4.46/srclib/apr/dso/unix/dso.c:227: undefined reference to `dlsym'
/apache/httpd-2.4.46/srclib/apr/dso/unix/dso.c:231: undefined reference to `dlerror'
proc_mutex.o: In function `proc_mutex_pthread_acquire_ex':
/apache/httpd-2.4.46/srclib/apr/locks/unix/proc_mutex.c:807: undefined reference to `pthread_mutex_timedlock'
/apache/httpd-2.4.46/srclib/apr/locks/unix/proc_mutex.c:788: undefined reference to `pthread_mutex_trylock'
....我猜我遗漏了很多在链接阶段生成最终可执行文件所需的目标文件或库。
我的问题是,我如何以及在哪里可以找到重新生成apache可执行文件所需的所有目标文件?
发布于 2020-11-17 13:15:34
看起来你需要链接pthread和libdl这样的库。很明显,你可以从普通的链接器命令行中看到什么是必要的。
https://stackoverflow.com/questions/64868842
复制相似问题