Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure meson's prefix is a valid absolute path #17206

Open
wants to merge 1 commit into
base: develop2
Choose a base branch
from

Conversation

shoeffner
Copy link
Contributor

The path / is not considered an absolute path on Windows, failing with:

ERROR: prefix value '/' must be an absolute path

os.path.abspath ensures that "/" becomes a valid absolute path on all major platforms, resolving to "/" on Linux and macOS, and to "C:\" (or whichever filesystem is currently active, could be E:\ as well) on Windows.

Closes #17204.

Changelog: (Bugfix): Use a valid prefix path for meson.configure() on Windows.
Docs: n/a

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code. -> No, line length is longer than 80 or such
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one. -> No

The path / is not considered an absolute path on Windows, failing with:

    ERROR: prefix value '/' must be an absolute path

os.path.abspath ensures that "/" becomes a valid absolute path on all major
platforms, resolving to "/" on Linux and macOS, and to "C:\" (or whichever
filesystem is currently active, could be E:\ as well) on Windows.

Closes conan-io#17204.
@memsharded
Copy link
Member

Thanks for your contribution!

This PR is failing in Windows with:

myhello  undefined
E           
E             User defined options
E               Native files: C:\J\t_v2\9ed6\PY38\tmp_gcx6x3iconans\path with spaces\build-release\conan\conan_meson_native.ini
E               prefix      : C:\
E           
E           Found ninja-1.8.2 at "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.EXE"
E           
E           conanfile.py (demo/0.1): Meson build cmd: meson compile -C "C:\J\t_v2\9ed6\PY38\tmp_gcx6x3iconans\path with spaces\build-release" -j16
E           conanfile.py (demo/0.1): RUN: meson compile -C "C:\J\t_v2\9ed6\PY38\tmp_gcx6x3iconans\path with spaces\build-release" -j16
E           conanvcvars.bat: Activating environment Visual Studio 15 - amd64 - winsdk_version=None - vcvars_ver=14.1
E           [vcvarsall.bat] Environment initialized for: 'x64'
E           [1/2] Compiling C object myhello.exe.p/src_main.c.obj
E           FAILED: myhello.exe.p/src_main.c.obj 
E           "cl" "-Imyhello.exe.p" "-I." "-I.." "-DNDEBUG" "/MD" "/nologo" "/showIncludes" "/utf-8" "/W2" "/O2" "/Gw" "/Fdmyhello.exe.p\src_main.c.pdb" /Fomyhello.exe.p/src_main.c.obj "/c" ../src/main.c
E           .\config.h(8): error C2001: newline in constant
E           ninja: build stopped: subcommand failed.
E           INFO: autodetecting backend as ninja

It is possible that the os.path.abspath result needs to be back to forward slash for Meson to process it?

@shoeffner
Copy link
Contributor Author

Thanks for the logs! I don't think it's the \ vs / since the native files also use backslashes – and I was able to build inih (see our discussion in #17204) with this change.

I will try to get the full test suite up and running on our build machine and see if I can reproduce and fix the issue.

@memsharded
Copy link
Member

I will try to get the full test suite up and running on our build machine and see if I can reproduce and fix the issue.

Probably not worth the effort. The full suite, specially the functional tests, have tons of tools to configure in conftest and conftest_user.py. You are probably good with running just a small subset. The test failing is test_meson_using_prefix_path_in_application, probably running tests in functional/toolchain/meson is more than enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] src\meson.build:1:0: ERROR: prefix value '/' must be an absolute path
2 participants