SELinux零知识学习五、libcap-ng源码下载、编译和安装

接上上篇文章:SELinux零知识学习三、SELinux应用层源码下载、编译和安装

在前述文章中编译SELinux源码时,出现了如下错误:

seunshare.c:22:10: 致命错误:cap-ng.h:没有那个文件或目录   22 | #include <cap-ng.h>

要解决这个错误,需要安装libcap-ng。本文就来介绍libcap-ng源码的下载、编译和安装。

零、简介

libcap-ng库旨在使具有posix功能的编程比传统的libcap库容易得多。它包括一些实用程序,可以分析所有当前正在运行的应用程序并打印出任何功能,以及是否具有开放式边界集。不带securebits“ NOROOT”标志的开放边界集将允许仅通过调用execve来扩展保留uid 0的应用程序的完整功能。

一、源码下载

1. 源码主页

源码GitHub地址如下:

https://github.com/stevegrubb/libcap-ng

页面如下所示:

2. 下载指定版本

从上图中可以看到,最新稳定版本为0.8.3。

选择此版本进行下载。点击上图中链接进入以下页面:

点击上图中的Source code(tar.gz)进行下载,实际链接为:https://github.com/stevegrubb/libcap-ng/archive/refs/tags/v0.8.3.tar.gz

3. 源码解压

源码下载后的文件为libcap-ng-0.8.3.tar.gz。将其放到指定目录。

解压源码,命令及结果如下:

$ tar zxvf libcap-ng-0.8.3.tar.gz 
libcap-ng-0.8.3/
libcap-ng-0.8.3/.github/
libcap-ng-0.8.3/.github/workflows/
libcap-ng-0.8.3/.github/workflows/codeql-analysis.yml
libcap-ng-0.8.3/AUTHORS
libcap-ng-0.8.3/COPYING
libcap-ng-0.8.3/COPYING.LIB
libcap-ng-0.8.3/ChangeLog
libcap-ng-0.8.3/INSTALL
libcap-ng-0.8.3/LICENSE
libcap-ng-0.8.3/Makefile.am
libcap-ng-0.8.3/NEWS
libcap-ng-0.8.3/README
libcap-ng-0.8.3/README.md
libcap-ng-0.8.3/autogen.sh
libcap-ng-0.8.3/bindings/
libcap-ng-0.8.3/bindings/Makefile.am
libcap-ng-0.8.3/bindings/python/
libcap-ng-0.8.3/bindings/python/Makefile.am
libcap-ng-0.8.3/bindings/python/test/
libcap-ng-0.8.3/bindings/python/test/Makefile.am
libcap-ng-0.8.3/bindings/python/test/capng-test.py
libcap-ng-0.8.3/bindings/python3/
libcap-ng-0.8.3/bindings/python3/Makefile.am
libcap-ng-0.8.3/bindings/src/
libcap-ng-0.8.3/bindings/src/Makefile.am
libcap-ng-0.8.3/bindings/src/capng_swig.i
libcap-ng-0.8.3/configure.ac
libcap-ng-0.8.3/docs/
libcap-ng-0.8.3/docs/Makefile.am
libcap-ng-0.8.3/docs/capng_apply.3
libcap-ng-0.8.3/docs/capng_apply_caps_fd.3
libcap-ng-0.8.3/docs/capng_capability_to_name.3
libcap-ng-0.8.3/docs/capng_change_id.3
libcap-ng-0.8.3/docs/capng_clear.3
libcap-ng-0.8.3/docs/capng_fill.3
libcap-ng-0.8.3/docs/capng_get_caps_fd.3
libcap-ng-0.8.3/docs/capng_get_caps_process.3
libcap-ng-0.8.3/docs/capng_get_rootid.3
libcap-ng-0.8.3/docs/capng_have_capabilities.3
libcap-ng-0.8.3/docs/capng_have_capability.3
libcap-ng-0.8.3/docs/capng_lock.3
libcap-ng-0.8.3/docs/capng_name_to_capability.3
libcap-ng-0.8.3/docs/capng_print_caps_numeric.3
libcap-ng-0.8.3/docs/capng_print_caps_text.3
libcap-ng-0.8.3/docs/capng_restore_state.3
libcap-ng-0.8.3/docs/capng_save_state.3
libcap-ng-0.8.3/docs/capng_set_rootid.3
libcap-ng-0.8.3/docs/capng_setpid.3
libcap-ng-0.8.3/docs/capng_update.3
libcap-ng-0.8.3/docs/capng_updatev.3
libcap-ng-0.8.3/docs/libdrop_ambient.7
libcap-ng-0.8.3/libcap-ng.spec
libcap-ng-0.8.3/m4/
libcap-ng-0.8.3/m4/Makefile.am
libcap-ng-0.8.3/m4/cap-ng.m4
libcap-ng-0.8.3/src/
libcap-ng-0.8.3/src/Makefile.am
libcap-ng-0.8.3/src/cap-ng.c
libcap-ng-0.8.3/src/cap-ng.h
libcap-ng-0.8.3/src/captab.h
libcap-ng-0.8.3/src/libcap-ng.pc.in
libcap-ng-0.8.3/src/libdrop_ambient.c
libcap-ng-0.8.3/src/lookup_table.c
libcap-ng-0.8.3/src/test/
libcap-ng-0.8.3/src/test/Makefile.am
libcap-ng-0.8.3/src/test/lib_test.c
libcap-ng-0.8.3/src/test/thread_test.c
libcap-ng-0.8.3/utils/
libcap-ng-0.8.3/utils/Makefile.am
libcap-ng-0.8.3/utils/captest.8
libcap-ng-0.8.3/utils/captest.c
libcap-ng-0.8.3/utils/filecap.8
libcap-ng-0.8.3/utils/filecap.c
libcap-ng-0.8.3/utils/netcap.8
libcap-ng-0.8.3/utils/netcap.c
libcap-ng-0.8.3/utils/proc-llist.c
libcap-ng-0.8.3/utils/proc-llist.h
libcap-ng-0.8.3/utils/pscap.8
libcap-ng-0.8.3/utils/pscap.c

解压后进入到源码根目录。

$ cd libcap-ng-0.8.3/

$ ls
AUTHORS  autogen.sh  bindings  ChangeLog  configure.ac  COPYING  COPYING.LIB  docs  INSTALL  libcap-ng.spec  LICENSE  m4  Makefile.am  NEWS  README  README.md  src  utils

$ ls -l
总计 160
-rw-rw-r-- 1 penghao penghao    67 2022年 3月30日 AUTHORS
-rwxrwxr-x 1 penghao penghao   109 2022年 3月30日 autogen.sh
drwxrwxr-x 5 penghao penghao  4096 2022年 3月30日 bindings
-rw-rw-r-- 1 penghao penghao  5741 2022年 3月30日 ChangeLog
-rw-rw-r-- 1 penghao penghao  9393 2022年 3月30日 configure.ac
-rw-rw-r-- 1 penghao penghao 17992 2022年 3月30日 COPYING
-rw-rw-r-- 1 penghao penghao 26542 2022年 3月30日 COPYING.LIB
drwxrwxr-x 2 penghao penghao  4096 2022年 3月30日 docs
-rw-rw-r-- 1 penghao penghao 15578 2022年 3月30日 INSTALL
-rw-rw-r-- 1 penghao penghao  2831 2022年 3月30日 libcap-ng.spec
-rw-rw-r-- 1 penghao penghao 26461 2022年 3月30日 LICENSE
drwxrwxr-x 2 penghao penghao  4096 2022年 3月30日 m4
-rw-rw-r-- 1 penghao penghao  1151 2022年 3月30日 Makefile.am
-rw-rw-r-- 1 penghao penghao     0 2022年 3月30日 NEWS
-rw-rw-r-- 1 penghao penghao   165 2022年 3月30日 README
-rw-rw-r-- 1 penghao penghao  4942 2022年 3月30日 README.md
drwxrwxr-x 3 penghao penghao  4096 2022年 3月30日 src
drwxrwxr-x 2 penghao penghao  4096 2022年 3月30日 utils

二、源码构建

1. 生成configure文件

运行autogen.sh命令生成configure文件,命令及结果如下所示:

$ ./autogen.sh 
+ autoreconf -fv --install
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: aclocal --force -I m4
autoreconf: running: /usr/local/bin/autoconf --force
configure.ac:34: warning: 'AM_CONFIG_HEADER': this macro is obsolete.
configure.ac:34: You should use the 'AC_CONFIG_HEADERS' macro instead.
./lib/autoconf/general.m4:2434: AC_DIAGNOSE is expanded from...
aclocal.m4:745: AM_CONFIG_HEADER is expanded from...
configure.ac:34: the top level
configure.ac:41: warning: The macro `AM_PROG_LIBTOOL' is obsolete.
configure.ac:41: You should run autoupdate.
m4/libtool.m4:101: AM_PROG_LIBTOOL is expanded from...
configure.ac:41: the top level
configure.ac:53: warning: The macro `AC_HEADER_STDC' is obsolete.
configure.ac:53: You should run autoupdate.
./lib/autoconf/headers.m4:704: AC_HEADER_STDC is expanded from...
configure.ac:53: the top level
configure.ac:254: warning: AC_OUTPUT should be used without arguments.
configure.ac:254: You should run autoupdate.
autoreconf: running: /usr/local/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:41: installing './compile'
configure.ac:39: installing './config.guess'
configure.ac:39: installing './config.sub'
configure.ac:40: installing './install-sh'
configure.ac:40: installing './missing'
bindings/python/Makefile.am: installing './depcomp'
bindings/python/Makefile.am:29: installing './py-compile'
parallel-tests: installing './test-driver'
bindings/src/Makefile.am:24: warning: variable 'SWIG_SOURCES' is defined but no program or
bindings/src/Makefile.am:24: library has 'SWIG' as canonical name (possible typo)
autoreconf: Leaving directory '.'

2. 配置

执行configure命令进行配置,命令及结果如下:

$ ./configure 
Configuring libcap-ng
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
file: could not find any valid magic files! (No such file or directory)
checking for mt... mt
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
.
Checking for programs
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for gawk... (cached) gawk
.
Checking for header files
checking for egrep... (cached) /usr/bin/grep -E
checking for linux/capability.h... yes
checking for sys/xattr.h... yes
checking for linux/securebits.h... yes
checking for pthread.h... yes
checking for library containing pthread_atfork... none required
checking for sys/vfs.h... yes
checking for linux/magic.h... yes
configure: WARNING: linux/magic.h is required in order to verify procfs.
checking __attr_access support... yes
checking for -Wformat-truncation... yes
checking for sys/syscall.h... yes
checking for gcc options needed to detect all undeclared functions... none needed
checking whether PR_CAP_AMBIENT is declared... yes
checking whether VFS_CAP_REVISION_2 is declared... yes
checking whether VFS_CAP_REVISION_3 is declared... yes
checking whether CAP_EPOLLWAKEUP is declared... no
checking whether CAP_WAKE_ALARM is declared... yes
checking whether CAP_BLOCK_SUSPEND is declared... yes
checking whether CAP_AUDIT_READ is declared... yes
checking whether CAP_PERFMON is declared... yes
checking whether CAP_BPF is declared... yes
checking whether CAP_CHECKPOINT_RESTORE is declared... yes
checking for swig... yes
checking whether to create python bindings... testing
checking for versioned Python2 interpreter... 
checking for python2... no
checking for python2.7... no
checking for python2.6... no
checking for python2.5... no
checking for python2.4... no
checking for python2.3... no
checking for python2.2... no
checking for python2.1... no
checking for python2.0... no
checking for python... /usr/local/bin/python
checking for python version... 3.10
checking for python platform... linux
checking for GNU default python prefix... ${prefix}
checking for GNU default python exec_prefix... ${exec_prefix}
checking for python script directory (pythondir)... ${PYTHON_PREFIX}/lib/python3.10/site-packages
checking for python extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/lib/python3.10/site-packages
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
configure: Python bindings will be built
checking whether to create python3 bindings... investigating
checking for python3-config... /usr/local/bin/python3-config
Python3 bindings WILL be built
checking for python3... /usr/local/bin/python3
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/libcap-ng.pc
config.status: creating src/test/Makefile
config.status: creating bindings/Makefile
config.status: creating bindings/python/Makefile
config.status: creating bindings/python3/Makefile
config.status: creating bindings/src/Makefile
config.status: creating bindings/python/test/Makefile
config.status: creating utils/Makefile
config.status: creating m4/Makefile
config.status: creating docs/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
.


  libcap-ng Version:      0.8.3
  Target:                 x86_64-pc-linux-gnu
  Installation prefix:    /usr/local
  Compiler:               gcc
  Compiler flags:
                          -g -O2
  __attr_access support:  yes

3. 编译

执行make命令进行编译,命令及结果如下:

$ make
make  all-recursive
make[1]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”
Making all in src
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
Making all in test
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/test”
make[3]: 对“all”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/test”
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I. -I..  -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -MT cap-ng.lo -MD -MP -MF .deps/cap-ng.Tpo -c -o cap-ng.lo cap-ng.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I.. -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -MT cap-ng.lo -MD -MP -MF .deps/cap-ng.Tpo -c cap-ng.c  -fPIC -DPIC -o .libs/cap-ng.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I.. -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -MT cap-ng.lo -MD -MP -MF .deps/cap-ng.Tpo -c cap-ng.c -o cap-ng.o >/dev/null 2>&1
mv -f .deps/cap-ng.Tpo .deps/cap-ng.Plo
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I. -I..  -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -MT lookup_table.lo -MD -MP -MF .deps/lookup_table.Tpo -c -o lookup_table.lo lookup_table.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I.. -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -MT lookup_table.lo -MD -MP -MF .deps/lookup_table.Tpo -c lookup_table.c  -fPIC -DPIC -o .libs/lookup_table.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I.. -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -MT lookup_table.lo -MD -MP -MF .deps/lookup_table.Tpo -c lookup_table.c -o lookup_table.o >/dev/null 2>&1
mv -f .deps/lookup_table.Tpo .deps/lookup_table.Plo
/bin/sh ../libtool  --tag=CC   --mode=link gcc -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -Wl,-z,relro  -o libcap-ng.la -rpath /usr/local/lib cap-ng.lo lookup_table.lo  
libtool: link: gcc -shared  -fPIC -DPIC  .libs/cap-ng.o .libs/lookup_table.o    -g -O2 -Wl,-z -Wl,relro   -Wl,-soname -Wl,libcap-ng.so.0 -o .libs/libcap-ng.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libcap-ng.so.0" && ln -s "libcap-ng.so.0.0.0" "libcap-ng.so.0")
libtool: link: (cd ".libs" && rm -f "libcap-ng.so" && ln -s "libcap-ng.so.0.0.0" "libcap-ng.so")
libtool: link: ar cr .libs/libcap-ng.a  cap-ng.o lookup_table.o
libtool: link: ranlib .libs/libcap-ng.a
libtool: link: ( cd ".libs" && rm -f "libcap-ng.la" && ln -s "../libcap-ng.la" "libcap-ng.la" )
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  -I. -I..  -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -MT libdrop_ambient.lo -MD -MP -MF .deps/libdrop_ambient.Tpo -c -o libdrop_ambient.lo libdrop_ambient.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I.. -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -MT libdrop_ambient.lo -MD -MP -MF .deps/libdrop_ambient.Tpo -c libdrop_ambient.c  -fPIC -DPIC -o .libs/libdrop_ambient.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I. -I.. -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -MT libdrop_ambient.lo -MD -MP -MF .deps/libdrop_ambient.Tpo -c libdrop_ambient.c -o libdrop_ambient.o >/dev/null 2>&1
mv -f .deps/libdrop_ambient.Tpo .deps/libdrop_ambient.Plo
/bin/sh ../libtool  --tag=CC   --mode=link gcc -fPIC -DPIC -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2   -o libdrop_ambient.la -rpath /usr/local/lib libdrop_ambient.lo  
libtool: link: gcc -shared  -fPIC -DPIC  .libs/libdrop_ambient.o    -g -O2   -Wl,-soname -Wl,libdrop_ambient.so.0 -o .libs/libdrop_ambient.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libdrop_ambient.so.0" && ln -s "libdrop_ambient.so.0.0.0" "libdrop_ambient.so.0")
libtool: link: (cd ".libs" && rm -f "libdrop_ambient.so" && ln -s "libdrop_ambient.so.0.0.0" "libdrop_ambient.so")
libtool: link: ar cr .libs/libdrop_ambient.a  libdrop_ambient.o
libtool: link: ranlib .libs/libdrop_ambient.a
libtool: link: ( cd ".libs" && rm -f "libdrop_ambient.la" && ln -s "../libdrop_ambient.la" "libdrop_ambient.la" )
make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
Making all in utils
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/utils”
gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../src  -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -c -o pscap.o pscap.c
/bin/sh ../libtool  --tag=CC   --mode=link gcc -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2   -o pscap pscap.o  -L../src -lcap-ng
libtool: link: gcc -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -o .libs/pscap pscap.o  -L../src /home/penghao/SELinux_Related/libcap-ng-0.8.3/src/.libs/libcap-ng.so
gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../src  -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -c -o netcap.o netcap.c
gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../src  -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -c -o proc-llist.o proc-llist.c
/bin/sh ../libtool  --tag=CC   --mode=link gcc -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2   -o netcap netcap.o proc-llist.o  -L../src -lcap-ng
libtool: link: gcc -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -o .libs/netcap netcap.o proc-llist.o  -L../src /home/penghao/SELinux_Related/libcap-ng-0.8.3/src/.libs/libcap-ng.so
gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../src  -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -c -o filecap.o filecap.c
/bin/sh ../libtool  --tag=CC   --mode=link gcc -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2   -o filecap filecap.o  -L../src -lcap-ng
libtool: link: gcc -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -o .libs/filecap filecap.o  -L../src /home/penghao/SELinux_Related/libcap-ng-0.8.3/src/.libs/libcap-ng.so
gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../src  -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -c -o captest.o captest.c
/bin/sh ../libtool  --tag=CC   --mode=link gcc -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2   -o captest captest.o  -L../src -lcap-ng
libtool: link: gcc -W -Wall -Wshadow -Wno-format-truncation -Wundef -D_GNU_SOURCE -g -O2 -o .libs/captest captest.o  -L../src /home/penghao/SELinux_Related/libcap-ng-0.8.3/src/.libs/libcap-ng.so
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/utils”
Making all in m4
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/m4”
make[2]: 对“all”无需做任何事。make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/m4”
Making all in docs
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/docs”
make[2]: 对“all”无需做任何事。make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/docs”
Making all in bindings
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
Making all in src
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/src”
make[3]: 对“all”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/src”
Making all in python
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
Making all in test
make[4]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python/test”
make[4]: 对“all”无需做任何事。make[4]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python/test”
make[4]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
cat /usr/include/linux/capability.h | grep '^#define CAP'  | grep -v '[()]' > caps.h
cat ../../src/cap-ng.h | grep -v '_state' > capng.h
swig -o capng_wrap.c -python -I. -I../.. -I/usr/local/include/python3.10 ./../src/capng_swig.i 
:1: Error: Unable to find 'swig.swg'
:3: Error: Unable to find 'python.swg'
make[4]: *** [Makefile:887:capng_wrap.c] 错误 1
make[4]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
make[3]: *** [Makefile:606:all-recursive] 错误 1
make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
make[2]: *** [Makefile:403:all-recursive] 错误 1
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
make[1]: *** [Makefile:453:all-recursive] 错误 1
make[1]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”
make: *** [Makefile:385:all] 错误 2

出现了错误:

:1: Error: Unable to find 'swig.swg'
:3: Error: Unable to find 'python.swg'
如何解决?

这里需要先安装swig。请参见下一篇章进行swig的源码下载、编译和安装。之后再回到此处。

—————————————————————————————————————————————
—————————————————————————————————————————————

安装完swig之后,回到这里,再次运行make进行编译。命令及结果如下:

penghao@Ding-Perlis-MP26JBT0:~/SELinux_Related/libcap-ng-0.8.3$ make
make  all-recursive
make[1]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”
Making all in src
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
Making all in test
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/test”
make[3]: 对“all”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/test”
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
make[3]: 对“all-am”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
Making all in utils
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/utils”
make[2]: 对“all”无需做任何事。make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/utils”
Making all in m4
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/m4”
make[2]: 对“all”无需做任何事。make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/m4”
Making all in docs
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/docs”
make[2]: 对“all”无需做任何事。make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/docs”
Making all in bindings
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
Making all in src
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/src”
make[3]: 对“all”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/src”
Making all in python
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
Making all in test
make[4]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python/test”
make[4]: 对“all”无需做任何事。make[4]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python/test”
make[4]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
swig -o capng_wrap.c -python -I. -I../.. -I/usr/local/include/python3.10 ./../src/capng_swig.i 
./../src/capng_swig.i:38: Warning 116: %except is deprecated.  Use %exception instead.
/bin/sh ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..  -I. -I../.. -I/usr/local/include/python3.10  -shared -g -O2 -MT _capng_la-capng_wrap.lo -MD -MP -MF .deps/_capng_la-capng_wrap.Tpo -c -o _capng_la-capng_wrap.lo `test -f 'capng_wrap.c' || echo './'`capng_wrap.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I. -I../.. -I/usr/local/include/python3.10 -g -O2 -MT _capng_la-capng_wrap.lo -MD -MP -MF .deps/_capng_la-capng_wrap.Tpo -c capng_wrap.c  -fPIC -DPIC -o .libs/_capng_la-capng_wrap.o
mv -f .deps/_capng_la-capng_wrap.Tpo .deps/_capng_la-capng_wrap.Plo
/bin/sh ../../libtool  --tag=CC   --mode=link gcc -shared -g -O2 -module -avoid-version -Wl,-z,relro  -o _capng.la -rpath /usr/local/lib/python3.10/site-packages _capng_la-capng_wrap.lo ../../src/libcap-ng.la 
libtool: link: gcc -shared  -fPIC -DPIC  .libs/_capng_la-capng_wrap.o   -Wl,-rpath -Wl,/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/.libs ../../src/.libs/libcap-ng.so  -g -O2 -Wl,-z -Wl,relro   -Wl,-soname -Wl,_capng.so -o .libs/_capng.so
libtool: link: ( cd ".libs" && rm -f "_capng.la" && ln -s "../_capng.la" "_capng.la" )
make[4]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
Making all in python3
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python3”
cat /usr/include/linux/capability.h | grep '^#define CAP'  | grep -v '[()]' > caps.h
cat ../../src/cap-ng.h | grep -v '_state' > capng.h
swig -o capng_wrap.c -python -py3 -modern -I. -I../.. -I/usr/local/include/python3.10 -I/usr/local/include/python3.10 ./../src/capng_swig.i
Deprecated command line option: -py3. Ignored, this option is no longer supported.
Deprecated command line option: -modern. Ignored, this option is now always on.
./../src/capng_swig.i:38: Warning 116: %except is deprecated.  Use %exception instead.
/bin/sh ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..  -I. -I../.. -I/usr/local/include/python3.10 -I/usr/local/include/python3.10  -shared -g -O2 -MT _capng_la-capng_wrap.lo -MD -MP -MF .deps/_capng_la-capng_wrap.Tpo -c -o _capng_la-capng_wrap.lo `test -f 'capng_wrap.c' || echo './'`capng_wrap.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I. -I../.. -I/usr/local/include/python3.10 -I/usr/local/include/python3.10 -g -O2 -MT _capng_la-capng_wrap.lo -MD -MP -MF .deps/_capng_la-capng_wrap.Tpo -c capng_wrap.c  -fPIC -DPIC -o .libs/_capng_la-capng_wrap.o
mv -f .deps/_capng_la-capng_wrap.Tpo .deps/_capng_la-capng_wrap.Plo
/bin/sh ../../libtool  --tag=CC   --mode=link gcc -shared -g -O2 -module -avoid-version -Wl,-z,relro  -o _capng.la -rpath /usr/local/lib/python3.10/site-packages _capng_la-capng_wrap.lo ../../src/libcap-ng.la ../../src/libcap-ng.la
libtool: link: gcc -shared  -fPIC -DPIC  .libs/_capng_la-capng_wrap.o   -Wl,-rpath -Wl,/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/.libs ../../src/.libs/libcap-ng.so  -g -O2 -Wl,-z -Wl,relro   -Wl,-soname -Wl,_capng.so -o .libs/_capng.so
libtool: link: ( cd ".libs" && rm -f "_capng.la" && ln -s "../_capng.la" "_capng.la" )
make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python3”
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
make[3]: 对“all-am”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”
make[1]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”

这次可以正常编译通过了。

4. 安装

执行make install命令进行安装,命令及结果如下:

$ sudo make install
[sudo] penghao 的密码:Making install in src
make[1]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
Making install in test
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/test”
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/test”
make[3]: 对“install-exec-am”无需做任何事。make[3]: 对“install-data-am”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/test”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src/test”
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
 /usr/bin/mkdir -p '/usr/local/lib'
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   libcap-ng.la libdrop_ambient.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libcap-ng.so.0.0.0 /usr/local/lib/libcap-ng.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libcap-ng.so.0.0.0 libcap-ng.so.0 || { rm -f libcap-ng.so.0 && ln -s libcap-ng.so.0.0.0 libcap-ng.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libcap-ng.so.0.0.0 libcap-ng.so || { rm -f libcap-ng.so && ln -s libcap-ng.so.0.0.0 libcap-ng.so; }; })
libtool: install: /usr/bin/install -c .libs/libcap-ng.lai /usr/local/lib/libcap-ng.la
libtool: install: /usr/bin/install -c .libs/libdrop_ambient.so.0.0.0 /usr/local/lib/libdrop_ambient.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libdrop_ambient.so.0.0.0 libdrop_ambient.so.0 || { rm -f libdrop_ambient.so.0 && ln -s libdrop_ambient.so.0.0.0 libdrop_ambient.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libdrop_ambient.so.0.0.0 libdrop_ambient.so || { rm -f libdrop_ambient.so && ln -s libdrop_ambient.so.0.0.0 libdrop_ambient.so; }; })
libtool: install: /usr/bin/install -c .libs/libdrop_ambient.lai /usr/local/lib/libdrop_ambient.la
libtool: install: /usr/bin/install -c .libs/libcap-ng.a /usr/local/lib/libcap-ng.a
libtool: install: chmod 644 /usr/local/lib/libcap-ng.a
libtool: install: ranlib /usr/local/lib/libcap-ng.a
libtool: install: /usr/bin/install -c .libs/libdrop_ambient.a /usr/local/lib/libdrop_ambient.a
libtool: install: chmod 644 /usr/local/lib/libdrop_ambient.a
libtool: install: ranlib /usr/local/lib/libdrop_ambient.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib
ldconfig: /usr/local/lib/libxml2.so.2 is not a symbolic link

----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
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/mkdir -p '/usr/local/include'
 /usr/bin/install -c -m 644 cap-ng.h '/usr/local/include'
 /usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 libcap-ng.pc '/usr/local/lib/pkgconfig'
make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
make[1]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/src”
Making install in utils
make[1]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/utils”
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/utils”
 /usr/bin/mkdir -p '/usr/local/bin'
  /bin/sh ../libtool   --mode=install /usr/bin/install -c pscap netcap filecap captest '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/pscap /usr/local/bin/pscap
libtool: install: /usr/bin/install -c .libs/netcap /usr/local/bin/netcap
libtool: install: /usr/bin/install -c .libs/filecap /usr/local/bin/filecap
libtool: install: /usr/bin/install -c .libs/captest /usr/local/bin/captest
 /usr/bin/mkdir -p '/usr/local/share/man/man8'
 /usr/bin/install -c -m 644 pscap.8 netcap.8 filecap.8 captest.8 '/usr/local/share/man/man8'
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/utils”
make[1]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/utils”
Making install in m4
make[1]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/m4”
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/m4”
make[2]: 对“install-exec-am”无需做任何事。 /usr/bin/mkdir -p '/usr/local/share/aclocal'
 /usr/bin/install -c -m 644 cap-ng.m4 '/usr/local/share/aclocal'
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/m4”
make[1]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/m4”
Making install in docs
make[1]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/docs”
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/docs”
make[2]: 对“install-exec-am”无需做任何事。 /usr/bin/mkdir -p '/usr/local/share/man/man3'
 /usr/bin/install -c -m 644 capng_clear.3 capng_fill.3 capng_setpid.3 capng_get_caps_process.3 capng_update.3 capng_updatev.3 capng_apply.3 capng_lock.3 capng_change_id.3 capng_get_caps_fd.3 capng_apply_caps_fd.3 capng_have_capabilities.3 capng_get_rootid.3 capng_set_rootid.3 capng_have_capability.3 capng_print_caps_numeric.3 capng_print_caps_text.3 capng_name_to_capability.3 capng_capability_to_name.3 capng_save_state.3 capng_restore_state.3 '/usr/local/share/man/man3'
 /usr/bin/mkdir -p '/usr/local/share/man/man7'
 /usr/bin/install -c -m 644 libdrop_ambient.7 '/usr/local/share/man/man7'
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/docs”
make[1]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/docs”
Making install in bindings
make[1]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
Making install in src
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/src”
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/src”
make[3]: 对“install-exec-am”无需做任何事。make[3]: 对“install-data-am”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/src”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/src”
Making install in python
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
Making install in test
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python/test”
make[4]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python/test”
make[4]: 对“install-exec-am”无需做任何事。make[4]: 对“install-data-am”无需做任何事。make[4]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python/test”
make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python/test”
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
make[4]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
 /usr/bin/mkdir -p '/usr/local/lib/python3.10/site-packages'
 /bin/sh ../../libtool   --mode=install /usr/bin/install -c   _capng.la '/usr/local/lib/python3.10/site-packages'
libtool: warning: relinking '_capng.la'
libtool: install: (cd /home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python; /bin/sh "/home/penghao/SELinux_Related/libcap-ng-0.8.3/libtool"  --tag CC --mode=relink gcc -shared -g -O2 -module -avoid-version -Wl,-z,relro -o _capng.la -rpath /usr/local/lib/python3.10/site-packages _capng_la-capng_wrap.lo ../../src/libcap-ng.la )
libtool: relink: gcc -shared  -fPIC -DPIC  .libs/_capng_la-capng_wrap.o   -L/usr/local/lib -lcap-ng  -g -O2 -Wl,-z -Wl,relro   -Wl,-soname -Wl,_capng.so -o .libs/_capng.so
libtool: install: /usr/bin/install -c .libs/_capng.soT /usr/local/lib/python3.10/site-packages/_capng.so
libtool: install: /usr/bin/install -c .libs/_capng.lai /usr/local/lib/python3.10/site-packages/_capng.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib/python3.10/site-packages
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib/python3.10/site-packages

If you ever happen to want to link against installed libraries
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/mkdir -p '/usr/local/lib/python3.10/site-packages'
 /usr/bin/install -c -m 644 capng.py '/usr/local/lib/python3.10/site-packages'
Byte-compiling python modules...
capng.py
Byte-compiling python modules (optimized versions) ...
capng.py
make[4]: 对“install-data-am”无需做任何事。make[4]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python”
Making install in python3
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python3”
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python3”
 /usr/bin/mkdir -p '/usr/local/lib/python3.10/site-packages'
 /bin/sh ../../libtool   --mode=install /usr/bin/install -c   _capng.la '/usr/local/lib/python3.10/site-packages'
libtool: warning: relinking '_capng.la'
libtool: install: (cd /home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python3; /bin/sh "/home/penghao/SELinux_Related/libcap-ng-0.8.3/libtool"  --tag CC --mode=relink gcc -shared -g -O2 -module -avoid-version -Wl,-z,relro -o _capng.la -rpath /usr/local/lib/python3.10/site-packages _capng_la-capng_wrap.lo ../../src/libcap-ng.la ../../src/libcap-ng.la )
libtool: relink: gcc -shared  -fPIC -DPIC  .libs/_capng_la-capng_wrap.o   -L/usr/local/lib -lcap-ng  -g -O2 -Wl,-z -Wl,relro   -Wl,-soname -Wl,_capng.so -o .libs/_capng.so
libtool: install: /usr/bin/install -c .libs/_capng.soT /usr/local/lib/python3.10/site-packages/_capng.so
libtool: install: /usr/bin/install -c .libs/_capng.lai /usr/local/lib/python3.10/site-packages/_capng.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib/python3.10/site-packages
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib/python3.10/site-packages

If you ever happen to want to link against installed libraries
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/mkdir -p '/usr/local/lib/python3.10/site-packages'
 /usr/bin/install -c -m 644 capng.py '/usr/local/lib/python3.10/site-packages'
Byte-compiling python modules...
capng.py
Byte-compiling python modules (optimized versions) ...
capng.py
make[3]: 对“install-data-am”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python3”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings/python3”
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
make[3]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
make[3]: 对“install-exec-am”无需做任何事。make[3]: 对“install-data-am”无需做任何事。make[3]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
make[1]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3/bindings”
make[1]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”
make[2]: 进入目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”
make[2]: 对“install-exec-am”无需做任何事。make[2]: 对“install-data-am”无需做任何事。make[2]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”
make[1]: 离开目录“/home/penghao/SELinux_Related/libcap-ng-0.8.3”

至此,libcap-ng就下载、编译、安装完成了。

猜你喜欢

转载自blog.csdn.net/phmatthaus/article/details/129878793