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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/07/25 17:03, Ramsay Jones wrote:


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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux