git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: build is broken on FreeBSD if libsysinfo is installed

From
Eli Schwartz <eschwartz@gentoo.org>
Date
Jul 2, 2025, 18:32 UTC
Message-ID
<b57b1418-2179-480c-92a3-a107388d71f2@gentoo.org>
In-Reply-To
<d3b912ca-ba5a-4b56-81d1-0e8a10055d83@ramsayjones.plus.com>
On 7/1/25 4:03 PM, Ramsay Jones wrote:
Show 17 quoted lines
> The patch is below. (I didn't write a commit message ;) ).
> 
> Does this work for you?
> 
> ATB,
> Ramsay Jones
> 
> ---- >8 ----
> From: Ramsay Jones <ramsay@ramsayjones.plus.com>
> Date: Tue, 1 Jul 2025 20:33:44 +0100
> Subject: [PATCH] build: fix FreeBSD sysinfo build failure
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>  configure.ac | 61 ++++++++++++++++++++++++++++++----------------------
>  meson.build  | 10 +++++----
>  2 files changed, 41 insertions(+), 30 deletions(-)
Show 27 quoted lines
> diff --git a/meson.build b/meson.build
> index 7fea4a34d6..355cad730c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1331,10 +1331,6 @@ if host_machine.system() != 'windows'
>    endif
>  endif
>  
> -if compiler.has_member('struct sysinfo', 'totalram', prefix: '#include <sys/sysinfo.h>')
> -  libgit_c_args += '-DHAVE_SYSINFO'
> -endif
> -
>  if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
>    libgit_c_args += '-DUSE_ST_TIMESPEC'
>  elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
> @@ -1449,6 +1445,12 @@ if compiler.has_header('sys/sysctl.h')
>    endif
>  endif
>  
> +if not has_bsd_sysctl
> +  if compiler.has_member('struct sysinfo', 'totalram', prefix: '#include <sys/sysinfo.h>')
> +    libgit_c_args += '-DHAVE_SYSINFO'
> +  endif
> +endif
> +
>  if not meson.is_cross_build() and compiler.run('''
>    #include <stdio.h>

This seems reasonable to me. has_member only does a compile-check, not linkage, so we can't know if it's a BSD port. Only using it when a previously checked interface can't be found, lets us avoid doing extraneous work though.

-- 
Eli Schwartz
Previous: Patrick Steinhardt
Message 14 of 14 in “Bug: build is broken on FreeBSD if libsysinfo is installed”
  1. Renato BotelhoJun 23, 2025
  2. Renato BotelhoJul 1, 2025
  3. Eric SunshineJul 1, 2025
  4. Ramsay JonesJul 1, 2025
  5. Renato BotelhoJul 2, 2025
  6. Junio C HamanoJul 2, 2025
  7. Renato BotelhoJul 2, 2025
  8. Ramsay JonesJul 2, 2025
  9. Junio C HamanoJul 2, 2025
  10. Ramsay JonesJul 2, 2025
  11. Patrick SteinhardtJul 3, 2025
  12. Renato BotelhoJul 3, 2025
  13. Patrick SteinhardtJul 3, 2025
  14. Eli SchwartzJul 2, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.