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

external_project: workaround for MinGW #13886

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MihailJP
Copy link

@MihailJP MihailJP commented Nov 9, 2024

On Python 3.12, self.prefix.relative_to(self.prefix.drive) no longer works and raises error like:

ValueError: 'C:/msys64/mingw64' is not in the subpath of 'C:'

Traceback (most recent call last):
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/mesonmain.py", line 193, in run
    return options.run_func(options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/msetup.py", line 365, in run
    app.generate()
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/msetup.py", line 188, in generate
    return self._generate(env, capture, vslite_ctx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/msetup.py", line 227, in _generate
    intr.run()
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreter/interpreter.py", line 3063, in run
    super().run()
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 169, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 195, in evaluate_codeblock
    raise e
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 187, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 219, in evaluate_statement
    return self.evaluate_if(cur)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 309, in evaluate_if
    self.evaluate_codeblock(i.block)
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 195, in evaluate_codeblock
    raise e
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 187, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 201, in evaluate_statement
    return self.function_call(cur)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 528, in function_call
    res = func(node, func_args, kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/decorators.py", line 237, in wrapper
    return f(*nargs, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/decorators.py", line 556, in wrapper
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreter/interpreter.py", line 869, in func_subproject
    return self.do_subproject(args[0], kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreter/interpreter.py", line 951, in do_subproject
    raise e
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreter/interpreter.py", line 939, in do_subproject
    return methods_map[method](subp_name, subdir, default_options, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreter/interpreter.py", line 990, in _do_subproject_meson
    subi.run()
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreter/interpreter.py", line 3063, in run
    super().run()
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 169, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 195, in evaluate_codeblock
    raise e
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 187, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 205, in evaluate_statement
    self.assignment(cur)
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 642, in assignment
    value = self.evaluate_statement(node.value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 207, in evaluate_statement
    return self.method_call(cur)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 557, in method_call
    res = obj.method_call(method_name, args, kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreter/interpreterobjects.py", line 885, in method_call
    ret = method(state, args, kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/decorators.py", line 237, in wrapper
    return f(*nargs, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/interpreterbase/decorators.py", line 556, in wrapper
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/modules/external_project.py", line 296, in add_project
    project = ExternalProject(state,
              ^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/site-packages/mesonbuild/modules/external_project.py", line 93, in __init__
    self.prefix = self.prefix.relative_to(self.prefix.drive)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/pathlib.py", line 682, in relative_to
    raise ValueError(f"{str(self)!r} is not in the subpath of {str(other)!r}")
ValueError: 'C:/msys64/mingw64' is not in the subpath of 'C:'

D:/Users/parrot/git/ham/subprojects/eggs/meson.build:14:8: ERROR: Unhandled python exception

    This is a Meson bug and should be reported!

Copy link
Member

@eli-schwartz eli-schwartz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should really be reported to CPython as a regression.

mesonbuild/modules/external_project.py Outdated Show resolved Hide resolved
mesonbuild/modules/external_project.py Outdated Show resolved Hide resolved
@MihailJP MihailJP force-pushed the MihailJP-patch-1 branch 2 times, most recently from b30d5f4 to b3b390f Compare November 10, 2024 11:07
On Python 3.12, self.prefix.relative_to(self.prefix.drive) no longer works and raises error like:
ValueError: 'C:/msys64/mingw64' is not in the subpath of 'C:'
@MihailJP MihailJP force-pushed the MihailJP-patch-1 branch 9 times, most recently from a6e7e39 to 7ae4d8a Compare November 10, 2024 18:12
@MihailJP
Copy link
Author

It seems recent ObjFW update broke an Objective-C++ test case on MinGW.

ld.lld: error: undefined symbol: __getmainargs(int*, char***, char***, int, int*)

This pull request cannot be merged until the test case is fixed.

@MihailJP
Copy link
Author

MihailJP commented Nov 11, 2024

__getmainargs is in msvcrt.dll which is the runtime library of VC++. In MinGW it is available through CRT.

@MihailJP
Copy link
Author

mingw-w64-clang-x86_64-libobjfw seems now fixed.

In some reason, recent version of MSYS2 is shipped with /usr/bin/cmd
which makes the test fail
After the release of hdf5 1.14.5, frameworks test 25 now successes
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.

2 participants