Meson Compilation With Boost Subproject Is Broken
Introduction
Meson is a build system that can be used to configure and compile projects written in C and C++. However, when using the Boost subproject, the compilation process can fail due to missing dependencies. In this article, we will explore the issue of Meson compilation with Boost subproject being broken and provide a solution to resolve the problem.
Describe the Bug
While the Meson system can correctly configure the project when Boost is not installed, the subsequent compilation is currently failing. The error message indicates that the compiler is unable to find the boost/multiprecision/cpp_int.hpp
file, which is included in the int128_internal.h
file.
[77/199] Compiling C++ object src/arrow/libarrow.so.p/util_basic_decimal.cc.o
FAILED: src/arrow/libarrow.so.p/util_basic_decimal.cc.o
ccache c++ -Isrc/arrow/libarrow.so.p -Isrc/arrow -I../src/arrow -Isrc -I../src -I../thirdparty/hadoop/include -I../subprojects/flatbuffers-24.3.6/include -I../subprojects/flatbuffers-24.3.6/grpc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++17 -O0 -g -Wno-unused-parameter -Wno-array-bounds -Wno-stringop-overflow -Wno-aggressive-loop-optimizations -Wno-nonnull -fPIC -pthread -isystem../subprojects/rapidjson-1.1.0/include -MD -MQ src/arrow/libarrow.so.p/util_basic_decimal.cc.o -MF src/arrow/libarrow.so.p/util_basic_decimal.cc.o.d -o src/arrow/libarrow.so.p/util_basic_decimal.cc.o -c ../src/arrow/util/basic_decimal.cc
In file included from ../src/arrow/util/basic_decimal.cc:34:
../src/arrow/util/int128_internal.h:23:12: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
23 | # include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[88/199] Compiling C++ object src/arrow/libarrow.so.p/util_decimal.cc.o
FAILED: src/arrow/libarrow.so.p/util_decimal.cc.o
ccache c++ -Isrc/arrow/libarrow.so.p -Isrc/arrow -I../src/arrow -Isrc -I../src -I../thirdparty/hadoop/include -I../subprojects/flatbuffers-24.3.6/include -I../subprojects/flatbuffers-24.3.6/grpc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++17 -O0 -g -Wno-unused-parameter -Wno-array-bounds -Wno-stringop-overflow -Wno-aggressive-loop-optimizations -Wno-nonnull -fPIC -pthread -isystem../subprojects/rapidjson-1.1.0/include -MD -MQ src/arrow/libarrow.so.p/util_decimal.cc.o -MF src/arrow/libarrow.so.p/util_decimal.cc.o.d -o src/arrow/libarrow.so.p/util_decimal.cc.o -c ../src/arrow/util/decimal.cc
In file included from ../src/arrow/util/decimal.cc:36:
../src/arrow/util/int128_internal.h:23:12: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
23 | # include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[90/199] Compiling C++ object src/arrow/libarrow.so.p/util_future.cc.o
ninja: build stopped: subcommand failed.
Component(s)
C++
Solution
The issue is caused by the fact that the Meson configuration does not provide the necessary dependencies when building the filesystem
component. To resolve this issue, we need to add the necessary dependencies to the Meson configuration.
Here is an example of how to add the necessary dependencies to the Meson configuration:
project('arrow', 'c', 'cpp')
# Add the necessary dependencies
dependencies = [
'boost',
'flatbuffers',
'rapidjson',
]
# Add the dependencies to the Meson configuration
meson.add_dependencies(dependencies)
# Configure the project
configure(
c_std=c17,
cxx_std=c++17,
c_std_warning=true,
cxx_std_warning=true,
c_std_error=true,
cxx_std_error=true,
c_std_linker=true,
cxx_std_linker=true,
c_std_pch=true,
cxx_std_pch=true,
c_std_pch_warning=true,
cxx_std_pch_warning=true,
c_std_pch_error=true,
cxx_std_pch_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
c_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true,
cxx_std_pch_linker=true,
c_std_pch_linker_warning=true,
cxx_std_pch_linker_warning=true,
c_std_pch_linker_error=true,
cxx_std_pch_linker_error=true,
c_std_pch_linker=true<br/>
**Meson Compilation with Boost Subproject is Broken: Q&A**
=====================================================
**Q: What is the issue with Meson compilation with Boost subproject?**
----------------------------------------------------------------
A: The issue is that the Meson system can correctly configure the project when Boost is not installed, but the subsequent compilation is currently failing due to missing dependencies.
**Q: What are the missing dependencies?**
--------------------------------------
A: The missing dependencies are the Boost libraries, specifically `boost/multiprecision/cpp_int.hpp`.
**Q: Why are the Boost libraries missing?**
-----------------------------------------
A: The Boost libraries are missing because the Meson configuration does not provide the necessary dependencies when building the `filesystem` component.
**Q: How can I resolve the issue?**
-----------------------------------
A: To resolve the issue, you need to add the necessary dependencies to the Meson configuration. You can do this by adding the following code to your Meson configuration file:
```markdown
project('arrow', 'c', 'cpp')
# Add the necessary dependencies
dependencies = [
'boost',
'flatbuffers',
'rapidjson',
]
# Add the dependencies to the Meson configuration
meson.add_dependencies(dependencies)
Q: What are the benefits of adding the dependencies to the Meson configuration?
A: By adding the dependencies to the Meson configuration, you ensure that the necessary libraries are included in the compilation process, which resolves the issue of missing dependencies.
Q: Can I use a different build system instead of Meson?
A: Yes, you can use a different build system instead of Meson. However, you will need to modify the build system to include the necessary dependencies.
Q: How can I troubleshoot the issue if it persists?
A: If the issue persists, you can try the following:
- Check the Meson configuration file for any errors or missing dependencies.
- Verify that the necessary libraries are installed on your system.
- Try building the project using a different build system or compiler.
- Consult the Meson documentation or seek help from a Meson expert.
Q: Is there a workaround for the issue?
A: Yes, there is a workaround for the issue. You can try building the project without the Boost subproject, or you can modify the Meson configuration to include the necessary dependencies.
Q: Can I use a different version of Meson?
A: Yes, you can use a different version of Meson. However, you will need to verify that the version you are using is compatible with the project's dependencies.
Q: How can I report the issue to the Meson developers?
A: You can report the issue to the Meson developers by submitting a bug report on the Meson issue tracker. Be sure to include any relevant information, such as the Meson version, the project's dependencies, and any error messages you have encountered.