mesonbuild / mesonbuild/meson

[WinError 123] The filename, directory name, or volume label syntax is incorrect: '-DIMGUI_USER_CONFIG="C:\\Users\\rayga\\Projects\\reaimgui-cpp-meson-addon\\subprojects\\reaimgui-cpp-components\\src\\imconfig.h"'

Open
#8,528 1 comment 1 reaction 1 assignee View on GitHub

@mensinda is already working on this.

Since Sep 12, 2021.

module:cmake
Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

I don't understand much about C++, but all I am trying to do is write a program which calls a function from another file in a C++ project, and publish it as a .dll

In other languages, this would be generally something like:

import { ClassName } from "./subproject-or-published-package/filename.ext"
ClassName.doThing()

The project is CMake based. It includes some dependencies as git submodules (imgui and a few others), and suggested I use vcpkg to globally install boost-core boost-preprocessor boost-type-index gl3w.

So I have this structure:

├── build
│   ├── meson-info
│   ├── meson-logs
│   ├── meson-private
│   └── subprojects
│       └── reaimgui-cpp-components
├── cross.ini
├── meson.build
├── reaimgui_cpp_meson_addon.cpp
├── reaimgui_cpp_meson_addon.hpp
├── reaimgui_cpp_meson_addon_test.cpp
├── run.sh
└── subprojects
    └── reaimgui-cpp-components
        ├── CMakeLists.txt
        ├── compile_commands.json
        ├── src
        ├── tools
        ├── vendor
            ├── WDL
            ├── imgui
            ├── reaper-sdk
            ├── reaper_colortheme.h
            ├── reaper_plugin_secrets.h
            └── vcpkg-deps.txt

This is my current code:

project('reaimgui-cpp-meson-addon', 'cpp',
  version : '0.1',
  default_options : ['warning_level=3', 'cpp_std=c++17'],
)

lib_args = ['-DBUILDING_REAIMGUI_CPP_MESON_ADDON']

cmake = import('cmake')
reaimgui_cmake_options = cmake.subproject_options()
reaimgui_cmake_options.add_cmake_defines({
  'CMAKE_PREFIX_PATH': 'C:\\Users\\rayga\\projects\\vcpkg;',
  'EXPORT_COMPILE_COMMANDS': true,
})

# Configure the CMake project
sub_proj = cmake.subproject('reaimgui-cpp-components', options: reaimgui_cmake_options)
# Fetch the dependency object - This is the value from "project(PROJECT_NAME ....)" in CMake
reaimgui_lib = sub_proj.dependency('reaimgui', dependencies: [gl3w])

shared_lib = shared_library('reaimgui_cpp_meson_addon', 'reaimgui_cpp_meson_addon.cpp',
  install : true,
  cpp_args : lib_args,
  gnu_symbol_visibility : 'hidden',
)

test_exe = executable('reaimgui_cpp_meson_addon_test', 'reaimgui_cpp_meson_addon_test.cpp',
  link_with : shared_lib)
test('reaimgui_cpp_meson_addon', test_exe)

# Make this library usable as a Meson subproject.
reaimgui_cpp_meson_addon_dep = declare_dependency(
  include_directories: include_directories('.'),
  link_with : shared_lib)

# Make this library usable from the system's
# package manager.
install_headers('reaimgui_cpp_meson_addon.hpp', subdir : 'reaimgui_cpp_meson_addon')

pkg_mod = import('pkgconfig')
pkg_mod.generate(
  name : 'reaimgui-cpp-meson-addon',
  filebase : 'reaimgui_cpp_meson_addon',
  description : 'Meson sample project.',
  subdirs : 'reaimgui_cpp_meson_addon',
  libraries : shared_lib,
  version : '0.1',
)

However, it throws this error:

rayga@DESKTOP-88A51E5 MINGW64 ~/Projects/reaimgui-cpp-meson-addon
$  meson setup build --cross cross.ini 
The Meson build system
Version: 0.57.1
Source dir: C:\Users\rayga\Projects\reaimgui-cpp-meson-addon
Build dir: C:\Users\rayga\Projects\reaimgui-cpp-meson-addon\build
Build type: cross build
Project name: reaimgui-cpp-meson-addon
Project version: 0.1
C++ compiler for the host machine: c++ (gcc 8.1.0 "c++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0")
C++ linker for the host machine: c++ ld.bfd 2.30
C++ compiler for the build machine: c++ (gcc 8.1.0 "c++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0")
C++ linker for the build machine: c++ ld.bfd 2.30
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86_64
Host machine cpu: x86_64
Target machine cpu family: x86_64
Target machine cpu: x86_64
WARNING: Setting CMAKE_TOOLCHAIN_FILE is not supported. See the meson docs for cross compilation support:
WARNING:   - URL: https://mesonbuild.com/CMake-module.html#cross-compilation
WARNING:   --> Ignoring this option

|Executing subproject reaimgui-cpp-components method cmake
|
|Found CMake: C:\Program Files\CMake\bin\cmake.EXE (3.20.0)
|
||Configuring the build directory with CMake version 3.20.0
||Running CMake with: -G Ninja -DCMAKE_INSTALL_PREFIX=c:\ -DCMAKE_PREFIX_PATH=C:\Users\rayga\projects\vcpkg; -DEXPORT_COMPILE_COMMANDS=True
||  - build directory:          C:/Users/rayga/Projects/reaimgui-cpp-meson-addon/build/subprojects/reaimgui-cpp-components/__CMake_build
||  - source directory:         C:/Users/rayga/Projects/reaimgui-cpp-meson-addon/subprojects/reaimgui-cpp-components
||  - toolchain file:           C:/Users/rayga/Projects/reaimgui-cpp-meson-addon/build/subprojects/reaimgui-cpp-components/CMakeMesonToolchainFile.cmake
||  - preload file:             C:/Users/rayga/Projects/reaimgui-cpp-meson-addon/build/meson-private/data/preload.cmake
||  - trace args:               --trace-expand --trace-format=json-v1 --no-warn-unused-cli --trace-redirect=cmake_trace.txt
||  - disabled policy warnings: [CMP0025, CMP0047, CMP0056, CMP0060, CMP0065, CMP0066, CMP0067, CMP0082, CMP0089, CMP0102]
||
||Running with expanded trace output on.
||Not searching for unused variables given on the command line.
||Trace will be written to cmake_trace.txt
||Trace will be written to cmake_trace.txt
||-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
||-- Found Boost: C:/Users/rayga/Projects/vcpkg/installed/x64-windows-static/include (found version "1.75.0")  
||-- Found ImGui: C:/Users/rayga/Projects/reaimgui-cpp-meson-addon/subprojects/reaimgui-cpp-components/vendor/imgui (found version "1.81") 
||-- Looking for C++ include optional
||-- Looking for C++ include optional - found
||-- Configuring done
||-- Generating done
||-- Build files have been written to: C:/Users/rayga/Projects/reaimgui-cpp-meson-addon/build/subprojects/reaimgui-cpp-components/__CMake_build
|
|CMake configuration: SUCCEEDED
Traceback (most recent call last):
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\mesonmain.py", line 132, in run
    return options.run_func(options)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\msetup.py", line 275, in run
    app.generate()
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\msetup.py", line 183, in generate
    self._generate(env)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\msetup.py", line 222, in _generate
    intr.run()
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreter.py", line 4798, in run
    super().run()
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 641, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 666, in evaluate_codeblock
    raise e
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 659, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 674, in evaluate_statement
    self.assignment(cur)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 1341, in assignment
    value = self.evaluate_statement(node.value)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 676, in evaluate_statement
    return self.method_call(cur)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 1073, in method_call
    return obj.method_call(method_name, args, kwargs)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreter.py", line 1840, in method_call
    value = fn(self.interpreter, state, args, kwargs)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 423, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 515, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 515, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 229, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 198, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\modules\cmake.py", line 389, in subproject
    subp = interpreter.do_subproject(dirname, 'cmake', kwargs)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreter.py", line 2969, in do_subproject
    raise e
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreter.py", line 2955, in do_subproject
    return self._do_subproject_cmake(subp_name, subdir, subdir_abs, default_options, kwargs)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreter.py", line 3026, in _do_subproject_cmake
    cm_int.analyse()
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\cmake\interpreter.py", line 1041, in analyse
    tgt.postprocess(self.output_target_map, self.src_dir, self.subdir, self.install_prefix, self.trace)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\cmake\interpreter.py", line 312, in postprocess
    ctgt = output_target_map.generated(Path(j))
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\cmake\interpreter.py", line 184, in generated
    res = self._return_first_valid_key([self._rel_generated_file_key(name), self._base_generated_file_key(name)])
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\cmake\interpreter.py", line 200, in _rel_generated_file_key
    path = self._rel_path(fname)
  File "C:\Users\rayga\AppData\Roaming\Python\Python38\site-packages\mesonbuild\cmake\interpreter.py", line 191, in _rel_path
    return fname.resolve().relative_to(self.build_dir)
  File "c:\programdata\miniconda3\lib\pathlib.py", line 1177, in resolve
    s = self._flavour.resolve(self, strict=strict)
  File "c:\programdata\miniconda3\lib\pathlib.py", line 205, in resolve
    s = self._ext_to_normal(_getfinalpathname(s))
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '-DIMGUI_USER_CONFIG="C:\\Users\\rayga\\Projects\\reaimgui-cpp-meson-addon\\subprojects\\reaimgui-cpp-components\\src\\imconfig.h"'

This is really hard. I've been trying to import one function in C++ for 8 hours and have tried a bunch of build systems =(

Would be grateful for help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.