Ubuntu安装re2c和ninja

老板带的本科生要做cuda编程。。。

我裂开了,现在本科生都这么秀了?都会cuda编程了?我pytorch还没用明白呢

 

结果说ninja用不了。。。服务器上没有。。。

用不了你装啊!

不敢。。。

 

软件都不敢装,你还想做cuda编程??

声音这么小,还敢开军舰??

 

结果

 

好家伙,直接把老板搬出来了,工具人竟是我自己。。。

 

装ninja之前,需要先装re2c

参考 CentOS 7 安装 re2c 和 ninja

git clone https://github.com/skvadrik/re2c.git re2c
cd re2c
mkdir -p m4
./autogen.sh && ./configure --prefix=/usr && make

结果出现

configure.ac:18: installing 'build-aux/compile'
configure.ac:3: installing 'build-aux/install-sh'
configure.ac:3: installing 'build-aux/missing'
Makefile.am:458: error: Libtool library used but 'LIBTOOL' is undefined
Makefile.am:458:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
Makefile.am:458:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
Makefile.am:458:   If 'LT_INIT' is in 'configure.ac', make sure
Makefile.am:458:   its definition is in aclocal's search path.
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
autoreconf: automake failed with exit status: 1

所以。。。大概是LIBTOOL有问题

先装一下libtool

sudo apt-get install libtool

再次执行

./autogen.sh && ./configure --prefix=/usr && make

这次正常了(这段可以不看)

正删除 aclocal.m4
正删除 config.h.in
正删除 configure
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/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'
configure.ac:177: installing 'build-aux/config.guess'
configure.ac:177: installing 'build-aux/config.sub'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /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 for style of include used by make... GNU
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... /bin/grep
checking for egrep... /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... no
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... /bin/sed
checking for fgrep... /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... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt 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... 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 -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... no
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... yes
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 benchmarks/submatch_nfa/Makefile
config.status: creating benchmarks/submatch_dfa_aot/Makefile
config.status: creating benchmarks/submatch_dfa_jit/Makefile
config.status: creating doc/manpage.rst
config.status: creating doc/help.rst
config.status: creating run_tests.sh
config.status: creating benchmarks/submatch_dfa_aot/run.py
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
  GEN      src/msg/help.cc
  GEN      src/parse/parser.cc
  GEN      src/parse/lex.cc
Reconfigure with --enable-lexers to regenerate src/parse/lex.cc
  GEN      src/msg/ver_to_vernum.cc
Reconfigure with --enable-lexers to regenerate src/msg/ver_to_vernum.cc
  GEN      src/parse/lex_conf.cc
Reconfigure with --enable-lexers to regenerate src/parse/lex_conf.cc
  GEN      src/options/parse_opts.cc
Reconfigure with --enable-lexers to regenerate src/options/parse_opts.cc
make  all-recursive
make[1]: 进入目录“/home/wangshuoyuan/re2c”
Making all in .
make[2]: 进入目录“/home/wangshuoyuan/re2c”
  CXX      src/main.o
  CXX      src/codegen/code_goto.o
  CXX      src/codegen/combine.o
  CXX      src/codegen/gen_bitmaps.o
  CXX      src/codegen/gen_delayed.o
  CXX      src/codegen/gen_dfa.o
  CXX      src/codegen/gen_goto.o
  CXX      src/codegen/gen_program.o
  CXX      src/codegen/gen_state.o
  CXX      src/codegen/helpers.o
  CXX      src/codegen/render.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_dfa_tree.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
  CXX      src/re2go-main.o
  CXX      src/codegen/re2go-code_goto.o
  CXX      src/codegen/re2go-combine.o
  CXX      src/codegen/re2go-gen_bitmaps.o
  CXX      src/codegen/re2go-gen_delayed.o
  CXX      src/codegen/re2go-gen_dfa.o
  CXX      src/codegen/re2go-gen_goto.o
  CXX      src/codegen/re2go-gen_program.o
  CXX      src/codegen/re2go-gen_state.o
  CXX      src/codegen/re2go-helpers.o
  CXX      src/codegen/re2go-render.o
  CXX      src/options/re2go-opt.o
  CXX      src/nfa/re2go-estimate_size.o
  CXX      src/nfa/re2go-re_to_nfa.o
  CXX      src/adfa/re2go-adfa.o
  CXX      src/adfa/re2go-prepare.o
  CXX      src/debug/re2go-dump_adfa.o
  CXX      src/debug/re2go-dump_cfg.o
  CXX      src/debug/re2go-dump_dfa.o
  CXX      src/debug/re2go-dump_dfa_tree.o
  CXX      src/debug/re2go-dump_interf.o
  CXX      src/debug/re2go-dump_nfa.o
  CXX      src/cfg/re2go-cfg.o
  CXX      src/cfg/re2go-compact.o
  CXX      src/cfg/re2go-dce.o
  CXX      src/cfg/re2go-freeze.o
  CXX      src/cfg/re2go-interfere.o
  CXX      src/cfg/re2go-liveanal.o
  CXX      src/cfg/re2go-normalize.o
  CXX      src/cfg/re2go-optimize.o
  CXX      src/cfg/re2go-rename.o
  CXX      src/cfg/re2go-varalloc.o
  CXX      src/dfa/re2go-closure.o
  CXX      src/dfa/re2go-dead_rules.o
  CXX      src/dfa/re2go-determinization.o
  CXX      src/dfa/re2go-fallback_tags.o
  CXX      src/dfa/re2go-fillpoints.o
  CXX      src/dfa/re2go-find_state.o
  CXX      src/dfa/re2go-minimization.o
  CXX      src/dfa/re2go-stacmd.o
  CXX      src/dfa/re2go-tagver_table.o
  CXX      src/dfa/re2go-tcmd.o
  CXX      src/encoding/ebcdic/re2go-ebcdic_regexp.o
  CXX      src/encoding/re2go-enc.o
  CXX      src/encoding/re2go-range_suffix.o
  CXX      src/encoding/utf8/re2go-utf8_regexp.o
  CXX      src/encoding/utf8/re2go-utf8.o
  CXX      src/encoding/utf16/re2go-utf16_regexp.o
  CXX      src/encoding/utf16/re2go-utf16.o
  CXX      src/msg/re2go-msg.o
  CXX      src/msg/re2go-warn.o
  CXX      src/regexp/re2go-ast_to_re.o
  CXX      src/regexp/re2go-default_tags.o
  CXX      src/regexp/re2go-fixed_tags.o
  CXX      src/regexp/re2go-nullable.o
  CXX      src/regexp/re2go-rule.o
  CXX      src/regexp/re2go-split_charset.o
  CXX      src/regexp/re2go-tag.o
  CXX      src/re2go-compile.o
  CXX      src/skeleton/re2go-control_flow.o
  CXX      src/skeleton/re2go-generate_code.o
  CXX      src/skeleton/re2go-generate_data.o
  CXX      src/skeleton/re2go-maxpath.o
  CXX      src/skeleton/re2go-skeleton.o
  CXX      src/parse/re2go-ast.o
  CXX      src/parse/re2go-input.o
  CXX      src/parse/re2go-normalize.o
  CXX      src/parse/re2go-scanner.o
  CXX      src/parse/re2go-unescape.o
  CXX      src/parse/re2go-validate.o
  CXX      src/util/re2go-get_dir.o
  CXX      src/util/re2go-s_to_n32_unsafe.o
  CXX      src/util/re2go-temp_file.o
  CXX      src/util/re2go-range.o
  CXX      src/msg/re2go-help.o
  CXX      src/parse/re2go-lex.o
  CXX      src/parse/re2go-parser.o
  CXX      src/msg/re2go-ver_to_vernum.o
  CXX      src/parse/re2go-lex_conf.o
  CXX      src/options/re2go-parse_opts.o
  CXXLD    re2go
  GEN      doc/re2c.1
  GEN      doc/re2go.1
Reconfigure with --enable-docs to rebuild docs
make[2]: 离开目录“/home/wangshuoyuan/re2c”
make[1]: 离开目录“/home/wangshuoyuan/re2c”

接下来

sudo make install

安装结束后检查一下

re2c -v

显示

re2c 2.1.1

好的,re2c就安装成功了

官方安装文档:http://re2c.org/install/install.html

 

接下来是ninja

参考 使用 Ninja 代替 make

git clone git://github.com/ninja-build/ninja.git && cd ninja
./configure.py --bootstrap

显示

bootstrapping ninja...
wrote build.ninja.
bootstrap complete.  rebuilding...
[31/31] LINK ninja

上述命令会在当前目录下生成一个叫 ninja (Windows 下是 ninja.exe)的可执行文件,然后我们把这个文件拷到系统目录(比如 /usr/bin)就完成安装了。

将ninja文件复制到/usr/bin/

cp ninja /usr/bin/

输入

ninja --version

显示

1.10.2

安装成功了

 

安装过程中还参考了 Linux 18.04 非root 安装re2c和ninja

  • 5
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值