-
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 on bestsource which depend on ffmpeg (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-subproject
ffmpeg_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_dep
bestsource_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.wrap
bestsource.wrap
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. |
Beta Was this translation helpful? Give feedback.
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 here https://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html#static-library-from-subproject |
Beta Was this translation helpful? Give feedback.
I think the issue comes from the use of inline assembly in
ffmpeg
when building a static library. If you do that, you need to compile objects linking toffmpeg
with-Wl,-Bsymbolic
https://ffmpeg.org/platform.html#Advanced-linking-configuration Don't ask me what that flag does or why it is needed.