apache - 从 LLVM IR 文件编译 Apache
问题描述
我正在尝试从 LLVM IR 中间文件编译 apache2。
我能够用 clang 编译 apache2 并生成带有 LLVM IR 中间文件的 apaches 可执行文件。我能够对一些 LLVM IR 中间文件进行一些优化。现在我想从新的/修改的 LLVM-IR 文件中重新生成 apache2 可执行文件,以比较两个可执行文件的性能。
我使用 llvm-llc 从生成的 llvm 文件生成目标文件,现在当我尝试使用 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 可执行文件所需的所有目标文件?
解决方案
看来您需要链接 pthreads 和 libdl 等库。显然,您可以从普通的链接器 cmdline 中查看需要什么。
推荐阅读
- docker - Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Cannot assign requested address' for release version
- c++ - 通过非 cont c++17 data() 重载修改 std::string 内部缓冲区
- javascript - Bootstrap Vue:选择表单占位符未显示
- haskell - Haskell timeit 模块 - 未找到 SystemTimeIT
- mysql - 计算给定距离内的位置
- java - 根据浮点值对对象数组进行排序
- javascript - 关于我的反应应用程序的依赖和对等依赖的问题
- python - NameError:未定义名称“timseseries”
- php - 如何将多维数组合并为一个单维数组
- python - 带有模型的烧瓶分成多个文件,如何防止循环导入?