在编译 xlswriter 插件时(PECL 组件)遇到了以下提示。
这个提示是「警告」,忽略其实也能正常编译。但是没有警告才能保证全部功能工作正常。
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
起
Re2c 是一个免费、开源的 C语言 和 C++语言 生成器。它的主要目标是生成快速的语法分析器,此语法分析器的匹配速度或超过精心优化的手写代码的速度。
Re2c is a free and open-source lexer generator for C and C++. Its main goal is to generate fast lexers that match or exceed the speed of carefully optimized hand-written code. Re2c uses direct encoding of finite-state machines instead of the table-driven approach, and optimizes the generated code.
其官方 Github 仓库,官方 SourceForge 仓库(可能有版本提交速率差异),建议使用 Github 仓库。
源码
$ wget https://github.com/skvadrik/re2c/releases/download/1.3/re2c-1.3.tar.xz
解压
$ xz -d re2c-1.3.tar.xz && tar xf re2c-1.3.tar
编译
$ ./configure && make && make install
注意:不同的发行版要安装基础编译依赖,红帽系dnf group install 'Development Tools'
,Debian 系apt install build-essential
终
使用 re2c 的程序即可正常编译。比如 PHP 插件 xlswriter 。
附录
完整过程
# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
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 we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for bison... /usr/bin/bison
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking dependency style of g++... (cached) gcc3
checking C++ compiler flag -std=c++98... yes
checking C++ compiler flag -W... yes
checking C++ compiler flag -Wall... yes
checking C++ compiler flag -Wextra... yes
checking C++ compiler flag -Weffc++... yes
checking C++ compiler flag -pedantic... yes
checking C++ compiler flag -Wformat=2... yes
checking C++ compiler flag -Wredundant-decls... yes
checking C++ compiler flag -Wsuggest-attribute=format... yes
checking C++ compiler flag -Wconversion... yes
checking C++ compiler flag -Wsign-conversion... yes
checking C++ compiler flag -Werror=return-type... yes
checking C++ compiler flag -O2... yes
checking C++ compiler flag -Weverything... no
checking for stdint.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for io.h... no
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of __int64... 0
checking size of void *... 8
checking size of 0l... 8
checking size of 0ll... 8
checking size of 0i8... 0
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
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 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
checking for mt... no
checking if : is a manifest tool... no
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... no
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 -m elf_x86_64) 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 for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... yes
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 how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/manpage.rst
config.status: creating doc/help.rst
config.status: creating run_tests.sh
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
# make
GEN src/msg/help.cc
GEN src/parse/parser.cc
GEN src/parse/lex.cc
GEN src/parse/lex_conf.cc
GEN src/options/parse_opts.cc
make all-am
make[1]: Entering directory '/usr/local/src/re2c-1.3'
CXX src/main.o
CXX src/codegen/bitmap.o
CXX src/codegen/emit_action.o
CXX src/codegen/emit_dfa.o
CXX src/codegen/label.o
CXX src/codegen/go_construct.o
CXX src/codegen/go_destruct.o
CXX src/codegen/go_emit.o
CXX src/codegen/go_used_labels.o
CXX src/codegen/input_api.o
CXX src/codegen/output.o
CXX src/codegen/print.o
CXX src/options/opt.o
CXX src/nfa/estimate_size.o
CXX src/nfa/re_to_nfa.o
CXX src/adfa/adfa.o
CXX src/adfa/prepare.o
CXX src/debug/dump_adfa.o
CXX src/debug/dump_cfg.o
CXX src/debug/dump_dfa.o
CXX src/debug/dump_interf.o
CXX src/debug/dump_nfa.o
CXX src/cfg/cfg.o
CXX src/cfg/compact.o
CXX src/cfg/dce.o
CXX src/cfg/freeze.o
CXX src/cfg/interfere.o
CXX src/cfg/liveanal.o
CXX src/cfg/normalize.o
CXX src/cfg/optimize.o
CXX src/cfg/rename.o
CXX src/cfg/varalloc.o
CXX src/dfa/closure.o
CXX src/dfa/dead_rules.o
CXX src/dfa/determinization.o
CXX src/dfa/fallback_tags.o
CXX src/dfa/fillpoints.o
CXX src/dfa/find_state.o
CXX src/dfa/minimization.o
CXX src/dfa/stacmd.o
CXX src/dfa/tagver_table.o
CXX src/dfa/tcmd.o
CXX src/encoding/ebcdic/ebcdic_regexp.o
CXX src/encoding/enc.o
CXX src/encoding/range_suffix.o
CXX src/encoding/utf8/utf8_regexp.o
CXX src/encoding/utf8/utf8.o
CXX src/encoding/utf16/utf16_regexp.o
CXX src/encoding/utf16/utf16.o
CXX src/msg/msg.o
CXX src/msg/warn.o
CXX src/regexp/ast_to_re.o
CXX src/regexp/default_tags.o
CXX src/regexp/fixed_tags.o
CXX src/regexp/nullable.o
CXX src/regexp/rule.o
CXX src/regexp/split_charset.o
CXX src/regexp/tag.o
CXX src/compile.o
CXX src/skeleton/control_flow.o
CXX src/skeleton/generate_code.o
CXX src/skeleton/generate_data.o
CXX src/skeleton/maxpath.o
CXX src/skeleton/skeleton.o
CXX src/parse/ast.o
CXX src/parse/input.o
CXX src/parse/normalize.o
CXX src/parse/scanner.o
CXX src/parse/unescape.o
CXX src/parse/validate.o
CXX src/util/get_dir.o
CXX src/util/s_to_n32_unsafe.o
CXX src/util/temp_file.o
CXX src/util/range.o
CXX src/msg/help.o
CXX src/parse/lex.o
CXX src/parse/parser.o
CXX src/msg/ver_to_vernum.o
CXX src/parse/lex_conf.o
CXX src/options/parse_opts.o
CXXLD re2c
GEN doc/re2c.1
Reconfigure to rebuild docs: ./configure --enable-docs
make[1]: Leaving directory '/usr/local/src/re2c-1.3'
参考链接
本文由 柒 创作,采用 知识共享署名4.0
国际许可协议进行许可。
转载本站文章前请注明出处,文章作者保留所有权限。
最后编辑时间: 2020-07-07 12:23 PM