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 install error: Can't get attribute 'OctalInt' #8425

Closed
doniaalwin opened this issue Feb 26, 2021 · 20 comments
Closed

Meson install error: Can't get attribute 'OctalInt' #8425

doniaalwin opened this issue Feb 26, 2021 · 20 comments

Comments

@doniaalwin
Copy link

doniaalwin commented Feb 26, 2021

Observed the following error on meson install of gstreamer :

File "/usr/lib/python3/dist-packages/mesonbuild/minstall.py", line 330, in do_install
    d = pickle.load(ifile)
AttributeError: Can't get attribute 'OctalInt' on <module 'mesonbuild.coredata' from '/usr/lib/python3/dist-packages/mesonbuild/coredata.py'>
@eli-schwartz eli-schwartz changed the title Meson install error -File "/usr/lib/python3/dist-packages/mesonbuild/minstall.py", line 330, in do_install d = pickle.load(ifile) AttributeError: Can't get attribute 'OctalInt' on <module 'mesonbuild.coredata' from '/usr/lib/python3/dist-packages/mesonbuild/coredata.py'> Meson install error: Can't get attribute 'OctalInt' Feb 26, 2021
@eli-schwartz
Copy link
Member

I'm sure we don't need a page title that long.

@eli-schwartz
Copy link
Member

question: what command did you run exactly in order to get this error?

And, where did you get meson from? pip, or your distro's package manager?

@doniaalwin
Copy link
Author

question: what command did you run exactly in order to get this error?

sudo ninja install

And, where did you get meson from? pip, or your distro's package manager?

pip

@doniaalwin
Copy link
Author

Description : Build is successful but install failed

@eli-schwartz
Copy link
Member

If you got it from pip, why is it using /usr/lib/python3/dist-packages/mesonbuild/minstall.py

In order to use sudo ninja install, meson must be installed as root. Your installation attempt is incorrectly picking up the wrong (outdated!) version of meson.

@doniaalwin
Copy link
Author

doniaalwin commented Mar 1, 2021 via email

@voland62
Copy link

Is it so hard to mention this in the docs?

@paulnegz
Copy link

Thank u removes all meson installations and reinstalled . It worked. Thank you

On Thu, 25 Feb 2021, 21:41 Eli Schwartz, @.***> wrote: If you got it from pip, why is it using /usr/lib/python3/dist-packages/mesonbuild/minstall.py In order to use sudo ninja install, meson must be installed as root. Your installation attempt is incorrectly picking up the wrong (outdated!) version of meson. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#8425 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKLK3YFQ3JMDT53RNTGNNDTA4C5ZANCNFSM4YHSVQWA .

Thank u removes all meson installations and reinstalled . It worked. Thank you

On Thu, 25 Feb 2021, 21:41 Eli Schwartz, @.***> wrote: If you got it from pip, why is it using /usr/lib/python3/dist-packages/mesonbuild/minstall.py In order to use sudo ninja install, meson must be installed as root. Your installation attempt is incorrectly picking up the wrong (outdated!) version of meson. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#8425 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKLK3YFQ3JMDT53RNTGNNDTA4C5ZANCNFSM4YHSVQWA .

How did you uninstall and reinstall meson?

@eli-schwartz
Copy link
Member

https://mesonbuild.com/Getting-meson.html#installing-meson-with-pip

Specifically mentions you must install meson using sudo pip if you intend to run sudo ninja install.

A better solution would be to upgrade from years-old versions of Ubuntu, but if you're using CI then sudo pip is a reasonable way to install things, and if you're using DESTDIR= installs then you don't need sudo ninja.

@mwilck
Copy link

mwilck commented Sep 1, 2021

In case someone else ends up here looking for the cause of this issue: It's related to #8282. It happens if an older version meson (lacking the commit from #8282) tries to load an install.dat file that had been generated by a more recent version of meson, which included that commit. I suppose it could also happen if an install.dat file was shipped e.g. in a tarball.

@xclaesse
Copy link
Member

Made a PR to at least print a sensible error message, just like we do in all other subcommands that load coredata: #9507.

Specifically mentions you must install meson using sudo pip if you intend to run sudo ninja install.

I think sudo ninja install usually works when you have meson intsalled in your user's HOME, because we set the full path to the meson executable in build.ninja. However you can have the issue when doing sudo meson install because that will pick the meson executable for the root user, often from distro.

Note that on Linux you can even simply do meson install without sudo and it will uses polkit to elevate priviledge and that's going to use meson executable from your user instead of root/system version.

@eli-schwartz
Copy link
Member

eli-schwartz commented Oct 31, 2021

What??? No!

It can't possibly work, because the full path to the meson executable does absolutely nothing whatsoever, this is python and the code is all in modules imported off of sys.path.

sys.path is different when running as root, it doesn't matter what command you ran to get there nor whether polkit or ninja invoked meson. It won't inject the user site-packages into the root process, for obvious security reasons.

@xclaesse
Copy link
Member

It can't possibly work,

It does on my laptop at least, doing that literally every day.

@xclaesse
Copy link
Member

@eli-schwartz it works because meson.py mess up with sys.path to find modules in mesonbuild/ folder next to it.

@eli-schwartz
Copy link
Member

On your laptop running sudo ~/.local/bin/meson imports code from ~/.local/lib/python 3.9/site-packages/mesonbuild/?

How exactly have you tested this?

@xclaesse
Copy link
Member

oh, ok, it's not pip installed, it's running from git checkout. That's the difference, ok.

@eli-schwartz
Copy link
Member

eli-schwartz commented Oct 31, 2021

Right, no one for a second ever was talking about running path/to/git/checkout/meson.py

In fact running meson.py from a git checkout is one of the methods I recommended in the past to circumvent this, rather than using pip install.

As you said:

when you have meson intsalled in your user's HOME

Installed means not running from a git checkout.

@xclaesse
Copy link
Member

yeah, sorry for the confusion :)

@xclaesse
Copy link
Member

We could make it work when using polkit thought, by setting PYTHONPATH when running pkexec.

@eli-schwartz
Copy link
Member

  • the polkit codepath is evil, counterintuitive, and should be removed
  • Regardless, I see no reason to modify the global import path, adding far more than just mesonbuild to it, when elevating to root. For something that isn't even a real issue, but rather a broken setup.

People can just run from a git checkout or use a zipapp.

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

No branches or pull requests

6 participants