mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.53k stars 1.61k forks source link

Unhandled python exception #11560

Open wendych864 opened 1 year ago

wendych864 commented 1 year ago

Describe the bug Unhandled python exception

**To Reproduce: I download meson source code here: git clone https://github.com/mesonbuild/meson.git

I go to the directory where meson source code are. Then I run: ./packaging/create_zipapp.py --outfile meson.pyz --interpreter '/usr/bin/env python3'

I run:/home/..../projects/meson/meson/meson.pyz compile -C build in my source code directory after meson setup, there is an error: "meson/meson/mesonbuild/dependencies/detect.py", line 118, in find_external_dependency bettermsg = f'Dependency lookup for {name} with method {c.func.log_tried()!r} failed: {e}' AttributeError: 'function' object has no attribute 'log_tried'

../........./meson.build:31:2: ERROR: Unhandled python exception

This is a Meson bug and should be reported!

FAILED: build.ninja"

I include ourmeson.build files: hls_sources = [ 'hls/gsthlsdemux.c', 'hls/gsthlsdemux-stream.c', 'hls/gsthlsdemux-playlist-loader.c', 'hls/gsthlsdemux-preloader.c', 'hls/gsthlsdemux-util.c', 'hls/gsthlselement.c', 'hls/m3u8.c', ]

hls_cargs = []

hls_crypto = get_option('hls-crypto') hls_crypto_dep = dependency('', required : false)

if ['auto', 'nettle'].contains(hls_crypto) hls_crypto_dep = dependency('nettle', version : '>= 3.0', required : false) if hls_crypto_dep.found() hls_cargs += ['-DHAVE_NETTLE'] endif endif

if not hls_crypto_dep.found() and ['auto', 'libgcrypt'].contains(hls_crypto) hls_crypto_dep = cc.find_library('gcrypt', required : false) if hls_crypto_dep.found() hls_cargs += ['-DHAVE_LIBGCRYPT'] endif endif

if not hls_crypto_dep.found() and ['auto', 'openssl'].contains(hls_crypto) hls_crypto_dep = dependency('openssl', required : false) if hls_crypto_dep.found() hls_cargs += ['-DHAVE_OPENSSL'] endif endif

if not hls_crypto_dep.found() if hls_crypto == 'auto' message('Could not find a supported crypto library for HLS support') else error('HLS crypto support library "@0@" not found'.format(hls_crypto)) endif endif hls_dep = declare_dependency(include_directories : include_directories('.'))

Expected behavior compile should be done

bruchar1 commented 1 year ago

hls_crypto_dep = dependency('', required : false)

Is this empty string expected? I guess this is the cause of the exception.,,

Volker-Weissmann commented 1 year ago

hls_crypto_dep = dependency('', required : false)

Is this empty string expected? I guess this is the cause of the exception.,,

No, empty strings are supported here. From the docs:

If dependency_name is '', the dependency is always not found. So with required: false, this always returns a dependency object for which the found() method returns false, and which can be passed like any other dependency to the dependencies: keyword argument of a build_target. This can be used to implement a dependency which is sometimes not required e.g. in some branches of a conditional, or with a fallback: kwarg, can be used to declare an optional dependency that only looks in the specified subproject, and only if that's allowed by --wrap-mode.

Volker-Weissmann commented 1 year ago
  1. Your formatting is broken. Perhaps Githubs Markdown Guide can help you.

  2. I could not reproduce the issue. What you posted might be part of your meson.build files, but it is not your whole meson.build file. Could you perhaps send a link to the git repo of the project that fails to compile using meson? Or create a minimal example that shows the same error?