Using internal shared libraries with cython, install_dir not respected? Could not map installation path to an equivalent wheel directory #770
Replies: 1 comment 7 replies
-
This seems to be a case where the installation location metadata Meson generates doesn't match the actual install location for
results in the install location: I changed
We don't actually have a test package for what you're trying to do here with
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Slightly related to #769, and definitely in theme with #410, #556, and #765, I am trying to update my Python library SpiceyPy to use meson-python.
SpiceyPy wraps a C library (that doesn't ship with a cmakelists file) with ctypes and now cython, each linking to a shared library that gets bundled in the wheel and has been built successfully for years with cibuildwheel, a custom build script, and some horrible setup.py stuff I am trying to remove entirely so I can transition fully to pyproject.toml and not maintain a custom build script at the same time. The cython module is much newer and links against numpy as well so slightly further complicating things.
I have been reading those issues and the docs page at https://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html but I am new to meson so I am getting the
could not map
error mentioned above, and as far as I can tell, I am doing all the things recommended in the docs/those discussions already so I am a bit lost.Because of the use of ctypes (and well because I know this already works) none of the instructions regarding static libraries seem relevant to me. But I am willing to have my mine changed...
In any case, to experiment with meson-python, I have another public github repository https://github.com/AndrewAnnex/cspice-meson-cyice-test where I have a minimal version of the cython module of SpiceyPy that I hope to get working (and eventually with cibuildwheel) to start.
So far, I have worked out how to compile the C library with meson via a subproject. Because the source code is distributed as different files for different operating systems (and needs a few patches), I have a series of wrap files and patch files that contain the meson.build, the meson_options.txt to support the configuration idea from the docs #700 . This compiles and in previous versions I had a test c file compiled to an executable against it (something I need to put back in probably).
Next, I have a top level meson.build file where I have a subproject defined
https://github.com/AndrewAnnex/cspice-meson-cyice-test/blob/fd516fe5def09b3ad1965624749667a35401e4b8/meson.build#L74-L83
and where the python install dir is grabbed a few lines above:
https://github.com/AndrewAnnex/cspice-meson-cyice-test/blob/fd516fe5def09b3ad1965624749667a35401e4b8/meson.build#L12-L17
and then I have a meson.build in the
src layout
parlance insrc/test_cyice/meson.build
where the sub project dependency actually gets used in the cython compilation stephttps://github.com/AndrewAnnex/cspice-meson-cyice-test/blob/fd516fe5def09b3ad1965624749667a35401e4b8/src/test_cyice/meson.build#L2-L36
When I go to do meson build/meson compile, everything works as expected and I see the expected shared libraries in the build/compile folders within the correct subprojects directory.
But when I go to use meson-python via
python -m build -w
, after the shared library finishes being compiled I get the familiar error mentioned above after linking occurs:From the above you can see places where message functions are called, and seemingly showing that the correct path is being provided (I want to install the C shared library within a "utils" directory of the project, which also has it's own subdir meson.build and that gets called before the python extension function is called anyways) but it looks like it's ignored at this stage or I need to pass in a different path or not try to install the shared library and get it in via some other mechanism (a custom target?)
running introspect as suggested elsewhere reveals:
which is confusing considering I do provide the install dir for the shared library. I would expect it to have a path like
{py_platlib}/test_cyice/utils/libcspice.1.dylib
.In any case I am not sure if this is a bug/known unsupported thing in meson-build. More likely I am missing some context/knowledge about meson that would provide an obvious fix.
Any help would be very appreciated!
Beta Was this translation helpful? Give feedback.
All reactions