Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Could not map installation path to an equivalent wheel directory#765

Answeredbydnicolodi
moi15moi asked this question inQ&A
Discussion options

I think I have the same issue has#673, because I get this error:meson-python: error: Could not map installation path to an equivalent wheel directory: '{libdir_static}/libavutil.a'

libavutil isn't a direct dependency of my project. My project depends onbestsource which depend onffmpeg (libavutil, libavcodec, libavformat).

From what I can see in the doc, I think I simply need to use:https://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html#shared-library-from-subproject, but even with my 2 attempts, it didn't work.

Attempt 1

meson.build

project('example','cpp',version:'0.1.0',default_options: ['cpp_std=c++17'],)py=import('python').find_installation(pure:false)pybind11_dep=dependency('pybind11')# See https://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html#shared-library-from-subproject# Maybe the only_install_main_lib will propagate to dependency like ffmpeg?bestsource_subproj=subproject('bestsource',default_options: {# This is a custom option - if it doesn't exist, can you add it# upstream or in WrapDB?'only_install_main_lib':true,    })bestsource_dep= bestsource_subproj.get_variable('bestsource_dep')subdir('video_timestamps')

video_timestamps\meson.build

python_sources= ['__init__.py','_version.py','abc_timestamps.py','fps_timestamps.py','rounding_method.py','text_file_timestamps.py','time_type.py','time_unit_converter.py','timestamps_file_parser.py','video_timestamps.py']py.install_sources(  python_sources,pure:false,subdir:'video_timestamps')py.extension_module('best_source','best_source.cpp',install:true,dependencies: [pybind11_dep, bestsource_dep],)

Attempt 2

meson.build

project('example','cpp',version:'0.1.0',default_options: ['cpp_std=c++17'],)py=import('python').find_installation(pure:false)pybind11_dep=dependency('pybind11')# See https://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html#shared-library-from-subprojectffmpeg_subproj=subproject('ffmpeg',default_options: {# This is a custom option - if it doesn't exist, can you add it# upstream or in WrapDB?'only_install_main_lib':true,    })libavformat_dep= ffmpeg_subproj.get_variable('libavformat_dep')libavcodec_dep= ffmpeg_subproj.get_variable('libavcodec_dep')libavutil_dep= ffmpeg_subproj.get_variable('libavutil_dep')# I'm not sure if bestsource will use the variable libavformat_dep, libavcodec_dep and libavutil_depbestsource_dep=dependency('bestsource')subdir('video_timestamps')

video_timestamps\meson.build

python_sources= ['__init__.py','_version.py','abc_timestamps.py','fps_timestamps.py','rounding_method.py','text_file_timestamps.py','time_type.py','time_unit_converter.py','timestamps_file_parser.py','video_timestamps.py']py.install_sources(  python_sources,pure:false,subdir:'video_timestamps')py.extension_module('best_source','best_source.cpp',install:true,dependencies: [pybind11_dep, bestsource_dep],)

Note that these are the wrap file I used:

ffmpeg.wrap

[wrap-git]directory = ffmpegurl = https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.gitrevision = meson-7.1depth = 1[provide]libavformat = libavformat_deplibavcodec = libavcodec_deplibavutil = libavutil_dep

bestsource.wrap

[wrap-git]url = https://github.com/vapoursynth/bestsourcerevision = R12clone-recursive = true[provide]bestsource = bestsource_dep

Do you have an idea of what I could do wrong?

PS: I don't care about using a shared lib of static lib. It's just that I was getting another error with static lib.

You must be logged in to vote

I think the issue comes from the use of inline assembly inffmpeg when building a static library. If you do that, you need to compile objects linking toffmpeg with-Wl,-Bsymbolichttps://ffmpeg.org/platform.html#Advanced-linking-configuration Don't ask me what that flag does or why it is needed.

Replies: 1 comment 3 replies

Comment options

From what I can see in the doc, I think I simply need to use:https://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html#shared-library-from-subproject, but even with my 2 attempts, it didn't work.

As the documentation says, that only works if the subproject has support for that option. I'm quite sure the subprojects you are using do not implement it. However, if the only thing that the subproject installs that you don't want it the static library, you may simply disable building the static library passing--default-library=shared to the setup command.

I don't care about using a shared lib of static lib.

Then, the easiest is to compile all components statically and do not install the subprojects, as explained herehttps://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html#static-library-from-subproject

You must be logged in to vote
3 replies
@moi15moi
Comment options

Then, the easiest is to compile all components statically and do not install the subprojects, as explained herehttps://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html#static-library-from-subproject

Ok, then I will explain the error that I was getting.
I previously tried to add the snippet you shared, but I was getting this error:

FAILED: video_timestamps/best_source.cpython-312-x86_64-linux-gnu.so      c++-o video_timestamps/best_source.cpython-312-x86_64-linux-gnu.so video_timestamps/best_source.cpython-312-x86_64-linux-gnu.so.p/best_source.cpp.o-Wl,--as-needed-Wl,--allow-shlib-undefined-Wl,-O1-shared-fPIC-Wl,--start-group subprojects/bestsource/libbestsource.a subprojects/ffmpeg/libavutil.a subprojects/ffmpeg/libavcodec.a subprojects/ffmpeg/libswresample.a subprojects/ffmpeg/libavformat.a subprojects/xxHash-0.8.3/libxxhash.a-pthread-lm-latomic/usr/lib/x86_64-linux-gnu/libz.a-lbz2-latomic-latomic-latomic-latomic-lbz2-Wl,--end-group/usr/bin/ld: subprojects/ffmpeg/libavcodec.a(libavcodec_x86_cavsdsp.c.o):warning: relocation against `ff_pw_5' in read-only section `.text'/usr/bin/ld: subprojects/ffmpeg/libavcodec.a(libavcodec_x86_cavsdsp.c.o): relocation R_X86_64_PC32 against symbol `ff_pw_5' can not be used when making a shared object; recompilé avec -fPIC/usr/bin/ld: final linkfailed: bad valuecollect2:error: ld returned1 exit statusninja: buildstopped: subcommand failed.      [end of output]

So, I tried to forceb_staticpic to true like this, but I am getting the same error.

[tool.meson-python.args]setup = ["--default-library=static","--wrap-mode=forcefallback","-Dbestsource:enable_plugin=false","-Dffmpeg:tests=disabled","-Dffmpeg:b_staticpic=true",]install = ['--skip-subprojects']

I think that's more a meson question than a meson-python question. If so, I'm sorry if I am not in the right place.

@dnicolodi
Comment options

I think the issue comes from the use of inline assembly inffmpeg when building a static library. If you do that, you need to compile objects linking toffmpeg with-Wl,-Bsymbolichttps://ffmpeg.org/platform.html#Advanced-linking-configuration Don't ask me what that flag does or why it is needed.

Answer selected bymoi15moi
@moi15moi
Comment options

You're totally right!
With this, it compiles without any error

py.extension_module('best_source','best_source.cpp',install:true,dependencies: [pybind11_dep, bestsource_dep],link_args: ['-Wl,-Bsymbolic'],)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@moi15moi@dnicolodi

[8]ページ先頭

©2009-2025 Movatter.jp