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

Failure to detect native module on MacOS #154

Closed
FFY00 opened this issue Sep 28, 2022 · 5 comments
Closed

Failure to detect native module on MacOS #154

FFY00 opened this issue Sep 28, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@FFY00
Copy link
Member

FFY00 commented Sep 28, 2022

* Building wheel...
! Using Meson to generate the project metadata (no `project` section in pyproject.toml)
+ meson setup --native-file=/Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 --prefix=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9 /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-qssq8y7w/build
The Meson build system
Version: 0.63.2
Source dir: /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib
Build dir: /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-qssq8y7w/build
Build type: native build
Project name: purelib-and-platlib
Project version: 1.0.0
C compiler for the host machine: cc (clang 14.0.0 "Apple clang version 14.0.0 (clang-1400.0.29.102)")
C linker for the host machine: cc ld64 819.6
Host machine cpu family: aarch64
Host machine cpu: arm64
Found pkg-config: /opt/homebrew/bin/pkg-config (0.29.2)
Run-time dependency python3 found: YES 3.10
Program python found: YES (/Library/Developer/CommandLineTools/usr/bin/python3)
Build targets in project: 1

purelib-and-platlib 1.0.0

  User defined options
    Native files: /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-native-file.ini
    debug       : false
    optimization: 2
    prefix      : /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9

Found ninja-1.11.1 at /opt/homebrew/bin/ninja
+ meson compile
[2/2] Linking target plat.cpython-39-darwin.so
+ meson install --destdir /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-qssq8y7w/install
ninja: Entering directory `/Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-qssq8y7w/build'
ninja: no work to do.
Installing plat.cpython-39-darwin.so to /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-qssq8y7w/install/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/Library/Python/3.9/site-packages
Installing /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/pure.py to /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-qssq8y7w/install/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/Library/Python/3.9/site-packages
WARNING Using heuristics to map files to wheel, this may result in incorrect locations
WARNING File could not be mapped to an equivalent wheel directory: /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-qssq8y7w/install/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/Library/Python/3.9/site-packages/plat.cpython-39-darwin.so (/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/Library/Python/3.9/site-packages/plat.cpython-39-darwin.so)
Copying files to wheel...
[0/0] pure.pyy
Successfully built purelib_and_platlib-1.0.0-py3-none-any.whl

Here, plat.cpython-39-darwin.so gets installed to /Users/anubis/git/meson-python/tests/packages/purelib-and-platlib/.mesonpy-qssq8y7w/install/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/Library/Python/3.9/site-packages/. This is because Meson sets the prefix to /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9, so we need to take that into account in the heuristics.

@FFY00 FFY00 added the bug Something isn't working label Sep 28, 2022
@FFY00
Copy link
Member Author

FFY00 commented Sep 28, 2022

Taking the prefix into account does not fix the issue, I think it may be some custom Meson handling? @eli-schwartz any ideas?

@FFY00
Copy link
Member Author

FFY00 commented Sep 28, 2022

The scheme in question (found via sysconfig._get_sysconfigdata_name()):

    'osx_framework_library': {
        'stdlib': '{installed_base}/lib/python{py_version_short}',
        'platstdlib': '{platbase}/lib/python{py_version_short}',
        'purelib': '/Library/Python/{py_version_short}/site-packages',
        'platlib': '/Library/Python/{py_version_short}/site-packages',
        'include': '/Library/Python/{py_version_short}{abiflags}/include',
        'platinclude': '/Library/Python/{py_version_short}{abiflags}/include',
        'scripts': '/usr/local/bin',
        'data': '/Library/Python/{py_version_short}',
        },

@rgommers
Copy link
Contributor

I assume this goes away with Meson master?

@FFY00
Copy link
Member Author

FFY00 commented Sep 29, 2022

Yes, it seems so.

@dnicolodi
Copy link
Member

Fixed in Meson 0.63.3 and later. meson-python requires Meson >= 0.63.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants