最近在做一个跟文件系统的有关的项目,需要用到 libfuse。记录下 libfuse 的编译笔记:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| # clone
# 安装依赖于工具链
apt install meson ninja-build gcc pkg-config
#
mkdir build & cd build
# 编译
meson ..
ninja
sudo ninja install
|
编译 example
1
2
3
4
5
6
7
8
9
| $gcc -Wall passthrough_fh.c `pkg-config fuse3 --cflags --libs` -lulockmgr -o passthrough_fh
Package fuse3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `fuse3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fuse3' found
passthrough_fh.c:34:10: fatal error: fuse.h: No such file or directory
34 | #include <fuse.h>
| ^~~~~~~~
compilation terminated.
|
解决方法
1
| $cp meson-private/fuse3.pc /usr/lib/pkgconfig
|
1
2
3
| $gcc -Wall passthrough_fh.c `pkg-config fuse3 --cflags --libs` -lulockmgr -o passthrough_fh
/usr/bin/ld: cannot find -lulockmgr
collect2: error: ld returned 1 exit status
|