I'm following the instructions described in https://mesonbuild.com/IndepthTutorial.html to build a library Having created the necessary directories and filled with appropriate files. I encounter difficulty when executing "$ meson compile". The following is a console output of the progress.
[~/tmp/sample_lib_prj]
$ tree --dirsfirst
.
├── include
│ ├── foolib.hpp
│ └── meson.build
├── src
│ ├── meson.build
│ ├── source1.cpp
│ └── source2.cpp
├── test
│ ├── footest.cpp
│ └── meson.build
└── meson.build
[~/tmp/sample_lib_prj]
$ meson builddir && cd builddir
The Meson build system
Version: 0.53.2
Source dir: /home/user/tmp/sample_lib_prj
Build dir: /home/user/tmp/sample_lib_prj/builddir
Build type: native build
Project name: sample_lib_prj
Project version: 0.1
C++ compiler for the host machine: c++ (gcc 9.3.0 "c++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0")
C++ linker for the host machine: c++ ld.bfd 2.34
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Run-time dependency glib-2.0 found: YES 2.64.6
Build targets in project: 2
Found ninja-1.10.0 at /usr/bin/ninja
[~/tmp/sample_lib_prj/builddir]
$ tree --dirsfirst
.
├── include
├── meson-info
│ ├── intro-benchmarks.json
│ ├── intro-buildoptions.json
│ ├── intro-buildsystem_files.json
│ ├── intro-dependencies.json
│ ├── intro-installed.json
│ ├── intro-projectinfo.json
│ ├── intro-targets.json
│ ├── intro-tests.json
│ └── meson-info.json
├── meson-logs
│ └── meson-log.txt
├── meson-private
│ ├── build.dat
│ ├── cmd_line.txt
│ ├── coredata.dat
│ ├── foobar.pc
│ ├── install.dat
│ ├── meson_benchmark_setup.dat
│ ├── meson.lock
│ ├── meson_test_setup.dat
│ ├── sanitycheckcpp.cc
│ └── sanitycheckcpp.exe
├── src
├── test
├── build.ninja
└── compile_commands.json
6 directories, 22 files
[~/tmp/sample_lib_prj/builddir]
$ meson compile
ERROR: Neither directory contains a build file meson.build.
With the current version of meson (0.62.1) you can compile your project the way you first tried: going into the build directory and running meson $ cd builddir
then $ meson compile
.
Alternatively you can compile the project by remaining on the source root directory and run $ meson compile -C builddir
. The -C
flag is used to specify a directory to cd into before running a command.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.