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

meson 0.53.0 gives "TypeError: Forward references must evaluate to types. Got NotImplemented." #6427

Closed
imphil opened this issue Jan 7, 2020 · 8 comments · Fixed by #6498
Milestone

Comments

@imphil
Copy link

imphil commented Jan 7, 2020

With the newly-released 0.53.0 we get the following error on Ubuntu 16.04 with its default Python 3.5.1 3.5.2 (for x86). The previous version of meson worked perfectly.

meson -Dtarget=sim-verilator -Dot_version=opentitan-snapshot-20191101-1-434-gb99db7f -Ddev_bin_dir=/home/vsts/work/1/a/build-bin/sw/device/sim-verilator -Dhost_bin_dir=/home/vsts/work/1/a/build-bin/sw/host --cross-file=/tmp/toolchain.dhA3HP.txt /home/vsts/work/1/a/build-out/sw/sim-verilator
Traceback (most recent call last):
  File "/usr/local/bin/meson", line 11, in <module>
    load_entry_point('meson==0.53.0', 'console_scripts', 'meson')()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/mesonmain.py", line 25, in <module>
    from . import mconf, mdist, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects, munstable_coredata
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/mconf.py", line 16, in <module>
    from . import coredata, environment, mesonlib, build, mintro, mlog
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/environment.py", line 32, in <module>
    from . import compilers
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/compilers/__init__.py", line 102, in <module>
    from .compilers import (
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/compilers/compilers.py", line 389, in <module>
    class CompilerArgs(typing.MutableSequence[str]):
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/compilers/compilers.py", line 658, in CompilerArgs
    def __eq__(self, other: typing.Any) -> typing.Union[bool, 'NotImplemented']:
    "Forward references must evaluate to types.")
  File "/usr/lib/python3.5/typing.py", line 312, in _type_check
    raise TypeError(msg + " Got %.100r." % (arg,))
TypeError: Forward references must evaluate to types. Got NotImplemented.

You can also see the error in this CI build: https://dev.azure.com/lowrisc/opentitan/_build/results?buildId=6916&view=logs&j=5df5adf8-3577-5927-f0b2-31afed2697ee&t=dcb8db2a-d944-5acc-e50e-bea93f2a14e9&l=31

To reproduce: All code is contained in https://github.com/lowRISC/opentitan. Get the code, then type ./meson_init.sh (which is a wrapper around meson). Full docs are at https://docs.opentitan.org/doc/ug/getting_started_sw/

Let me know if the stacktrace is already sufficient for you to see what's going on, otherwise I can do a bisect.

@whot
Copy link
Contributor

whot commented Jan 8, 2020

confirmed in libwacom too.

easiest way to reproduce that I found is with a podman container:

$ podman run --rm -it  ubuntu:16.04
root@1234# apt-get update
root@1234# apt-get install -y apt-get install -y ninja-build python3-pip python3-setuptools git
root@1234# git clone https://github.com/mesonbuild/meson && cd meson
root@1234# ./meson.py --help
[above stacktrace]

git bisect led me to commit e88b3c8, cc @dcbaker

python version is 3.5.2

@scivision
Copy link
Member

scivision commented Jan 8, 2020

I didn't see this error with Python 3.5.4 or 3.5.3. I do get this error with Python 3.5.2. So it appears our minimum has crept up to Python 3.5.3.

@scivision
Copy link
Member

The previous minimum was Python 3.5.2 since Meson 0.52. An issue with trying to go back on this is we need to get type annotation completed to increase the quality of Meson with so many compilers and libraries that would be excessively difficult to cover all combinations with CI.

mrc0mmand added a commit to mrc0mmand/systemd that referenced this issue Jan 8, 2020
Latest meson doesn't work with older python 3.5, which is present on
Ubuntu 16.04. Let's pin in to the latest working version (0.52.1) until
we properly bump all necessary Ubuntu images to 18.04.

See: mesonbuild/meson#6427
mrc0mmand added a commit to mrc0mmand/systemd that referenced this issue Jan 8, 2020
Latest meson doesn't work with older python 3.5, which is present on
Ubuntu 16.04. Let's pin in to the latest working version (0.52.1) until
we properly bump all necessary Ubuntu images to 18.04.

See: mesonbuild/meson#6427
mrc0mmand added a commit to mrc0mmand/systemd that referenced this issue Jan 8, 2020
Latest meson doesn't work with older python 3.5, which is present on
Ubuntu 16.04. Let's pin in to the latest working version (0.52.1) until
we properly bump all necessary Ubuntu images to 18.04.

See: mesonbuild/meson#6427
@imphil
Copy link
Author

imphil commented Jan 8, 2020

Python 3.5.2 comes with Ubuntu 16.04 (at least on x86 targets; it's highly confusing as the package is actually named 3.5.1-xxx, see the list of files at https://packages.ubuntu.com/xenial/python3.5).

So if you increase the minimum version requirement to Python 3.5.3 you prevent using the latest meson on Ubuntu 16.04, which is still rather widely used.

imphil added a commit to imphil/opentitan that referenced this issue Jan 8, 2020
Meson 0.53.0 broke compatibility with Python 3.5.2

Error message with meson 0.53.0 in our Ubuntu 16.04/Python 3.5.2 CI
environment:

```
meson -Dtarget=sim-verilator -Dot_version=opentitan-snapshot-20191101-1-434-gb99db7f -Ddev_bin_dir=/home/vsts/work/1/a/build-bin/sw/device/sim-verilator -Dhost_bin_dir=/home/vsts/work/1/a/build-bin/sw/host --cross-file=/tmp/toolchain.dhA3HP.txt /home/vsts/work/1/a/build-out/sw/sim-verilator
Traceback (most recent call last):
  File "/usr/local/bin/meson", line 11, in <module>
    load_entry_point('meson==0.53.0', 'console_scripts', 'meson')()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/mesonmain.py", line 25, in <module>
    from . import mconf, mdist, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects, munstable_coredata
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/mconf.py", line 16, in <module>
    from . import coredata, environment, mesonlib, build, mintro, mlog
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/environment.py", line 32, in <module>
    from . import compilers
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/compilers/__init__.py", line 102, in <module>
    from .compilers import (
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/compilers/compilers.py", line 389, in <module>
    class CompilerArgs(typing.MutableSequence[str]):
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/compilers/compilers.py", line 658, in CompilerArgs
    def __eq__(self, other: typing.Any) -> typing.Union[bool, 'NotImplemented']:
    "Forward references must evaluate to types.")
  File "/usr/lib/python3.5/typing.py", line 312, in _type_check
    raise TypeError(msg + " Got %.100r." % (arg,))
TypeError: Forward references must evaluate to types. Got NotImplemented.
```

Works around lowRISC#1288 for now.
Reported upstream at mesonbuild/meson#6427

Signed-off-by: Philipp Wagner <phw@lowrisc.org>
imphil added a commit to lowRISC/opentitan that referenced this issue Jan 8, 2020
Meson 0.53.0 broke compatibility with Python 3.5.2

Error message with meson 0.53.0 in our Ubuntu 16.04/Python 3.5.2 CI
environment:

```
meson -Dtarget=sim-verilator -Dot_version=opentitan-snapshot-20191101-1-434-gb99db7f -Ddev_bin_dir=/home/vsts/work/1/a/build-bin/sw/device/sim-verilator -Dhost_bin_dir=/home/vsts/work/1/a/build-bin/sw/host --cross-file=/tmp/toolchain.dhA3HP.txt /home/vsts/work/1/a/build-out/sw/sim-verilator
Traceback (most recent call last):
  File "/usr/local/bin/meson", line 11, in <module>
    load_entry_point('meson==0.53.0', 'console_scripts', 'meson')()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/mesonmain.py", line 25, in <module>
    from . import mconf, mdist, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects, munstable_coredata
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/mconf.py", line 16, in <module>
    from . import coredata, environment, mesonlib, build, mintro, mlog
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/environment.py", line 32, in <module>
    from . import compilers
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/compilers/__init__.py", line 102, in <module>
    from .compilers import (
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/compilers/compilers.py", line 389, in <module>
    class CompilerArgs(typing.MutableSequence[str]):
  File "/usr/local/lib/python3.5/dist-packages/mesonbuild/compilers/compilers.py", line 658, in CompilerArgs
    def __eq__(self, other: typing.Any) -> typing.Union[bool, 'NotImplemented']:
    "Forward references must evaluate to types.")
  File "/usr/lib/python3.5/typing.py", line 312, in _type_check
    raise TypeError(msg + " Got %.100r." % (arg,))
TypeError: Forward references must evaluate to types. Got NotImplemented.
```

Works around #1288 for now.
Reported upstream at mesonbuild/meson#6427

Signed-off-by: Philipp Wagner <phw@lowrisc.org>
evverx pushed a commit to systemd/systemd that referenced this issue Jan 8, 2020
Latest meson doesn't work with older python 3.5, which is present on
Ubuntu 16.04. Let's pin in to the latest working version (0.52.1) until
we properly bump all necessary Ubuntu images to 18.04.

See: mesonbuild/meson#6427
ovsrobot pushed a commit to ovsrobot/dpdk that referenced this issue Jan 8, 2020
meson 0.53.0 has a compatibility issue [1] with the python 3.5.2 that comes
in Ubuntu 16.04.
Let's pin meson to 0.52.0 while the fix is being prepared in meson.

1: mesonbuild/meson#6427

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
@scivision
Copy link
Member

I also didn't realize that Ubuntu 16.04 was actually Python 3.5.2 due to the confusing naming convention. Thanks.

kevuzaj pushed a commit to kevuzaj/dpdk-stable that referenced this issue Jan 8, 2020
meson 0.53.0 has a compatibility issue [1] with the python 3.5.2 that comes
in Ubuntu 16.04.
Let's pin meson to 0.52.0 while the fix is being prepared in meson.

1: mesonbuild/meson#6427

Signed-off-by: David Marchand <david.marchand@redhat.com>
kevuzaj pushed a commit to kevuzaj/dpdk-stable that referenced this issue Jan 8, 2020
meson 0.53.0 has a compatibility issue [1] with the python 3.5.2 that comes
in Ubuntu 16.04.
Let's pin meson to 0.47.1 while the fix is being prepared in meson.

1: mesonbuild/meson#6427

Signed-off-by: David Marchand <david.marchand@redhat.com>
@dcbaker
Copy link
Member

dcbaker commented Jan 8, 2020

We can probably get around this by defining the type inside a T.TYPE_CHECKING block. If not I guess we'll have to drop the return type annotations from those.

@dzhang-b
Copy link

dzhang-b commented Jan 8, 2020

Please continue to support ubuntu16.04 by removing whatever causes meson to break.

kevuzaj pushed a commit to kevuzaj/dpdk-stable that referenced this issue Jan 9, 2020
meson 0.53.0 has a compatibility issue [1] with the python 3.5.2 that comes
in Ubuntu 16.04.
Let's pin meson to 0.47.1 while the fix is being prepared in meson.

1: mesonbuild/meson#6427

Signed-off-by: David Marchand <david.marchand@redhat.com>
ovsrobot pushed a commit to ovsrobot/dpdk that referenced this issue Jan 9, 2020
meson 0.53.0 has a compatibility issue [1] with the python 3.5.2 that comes
in Ubuntu 16.04.
On the other hand, the minimal version supported in dpdk is 0.47.1.

Stick to this version to avoid getting hit by regressions in meson latest
shiny release.

1: mesonbuild/meson#6427

Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
dpdk-replication pushed a commit to DPDK/dpdk that referenced this issue Jan 9, 2020
meson 0.53.0 has a compatibility issue [1] with the python 3.5.2 that comes
in Ubuntu 16.04.
On the other hand, the minimal version supported in dpdk is 0.47.1.

Stick to this version to avoid getting hit by regressions in meson latest
shiny release.

1: mesonbuild/meson#6427

Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
afayaz-feral added a commit to FeralInteractive/gamemode that referenced this issue Jan 9, 2020
…s with python 3.5.2 which is shipped with Ubuntu 16.04. Better stick to a specific version and only update after checking compatibility. See mesonbuild/meson#6427.
afayaz-feral added a commit to FeralInteractive/gamemode that referenced this issue Jan 9, 2020
…s with python 3.5.2 which is shipped with Ubuntu 16.04. Better stick to a specific version and only update after checking compatibility. See mesonbuild/meson#6427.
@scivision
Copy link
Member

Thanks to everyone who reported this so quickly. It looks like #6438 is one potential pathway forward to improve Meson internals with recent Python version syntax while postprocessing source appropriate for older Python versions.

kevuzaj pushed a commit to kevuzaj/dpdk-stable that referenced this issue Jan 9, 2020
[ upstream commit a02b9406a8769247737b55dbfa50b6b5f896d946 ]

meson 0.53.0 has a compatibility issue [1] with the python 3.5.2 that comes
in Ubuntu 16.04.
On the other hand, the minimal version supported in dpdk is 0.47.1.

Stick to this version to avoid getting hit by regressions in meson latest
shiny release.

1: mesonbuild/meson#6427

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
kevuzaj pushed a commit to kevuzaj/dpdk-stable that referenced this issue Jan 13, 2020
[ upstream commit a02b9406a8769247737b55dbfa50b6b5f896d946 ]

meson 0.53.0 has a compatibility issue [1] with the python 3.5.2 that comes
in Ubuntu 16.04.
On the other hand, the minimal version supported in dpdk is 0.47.1.

Stick to this version to avoid getting hit by regressions in meson latest
shiny release.

1: mesonbuild/meson#6427

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
kevuzaj pushed a commit to kevuzaj/dpdk-stable that referenced this issue Jan 14, 2020
[ upstream commit a02b9406a8769247737b55dbfa50b6b5f896d946 ]

meson 0.53.0 has a compatibility issue [1] with the python 3.5.2 that comes
in Ubuntu 16.04.
On the other hand, the minimal version supported in dpdk is 0.47.1.

Stick to this version to avoid getting hit by regressions in meson latest
shiny release.

1: mesonbuild/meson#6427

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
mrc0mmand added a commit to mrc0mmand/casync that referenced this issue Jan 16, 2020
@nirbheek nirbheek added this to the 0.53.1 milestone Jan 23, 2020
nirbheek added a commit that referenced this issue Jan 23, 2020
Explicitly use the type instead of the string 'NotImplemented' which
still works with Python 3.5.2

Fixes #6427
nirbheek added a commit that referenced this issue Jan 23, 2020
Explicitly use the type instead of the string 'NotImplemented' which
still works with Python 3.5.2

Fixes #6427
nirbheek added a commit that referenced this issue Jan 23, 2020
Explicitly use the type instead of the string 'NotImplemented' which
still works with Python 3.5.2

Fixes #6427
nirbheek added a commit that referenced this issue Jan 23, 2020
Explicitly use the type instead of the string 'NotImplemented' which
still works with Python 3.5.2

Fixes #6427
nirbheek added a commit that referenced this issue Jan 23, 2020
Explicitly use the type instead of the string 'NotImplemented' which
still works with Python 3.5.2

Fixes #6427
nirbheek added a commit that referenced this issue Jan 23, 2020
Explicitly use the type instead of the string 'NotImplemented' which
still works with Python 3.5.2

Fixes #6427
afayaz-feral added a commit to FeralInteractive/gamemode that referenced this issue May 26, 2020
…s with python 3.5.2 which is shipped with Ubuntu 16.04. Better stick to a specific version and only update after checking compatibility. See mesonbuild/meson#6427.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants