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
Renato Botelho <garga@freebsd.org>
Date
Jul 2, 2025, 11:28 UTC
Message-ID
<818958f6-7387-48f8-a0a8-c050af212069@FreeBSD.org>
In-Reply-To
<d3b912ca-ba5a-4b56-81d1-0e8a10055d83@ramsayjones.plus.com>
On 01/07/25 17:03, Ramsay Jones wrote:
Show 46 quoted lines
> 
> 
> On 01/07/2025 17:05, Renato Botelho wrote:
>> On 23/06/25 11:09, Renato Botelho wrote:
>>> FreeBSD has a libsysinfo package which contains GNU libc's sysinfo port.   Some users reported git 2.50.0 was failing to build when this port is installed and it happened because configure script detected libsysinfo but -lsysinfo was not added to LDFLAGS, ending up with following error:
>>>
>>> scalar.o common-main.o libgit.a xdiff/lib.a reftable/libreftable.a libgit.a -lz -pthread
>>> ld: error: undefined symbol: sysinfo
>>>
>>> This patch [1] was added to git port adding a user option to enable/ disable libsysinfo dependency and fix LDFLAGS when it's enabled.
>>>
>>> I'm not sure about what is best approach for git project in this case.
>>>
>>> [1] https://github.com/freebsd/freebsd-ports/blob/main/devel/git/files/ patch-configure.ac
>>
>> If someone let me know what would be the desired approach here I can work on a patch.  Would you like to make that option conditional as the patch did?  Or detect if OS is FreeBSD and do something different?
>>
> 
> Ah, Sorry for the late reply, but I was away ... :)
> 
> Hmm, I can think of several approaches we could take, but I can't test any
> of them (since I don't have access to a FreeBSD system).
> 
> - it would not be difficult to add a 'library-check' to the configure.ac
>    file, so that '-lsysinfo' would be added to the link. (We would also
>    have to make a similar change to meson.build). However, I don't think
>    this is the right solution; I'm guessing that the compat sysinfo library
>    is implemented in terms of sysctl() anyway, so ...
> 
> - we could simply change the order of the preprocessor conditionals in
>    'builtin/gc.c' L530-541 so that the 'HAVE_SYSINFO' block comes after
>    the 'HAVE_BSD_SYSCTL' block. (BTW, I assume that the HW_ symbols are
>    defined whenever the 'sysinfo compat library' is installed; i.e. old
>    versions of FreeBSD which don't define them are also too old to support
>    the compat library).
> 
> - we could suppress the setting of HAVE_SYSINFO if HAVE_BSD_SYSCTL has
>    been defined (in both configure.ac and meson.build).
> 
> I very quickly knocked up a patch to do the last option above (I moved
> the setting of HAVE_SYSINFO down the file rather that HAVE_BSD_SYSCTL
> up. I guess it doesn't matter, but I gave it *no* thought!).
> 
> The patch is below. (I didn't write a commit message ;) ).
> 
> Does this work for you?

Your patch works just fine for FreeBSD. I tried it with libsysinfo installed and it just ignored it, as expected.

I didn't test meson build since FreeBSD ports is based on autotools yet.

BTW, should I start moving the port to meson? Is it the default build method now? Is there a plan to remove autotools?

Thank you!
-- 
Renato Botelho
Previous: Ramsay JonesNext: Junio C Hamano
Message 5 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.