Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libarchive-3.7.3: meson.build:452:8: Exception: Dependencies must be external dependencies #1511

Open
kasper93 opened this issue May 10, 2024 · 5 comments

Comments

@kasper93
Copy link

This fails, because dependency is internal

if cc.has_header(h, dependencies: d)

This will also fail
if cc.has_function(f, dependencies: d)

Internal dependencies shouldn't be checked and assumed to be well formed, they will be built anyway.

@kasper93 kasper93 changed the title libarchive: libarchive-3.7.3/meson.build:452:8: Exception: Dependencies must be external dependencies libarchive-3.7.3: meson.build:452:8: Exception: Dependencies must be external dependencies May 10, 2024
@benoit-pierre
Copy link
Contributor

AFAIK, cc.has_header(…) is fine, and cc.has_function(…) could be replaced with cc.has_symbol(…) (if a simple dependency version check cannot be used).

@eli-schwartz
Copy link
Member

As a general comment on such checks: not all autoconf checks for symbols in a dependency are just checking if the dependency is functional. Sometimes they are checking which version of the dependency is available, because the symbol was introduced in XXX version.

In such a scenario, the symbol checks should of course be replaced by dep.version().version_compare()

@neheb
Copy link
Collaborator

neheb commented May 14, 2024

As an aside, the GCC14 bump introduced implicit-function-declerations as an error. I was expecting this to make has_function() fail as headers are now needed. Looks like that didn't happen.

@benoit-pierre
Copy link
Contributor

benoit-pierre commented May 14, 2024

That's because the code run by those checks look like this:

#define locale_charset meson_disable_define_of_locale_charset

#include <limits.h>
#undef locale_charset

#ifdef __cplusplus
extern "C"
#endif
char locale_charset (void);

#if defined __stub_locale_charset || defined __stub___locale_charset
fail fail fail this function is not going to work
#endif

int main(void) {
  return locale_charset ();
}

@eli-schwartz
Copy link
Member

Meson has never required headers for has_function to work because proper build systems intentionally smooth this over in order to guarantee compilers won't have an issue either way. You can specify which header is needed if you want though.

By proper build systems, I mean the ones that didn't have incredible issues during the porting work to make the OSS landscape work with GCC 14 / clang 16. Having build system checks return false information about the system and as a result make incorrect selections for system interfaces is... bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants