- Notifications
You must be signed in to change notification settings - Fork82
-
I think I have the same issue has#673, because I get this error: 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 1meson.buildproject('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.buildpython_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 2meson.buildproject('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.buildpython_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.wrapbestsource.wrapDo 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. |
BetaWas this translation helpful?Give feedback.
All reactions
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
-
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
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 |
BetaWas this translation helpful?Give feedback.
All reactions
-
Ok, then I will explain the error that I was getting. 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 force [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. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I think the issue comes from the use of inline assembly in |
BetaWas this translation helpful?Give feedback.
All reactions
-
You're totally right! py.extension_module('best_source','best_source.cpp',install:true,dependencies: [pybind11_dep, bestsource_dep],link_args: ['-Wl,-Bsymbolic'],) |
BetaWas this translation helpful?Give feedback.