zl程序教程

您现在的位置是:首页 >  工具

当前栏目

AppArmor零知识学习七、源码构建(4)

源码学习 构建 知识
2023-09-14 09:15:39 时间

本文内容参考:

AppArmor / apparmor · GitLab

接前一篇文章:AppArmor零知识学习六、源码构建(3)

在前一篇文章中完成了apparmor源码构建的第三步——Binary Utilities的构建和安装,本文继续往下进行。

四、源码构建

 4. Parser构建

(1)进入parser目录

通过cd命令进入apparmor源码根目录下的parser目录。实际命令及结果如下所示:

penghao@Ding-Perlis-MP260S48:~/AppArmor/apparmor$ cd parser/
penghao@Ding-Perlis-MP260S48:~/AppArmor/apparmor/parser$ ls
aa-teardown          apparmor.service     dbus.cc             Makefile         parser.conf         parser_policy.c    profile.cc             rule.cc
aa-teardown.pod      apparmor.systemd     dbus.h              mount.cc         parser.h            parser_regex.c     profile.h              rule.h
af_rule.cc           apparmor_xattrs.pod  default_features.c  mount.h          parser_include.c    parser_symtab.c    profile-load           signal.cc
af_rule.h            base_af_names.h      file_cache.h        mqueue.cc        parser_include.h    parser_variable.c  ptrace.cc              signal.h
af_unix.cc           base_cap_names.h     frob_slack_rc       mqueue.h         parser_interface.c  parser_yacc.y      ptrace.h               techdoc.tex
af_unix.h            capability.h         immunix.h           network.c        parser_lex.l        po                 rc.apparmor.functions  tst
apparmor.d.pod       common_optarg.c      libapparmor_re      network.h        parser_main.c       policy_cache.c     rc.apparmor.slackware  unit_test.h
apparmor_parser.pod  common_optarg.h      lib.c               parser_alias.c   parser_merge.c      policy_cache.h     README                 userns.cc
apparmor.pod         COPYING.GPL          lib.h               parser_common.c  parser_misc.c       policydb.h         README.devel           userns.h

(2)编译

运行make命令进行编译。实际命令及结果如下所示:

$ make
which: no rpm in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/usr/jdk/bin:/usr/go/bin)
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_common.o parser_common.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_include.o parser_include.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_interface.o parser_interface.c
bison -d --define=parse.error=verbose -o parser_yacc.c parser_yacc.y
flex -B -v --noyy_top_state -oparser_lex.c parser_lex.l
flex version 2.6.4 usage statistics:
  scanner options: -svB8 -Cem -oparser_lex.c
  1239/2000 NFA states
  530/1000 DFA states (5537 words)
  84 rules
  Compressed tables always back-up
  24/40 start conditions
  656 epsilon states, 481 double epsilon states
  133/200 character classes needed 4635/4750 words of storage, 0 reused
  22223 state/nextstate pairs created
  2389/19834 unique/duplicate transitions
  641/1000 base-def entries created
  4045/6000 (peak 8172) nxt-chk entries created
  2220/7500 (peak 6216) template nxt-chk entries created
  374 empty table entries
  126 protos created
  111 templates created, 279 uses
  56/256 equivalence classes created
  20/256 meta-equivalence classes created
  0 (70 saved) hash collisions, 1908 DFAs equal
  22 sets of reallocations needed
  9684 total table entries needed
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_lex.o parser_lex.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_main.o parser_main.c
../common/list_capabilities.sh | LC_ALL=C sed -n -e "s/[ \\t]\\?CAP_\\([A-Z0-9_]\\+\\)/\{\"\\L\\1\", \\UCAP_\\1, NO_BACKMAP_CAP, CAPFLAG_BASE_FEATURE\},\\n/pg" > generated_cap_names.h
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_misc.o parser_misc.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_merge.o parser_merge.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_symtab.o parser_symtab.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_yacc.o parser_yacc.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_regex.o parser_regex.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_variable.o parser_variable.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_policy.o parser_policy.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o parser_alias.o parser_alias.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o common_optarg.o common_optarg.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o lib.o lib.c
../common/list_af_names.sh > generated_af_names.h
cat base_af_names.h | diff -u - generated_af_names.h | grep -v '^.AF_MAX' | grep '^\+[^+]' ; \
if [ $? -eq 1 ] ; then \
        cat base_af_names.h | LC_ALL=C sed -n -e 's/[ \t]\?AF_MAX[ \t]\+[0-9]\+,//g'  -e 's/[ \t]\+\?AF_\([A-Z0-9_]\+\)[ \t]\+\([0-9]\+\),/#ifndef AF_\1\n#  define AF_\1 \2\n#endif\nAA_GEN_NET_ENT("\L\1", \UAF_\1)\n/pg' > af_names.h ; \
        cat base_af_names.h | LC_ALL=C sed -n -e 's/AF_MAX[ \t]\+\([0-9]\+\),\?.*/\n#define AA_AF_MAX \1\n/p' >> af_names.h ; \
else \
        echo "Error: new AF names detected; please update base_af_names.h with values from generated_af_names.h" ; \
        exit 1 ; \
fi
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o network.o network.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o mount.o mount.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o dbus.o dbus.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o profile.o profile.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o rule.o rule.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o signal.o signal.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o ptrace.o ptrace.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o af_rule.o af_rule.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o af_unix.o af_unix.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o policy_cache.o policy_cache.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o default_features.o default_features.c
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o userns.o userns.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -c -o mqueue.o mqueue.cc
make -C libapparmor_re CFLAGS="-g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x"
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/parser/libapparmor_re”
bison -o parse.cc parse.y
parse.y:63.1-21: 警告: 已弃用的指令:“%name-prefix "regex_"”,应使用 “%define api.prefix {regex_}” [-Wdeprecated]
   63 | %name-prefix "regex_"
      | ^~~~~~~~~~~~~~~~~~~~~
      | %define api.prefix {regex_}
parse.y: 警告: fix-its can be applied.  Rerun with option '--update'. [-Wother]
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x -I../../libraries/libapparmor/include   -c -o parse.o parse.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x -I../../libraries/libapparmor/include   -c -o expr-tree.o expr-tree.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x -I../../libraries/libapparmor/include   -c -o hfa.o hfa.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x -I../../libraries/libapparmor/include   -c -o chfa.o chfa.cc
g++ -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x -I../../libraries/libapparmor/include   -c -o aare_rules.o aare_rules.cc
ar -rcs libapparmor_re.a parse.o expr-tree.o hfa.o chfa.o aare_rules.o
make[1]: 离开目录“/home/penghao/AppArmor/apparmor/parser/libapparmor_re”
g++  -g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x  -DHAVE_REALLOCARRAY=1 -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -I../libraries/libapparmor/include -o apparmor_parser parser_common.o parser_include.o parser_interface.o parser_lex.o parser_main.o parser_misc.o parser_merge.o parser_symtab.o parser_yacc.o parser_regex.o parser_variable.o parser_policy.o parser_alias.o common_optarg.o lib.o network.o  mount.o  dbus.o  profile.o  rule.o  signal.o  ptrace.o  af_rule.o  af_unix.o policy_cache.o default_features.o  userns.o  mqueue.o  \
        libapparmor_re/libapparmor_re.a -static-libgcc -static-libstdc++ -L.  -L../libraries/libapparmor/src/.libs -Wl,-Bstatic -lapparmor -Wl,-Bdynamic -lpthread
/usr/bin/pod2man apparmor.d.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=5 > apparmor.d.5
/usr/bin/pod2man apparmor.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=7 > apparmor.7
/usr/bin/pod2man apparmor_parser.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > apparmor_parser.8
/usr/bin/pod2man aa-teardown.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=8 > aa-teardown.8
/usr/bin/pod2man apparmor_xattrs.pod --release="AppArmor 3.1.0" --center=AppArmor --stderr --section=7 > apparmor_xattrs.7
/usr/bin/pod2html --header --css apparmor.css --infile=apparmor.d.pod --outfile=apparmor.d.5.html
/usr/bin/pod2html --header --css apparmor.css --infile=apparmor.pod --outfile=apparmor.7.html
/usr/bin/pod2html --header --css apparmor.css --infile=apparmor_parser.pod --outfile=apparmor_parser.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=aa-teardown.pod --outfile=aa-teardown.8.html
/usr/bin/pod2html --header --css apparmor.css --infile=apparmor_xattrs.pod --outfile=apparmor_xattrs.7.html
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/parser/po”
msgfmt -c -o af.mo af.po
msgfmt -c -o ar.mo ar.po
msgfmt -c -o bg.mo bg.po
msgfmt -c -o bn.mo bn.po
msgfmt -c -o bo.mo bo.po
bo.po:7: 警告:文件头“Last-Translator”仍然是默认值未改变bo.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o bs.mo bs.po
msgfmt -c -o ca.mo ca.po
msgfmt -c -o ce.mo ce.po
msgfmt -c -o cs.mo cs.po
msgfmt -c -o cy.mo cy.po
msgfmt -c -o da.mo da.po
msgfmt -c -o de.mo de.po
msgfmt -c -o el.mo el.po
msgfmt -c -o en_AU.mo en_AU.po
msgfmt -c -o en_CA.mo en_CA.po
msgfmt -c -o en_GB.mo en_GB.po
msgfmt -c -o es.mo es.po
msgfmt -c -o et.mo et.po
msgfmt -c -o fa.mo fa.po
fa.po:7: 警告:头部缺少文件头“Language”
msgfmt -c -o fi.mo fi.po
msgfmt -c -o fr.mo fr.po
msgfmt -c -o gl.mo gl.po
msgfmt -c -o gu.mo gu.po
msgfmt -c -o he.mo he.po
msgfmt -c -o hi.mo hi.po
msgfmt -c -o hr.mo hr.po
msgfmt -c -o hu.mo hu.po
msgfmt -c -o id.mo id.po
msgfmt -c -o it.mo it.po
msgfmt -c -o ja.mo ja.po
msgfmt -c -o ka.mo ka.po
msgfmt -c -o km.mo km.po
msgfmt -c -o ko.mo ko.po
msgfmt -c -o lo.mo lo.po
msgfmt -c -o lt.mo lt.po
msgfmt -c -o mk.mo mk.po
msgfmt -c -o mr.mo mr.po
msgfmt -c -o ms.mo ms.po
msgfmt -c -o nb.mo nb.po
msgfmt -c -o nl.mo nl.po
msgfmt -c -o oc.mo oc.po
msgfmt -c -o pa.mo pa.po
msgfmt -c -o pl.mo pl.po
msgfmt -c -o pt_BR.mo pt_BR.po
msgfmt -c -o pt.mo pt.po
msgfmt -c -o ro.mo ro.po
msgfmt -c -o ru.mo ru.po
msgfmt -c -o si.mo si.po
msgfmt -c -o sk.mo sk.po
msgfmt -c -o sl.mo sl.po
msgfmt -c -o sq.mo sq.po
msgfmt -c -o sr.mo sr.po
msgfmt -c -o sv.mo sv.po
msgfmt -c -o ta.mo ta.po
msgfmt -c -o th.mo th.po
msgfmt -c -o tr.mo tr.po
msgfmt -c -o ug.mo ug.po
msgfmt -c -o uk.mo uk.po
msgfmt -c -o vi.mo vi.po
msgfmt -c -o wa.mo wa.po
msgfmt -c -o xh.mo xh.po
msgfmt -c -o zh_CN.mo zh_CN.po
msgfmt -c -o zh_TW.mo zh_TW.po
msgfmt -c -o zu.mo zu.po
make[1]: 离开目录“/home/penghao/AppArmor/apparmor/parser/po”

(3)检查

运行make check命令进行检查。实际命令及结果如下所示:

$ make check
which: no rpm in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/usr/jdk/bin:/usr/go/bin)
LANG=C podchecker -warning -warning *.pod
aa-teardown.pod pod syntax OK.
apparmor.d.pod pod syntax OK.
apparmor_parser.pod pod syntax OK.
apparmor.pod pod syntax OK.
apparmor_xattrs.pod pod syntax OK.
make -C libapparmor_re CFLAGS="-g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x"
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/parser/libapparmor_re”
make[1]: 对“all”无需做任何事。make[1]: 离开目录“/home/penghao/AppArmor/apparmor/parser/libapparmor_re”
*** running tst_regex
parser_common.c: Regex error: trailing '\' escape character
parser_common.c: Unable to parse input line '\'
parser_common.c: Regex error: trailing '\' escape character
parser_common.c: Unable to parse input line 'blort\'
parser_common.c: Regex grouping error: Unclosed grouping or character class, expecting close }
parser_common.c: Unable to parse input line '[blort'
parser_common.c: Regex grouping error: Unclosed grouping or character class, expecting close }
parser_common.c: Unable to parse input line 'b[lort'
parser_common.c: Regex grouping error: Unclosed grouping or character class, expecting close }
parser_common.c: Unable to parse input line 'blort['
parser_common.c: Regex grouping error: Invalid close ], no matching open [ detected
parser_common.c: Unable to parse input line 'blort]'
parser_common.c: Regex grouping error: Invalid close ], no matching open [ detected
parser_common.c: Unable to parse input line 'blo]rt'
parser_common.c: Regex grouping error: Invalid close ], no matching open [ detected
parser_common.c: Unable to parse input line ']blort'
parser_common.c: Regex grouping error: Invalid number of items between {}
parser_common.c: Unable to parse input line '{beta}'
parser_common.c: Regex grouping error: Unclosed grouping or character class, expecting close }
parser_common.c: Unable to parse input line 'biz{beta'
parser_common.c: Regex grouping error: Invalid number of items between {}
parser_common.c: Regex grouping error: Invalid close }, no matching open { detected
parser_common.c: Unable to parse input line 'biz}beta'
parser_common.c: Regex grouping error: Unclosed grouping or character class, expecting close }
parser_common.c: Unable to parse input line 'biz{be,ta'
parser_common.c: Regex grouping error: Invalid number of items between {}
parser_common.c: Regex grouping error: Invalid close }, no matching open { detected
parser_common.c: Unable to parse input line 'biz,be}ta'
parser_common.c: Regex grouping error: Invalid number of items between {}
parser_common.c: Unable to parse input line 'biz{}beta'
parser_common.c: Regex grouping error: Invalid number of items between {}
parser_common.c: Unable to parse input line '{{alpha,blort,nested}beta}'
parser_common.c: Regex grouping error: Exceeded maximum nesting of {}
parser_common.c: Regex grouping error: Unclosed grouping or character class, expecting close }
parser_common.c: Unable to parse input line '{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a{a,b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b},b}b,blort}'
parser_common.c: Regex grouping error: Unclosed grouping or character class, expecting close }
parser_common.c: Unable to parse input line '\\['
parser_common.c: Regex grouping error: Invalid close ], no matching open [ detected
parser_common.c: Unable to parse input line '\\]'
parser_common.c: Regex grouping error: Unclosed grouping or character class, expecting close }
parser_common.c: Unable to parse input line '\\{'
parser_common.c: Regex grouping error: Invalid number of items between {}
parser_common.c: Regex grouping error: Invalid close }, no matching open { detected
parser_common.c: Unable to parse input line '\\}'
*** running tst_misc
*** running tst_symtab
Variable not_a_set_variable is not a set variable
Referenced variable not_a_set_variable is a boolean used in set context
Variable @{recursive_1} is referenced recursively (by @{recursive_3})
Variable @{defined_var} references undefined variable @{undefined_var}
@set_var_1 = "set_value@{set_var_2}"
@set_var_1 = "set_valuesome other set_value"
@set_var_1 = "set_value@{set_var_2}"
'test' is already defined
Failed to find declaration for: no_such_variable
'abuse' is already defined
'stereopuff' is already defined
Variable stereopuff is not a boolean variable
$abuse = false
@eek = "Mocking@{monopuff}bir@{stereopuff}d@{stereopuff}"
@monopuff = "Mockingbird"
$shenanigan = true
@stereopuff = "/in/direction" "Fun to Steal" "Unsupervised"
@test = "test value"
@testing = "testing"
$abuse = false
@eek = "Mocking@{monopuff}bir@{stereopuff}d@{stereopuff}"
@monopuff = "Mockingbird"
$shenanigan = true
@stereopuff = "/in/direction" "Fun to Steal" "Unsupervised"
@test = "test value"
@testing = "testing"
$abuse = false
@eek = "MockingMockingbirdbirUnsuperviseddUnsupervised" "MockingMockingbirdbirUnsuperviseddFun to Steal" "MockingMockingbirdbirUnsupervisedd/in/direction" "MockingMockingbirdbirFun to StealdUnsupervised" "MockingMockingbirdbirFun to StealdFun to Steal" "MockingMockingbirdbirFun to Steald/in/direction" "MockingMockingbirdbir/in/directiondUnsupervised" "MockingMockingbirdbir/in/directiondFun to Steal" "MockingMockingbirdbir/in/directiond/in/direction"
@monopuff = "Mockingbird"
$shenanigan = true
@stereopuff = "Unsupervised" "Fun to Steal" "/in/direction"
@test = "test value"
@testing = "testing"
*** running tst_variable
*** running tst_lib
.......
----------------------------------------------------------------------
Ran 7 tests in 0.029s

OK
.s....s....s....s....s..............ss...................ss.......
----------------------------------------------------------------------
Ran 66 tests in 42.526s

OK (skipped=9)
Minimize profiles basic perms ok
Minimize profiles audit perms ok
Minimize profiles deny perms ok
Minimize profiles audit deny perms ok
Minimize profiles xtrans ok
Minimize profiles audit xtrans ok
Minimize profiles deny xtrans ok
Minimize profiles audit deny xtrans ok
Equality Tests:
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
PASS
PASS
Generated 24964 xtransition interaction tests
Generated 45132 dbus tests
simple.pl .. 15/71726 
not ok 19 - TODO: ./simple_tests//abi/ok_10.sd: abi testing - abi path quotes in <> with spaces # TODO Disabled testcase.
not ok 20 - TODO: ./simple_tests//abi/ok_11.sd: abi testing - abi path quotes in <> with spaces # TODO Disabled testcase.
not ok 21 - TODO: ./simple_tests//abi/ok_12.sd: abi testing - abi path quotes in <> with spaces # TODO Disabled testcase.
not ok 131 - TODO: ./simple_tests//change_hat/old_style1.sd: Simple test of old-style hats # TODO Disabled testcase.
not ok 132 - TODO: ./simple_tests//change_hat/old_style2.sd: Simple test of old-style hats # TODO Disabled testcase.
not ok 133 - TODO: ./simple_tests//change_hat/old_style3.sd: Simple test of old-style hats # TODO Disabled testcase.
simple.pl .. 568/71726 not ok 728 - TODO: ./simple_tests//file/ok_bare_1.sd: bare file rule # TODO Unfixed testcase.
simple.pl .. 70908/71726 not ok 71034 - TODO: ./simple_tests//mount/bad_opt_27.sd: basic rule not allow unparen'ed fstypes # TODO Unfixed testcase.
simple.pl .. 71462/71726 not ok 71573 - TODO: ./simple_tests//vars/vars_profile_name_07.sd: profiles declared with the profile keyword can begin with var # TODO Unfixed testcase.
not ok 71574 - TODO: ./simple_tests//vars/vars_profile_name_08.sd: profiles declared with the profile keyword can begin with var # TODO Unfixed testcase.
not ok 71578 - TODO: ./simple_tests//vars/vars_profile_name_12.sd: profiles declared with the profile keyword can expand var and have var attachment # TODO Unfixed testcase.
not ok 71579 - TODO: ./simple_tests//vars/vars_profile_name_13.sd: reference variables that are the profile name and attachment # TODO Unfixed testcase.
not ok 71581 - TODO: ./simple_tests//vars/vars_profile_name_15.sd: profiles declared with the profile keyword can begin with var # TODO Unfixed testcase.
not ok 71588 - TODO: ./simple_tests//vars/vars_profile_name_22.sd: all attachment expansions must start with / # TODO Unfixed testcase.
simple.pl .. ok           
All tests successful.
Files=1, Tests=71726, 353 wallclock secs (10.01 usr  1.06 sys + 128.61 cusr 241.50 csys = 381.18 CPU)
Result: PASS

(4)安装 

运行make install命令进行安装。实际命令及结果如下所示:

$ sudo make install
which: no rpm in (/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc)
make install-indep
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/parser”
which: no rpm in (/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc)
make[2]: 进入目录“/home/penghao/AppArmor/apparmor/parser/po”
make[2]: 对“all”无需做任何事。make[2]: 离开目录“/home/penghao/AppArmor/apparmor/parser/po”
install -m 755 -d //etc/apparmor
install -m 644 parser.conf //etc/apparmor
install -m 755 -d //var/lib/apparmor
install -m 755 -d //lib/apparmor
install -m 755 rc.apparmor.functions //lib/apparmor
install -m 755 profile-load //lib/apparmor
make -C po install NAME=apparmor-parser DESTDIR=/
make[2]: 进入目录“/home/penghao/AppArmor/apparmor/parser/po”
mkdir -p ///usr/share/locale
for lang in  af  ar  bg  bn  bo  bs  ca  ce  cs  cy  da  de  el  en_AU  en_CA  en_GB  es  et  fa  fi  fr  gl  gu  he  hi  hr  hu  id  it  ja  ka  km  ko  lo  lt  mk  mr  ms  nb  nl  oc  pa  pl  pt_BR  pt  ro  ru  si  sk  sl  sq  sr  sv  ta  th  tr  ug  uk  vi  wa  xh  zh_CN  zh_TW  zu ; do \
        mkdir -p ///usr/share/locale/${lang}/LC_MESSAGES ; \
        install -m 644 ${lang}.mo ///usr/share/locale/${lang}/LC_MESSAGES/apparmor-parser.mo ; \
done
make[2]: 离开目录“/home/penghao/AppArmor/apparmor/parser/po”
make install_manpages DESTDIR=/
make[2]: 进入目录“/home/penghao/AppArmor/apparmor/parser”
which: no rpm in (/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc)
install -d ///usr/share/man/man5 ; install -m 644 apparmor.d.5 ///usr/share/man/man5;   install -d ///usr/share/man/man7 ; install -m 644 apparmor.7 apparmor_xattrs.7 ///usr/share/man/man7;   install -d ///usr/share/man/man8 ; install -m 644 apparmor_parser.8 aa-teardown.8 ///usr/share/man/man8; 
make[2]: 离开目录“/home/penghao/AppArmor/apparmor/parser”
make[1]: 离开目录“/home/penghao/AppArmor/apparmor/parser”
make install-arch
make[1]: 进入目录“/home/penghao/AppArmor/apparmor/parser”
which: no rpm in (/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc)
make -C libapparmor_re CFLAGS="-g -O2 -pipe -flto-partition=none -D_GNU_SOURCE -Wall -Wall -Wsign-compare -Wmissing-field-initializers -Wformat -Wformat-security -Wunused-parameter -Wimplicit-fallthrough -std=gnu++0x"
make[2]: 进入目录“/home/penghao/AppArmor/apparmor/parser/libapparmor_re”
make[2]: 对“all”无需做任何事。make[2]: 离开目录“/home/penghao/AppArmor/apparmor/parser/libapparmor_re”
install -m 755 -d //sbin
install -m 755 apparmor_parser //sbin
make[1]: 离开目录“/home/penghao/AppArmor/apparmor/parser”

至此,Parser就构建并安装完成了。