[root@mr ~]# dnf -y install expat-devel libxml2-devel pcre-devel(安装依赖包)
......
Upgraded:
expat-2.2.5-9.el8.x86_64 libxml2-2.9.7-14.el8.x86_64 pcre-8.42-6.el8.x86_64
python3-libxml2-2.9.7-14.el8.x86_64
Installed:
cmake-filesystem-3.20.2-4.el8.x86_64 expat-devel-2.2.5-9.el8.x86_64
libxml2-devel-2.9.7-14.el8.x86_64 pcre-cpp-8.42-6.el8.x86_64
pcre-devel-8.42-6.el8.x86_64 pcre-utf16-8.42-6.el8.x86_64
pcre-utf32-8.42-6.el8.x86_64 xz-devel-5.2.4-3.el8.x86_64
zlib-devel-1.2.11-17.el8.x86_64
Complete!
[root@mr ~]# tar -xf apr-util-1.6.1.tar.gz (解压apr-util-1.6.1.tar.gz)
[root@mr ~]# cd apr-util-1.6.1
[root@mr apr-util-1.6.1]# ./configure --prefix=/usr/local/src/apr-util --with-apr=/usr/local/src/apr(生成Makefile文件,需要伴随着上一个指定的依赖)
......
config.status: creating apr-util.pc
config.status: creating apu-1-config
config.status: creating include/private/apu_select_dbm.h
config.status: creating include/apr_ldap.h
config.status: creating include/apu.h
config.status: creating include/apu_want.h
config.status: creating test/Makefile
config.status: creating include/private/apu_config.h
config.status: executing default commands
[root@mr apr-util-1.6.1]# make(编译生成的Makefile文件)
......
include/private/apr_crypto_internal.h /root/apr-util-1.6.1/include/private/apr_dbd_internal.h /root/apr-util-1.6.1/include/private/apr_dbd_odbc_v2.h /root/apr-util-1.6.1/include/private/apr_dbm_private.h /root/apr-util-1.6.1/include/private/apu_internal.h > export_vars.c
gcc -E -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private -I/usr/local/src/apr/include/apr-1 exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$/\1/' >> aprutil.exp
gcc -E -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private -I/usr/local/src/apr/include/apr-1 export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> aprutil.exp
sed 's,^\(location=\).*$,\1installed,' < apu-1-config > apu-config.out
make[1]: Leaving directory '/root/apr-util-1.6.1'
[root@mr apr-util-1.6.1]# make install(进行安装)
......
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/install -c -m 644 aprutil.exp /usr/local/src/apr-util/lib
/usr/bin/install -c -m 755 apu-config.out /usr/local/src/apr-util/bin/apu-1-config
[root@mr apr-util-1.6.1]# cd /usr/local/src/apr-util/(切换到apr-util安装目录进行查看,默认情况下,系统搜索库文件的路径只有/lib,/usr/lib,我们需要进行修改在/etc/ld.so.conf.d/中创建以.conf为后缀名的文件,而后把要增添的路径直接写至此文件中。此时库文件增添的搜索路径重启后有效,若要使用增添的路径立即生效则要使用ldconfig命令)
[root@mr apr-util]# ls
bin include lib
[root@mr apr-util]# cd /etc/ld.so.conf.d/
[root@mr ld.so.conf.d]# echo /usr/local/src/apr-util/ >apr-util.conf
[root@mr ld.so.conf.d]# cd -
/usr/local/src/apr-util
[root@mr apr-util]# ldconfig(使其生效)
[root@mr apr-util]# ln -s /usr/local/src/apr-util/include/ /usr/include/apr-util(将头文件软链接到/usr/include目录下)
[root@mr apr-util]# ll /usr/include/apr-util/
total 4
drwxr-xr-x. 2 root root 4096 Jul 15 10:39 apr-1
lrwxrwxrwx. 1 root root 32 Jul 15 10:45 include -> /usr/local/src/apr-util/include/
[root@mr apr-util]#
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通