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

ninjabackend: detect_vs_dep_prefix doesn't correctly handle clang-cl cross compilation. #5639

Closed
dalecurtis opened this issue Jul 11, 2019 · 3 comments

Comments

@dalecurtis
Copy link

dalecurtis commented Jul 11, 2019

Traceback (most recent call last):
  File "/d/code/meson/mesonbuild/mesonmain.py", line 127, in run
    return options.run_func(options)
  File "/d/code/meson/mesonbuild/msetup.py", line 240, in run
    app.generate()
  File "/d/code/meson/mesonbuild/msetup.py", line 158, in generate
    self._generate(env)
  File "/d/code/meson/mesonbuild/msetup.py", line 210, in _generate
    intr.backend.generate(intr)
  File "/d/code/meson/mesonbuild/backend/ninjabackend.py", line 292, in generate
    with self.detect_vs_dep_prefix(tempfilename) as outfile:
  File "/d/code/meson/mesonbuild/backend/ninjabackend.py", line 254, in detect_vs_dep_prefix
    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1258, in _execute_child
    executable = os.fsencode(executable)
  File "/usr/lib/python3.6/os.py", line 800, in fsencode
    filename = fspath(filename)  # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not list

Fixing this by changing:
pc = subprocess.Popen([compiler.get_exelist(),
to:
pc = subprocess.Popen([compiler.get_exelist()[0],

Resolves that issue, but then the regex used to figure out the prefix is wrong on Linux. I.e., it doesn't handle paths like:
b'Note: including file: /d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/418b3076791776573a815eb298c8aa590307af63/win_sdk/Include/10.0.18362.0/ucrt/stdio.h'

ERROR: Could not determine vs dep dependency prefix string.

This can be resolved by changing the regex from:
matchre = re.compile(rb"^(.*\s)[a-zA-Z]:\\.*stdio.h$")
to:
matchre = re.compile(rb"^(.*\s)([a-zA-Z]:\\|\/).*stdio.h$")

@xparq
Copy link

xparq commented Aug 1, 2019

I'm new to meson, just started trying it, and immediately got stuck with the

ERROR: Could not determine vs dep dependency prefix string.

issue, without doing any cross-compilation or anything nontrivial. Unfortunately, I can't tell if my case is related at all; Google sent me here, when looking for this error message, FWIW.

@barcharcraz
Copy link
Contributor

I got this with just MSVC, and not clang-cl.

This caused failure to compiler glib from source for me.

@wolenetz
Copy link

wolenetz commented Feb 6, 2020

In meson v0.53.1 The "Could not determine vs dep dependency prefix string." portion of the problem still exists, and can be resolved using the updated matchre in OP, above (#5639 (comment))

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

No branches or pull requests

4 participants