fuse的github及介绍
meson;ninja
wget + tar 得到fuse源代码(我下载的是3.10.5),发现没有自己熟悉的configure、makefile,傻眼了
一度以为自己下载的压缩包有问题,是不是贡献者忘了??(无比自信的我)
对比了几版之后,我发现meson.build这个小东西
meson 提供一种支持并行的编译环境,把他当成makefile的替代品就可以了;至于ninja,在这里是meson的默认后端 。
可惜的是,我在meson官网并没有检索到Linux相关的东西,只讲了window环境下的安装和配置
sudo apt-get install python3 python3-pip ninja-build
whereis ninja
ninja: /usr/bin/ninja /usr/share/man/man1/ninja.1.gz
sudo pip3 install meson
meson -h
usage: meson [-h] {
setup,configure,dist,install,introspect,init,test,wrap,subprojects,help,rewrite,compile,devenv} ...
......//关于options的具体含义,略
编译安装fuse
- 新建一个临时build目录
dafei@ubuntu:~/kcode/fuse-3.10.5$ cd build
dafei@ubuntu:~/kcode/fuse-3.10.5/build$ meson ..
The Meson build system
Version: 0.60.1
Source dir: /home/dafei/mypath/fuse-3.10.5
Build dir: /home/dafei/mypath/fuse-3.10.5/build
Build type: native build
Project name: libfuse3
Project version: 3.10.5
C compiler for the host machine: cc (gcc 4.4.7 "cc (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7")
C linker for the host machine: cc ld.bfd 2.34
Host machine cpu family: x86_64
Host machine cpu: x86_64
meson好强,dotdot就把我的底牌搞清楚了
- 根据README的提示,我们可以用mesonconf命令修改编译选项
mesonconf #list options
mesonconf -D disable-mtab=true # set an option
//第一次使用啥也不敢动,就用mesonconf感受感受
//but,它显示command not found
apt-get install meson //无果
结果还是 mesonconf:command not found
我比较了mesonconf和meson configure的具体含义,目前来看是等价的,或许是meson升级了呢
- 接下来是使用ninja(编译安装libfuse)
dafei@ubuntu:~/kcode/fuse-3.10.5/build$ ls
build.ninja config.h example lib meson-logs meson-uninstalled util
compile_commands.json doc include meson-info meson-private test
ninja
//报错
FAILED: example/passthrough_hp.p/passthrough_hp.cc.o
c++ -Iexample/passthrough_hp.p -Iexample -I../example -Iinclude -I../include -Ilib -I../lib -I. -I.. -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++0x -O2 -g -D_REENTRANT -DHAVE_CONFIG_H -D_GNU_SOURCE -Wno-sign-compare -Wmissing-declarations -Wwrite-strings -fno-strict-aliasing -pthread -MD -MQ example/passthrough_hp.p/passthrough_hp.cc.o -MF example/passthrough_hp.p/passthrough_hp.cc.o.d -o example/passthrough_hp.p/passthrough_hp.cc.o -c ../example/passthrough_hp.cc
发现可能是gcc版本的问题,我用的是4.4版本的,还是之前为了编译内核特地下的低版本的gcc。本地最新版本的也就是gcc-9了,不是很想搞,幸好还有一种方法:patch
在https://github.com/koba-e964/libfuse/tree/fix-initializer-list中对example/passthrough.cc打个补丁
不管用,还是update-alternatives把g++版本调至g++ - 9,这里源代码已经打过补丁了(没试过无patch会怎样)