Page MenuHomePhabricator

latest varnishkafka fails to build on Debian
Closed, ResolvedPublic

Description

varnishkafka fails to build on Debian due to the use of the _BSD_SOURCE macro, which was deprecated starting with glibc version 2.20, included in Debian 9 (stretch) and later. This deprecated use of _BSD_SOURCE triggers a warning, which is treated as an error due to the -Werror flag in the Makefile.

Simply deleting the use of this macro (varnishkafka.c line 33) causes the build to succeed and presumably everything to work properly. The comment on that line says that the macro is needed for daemon(), but that function is apparently in glibc's default feature set anyway.

Event Timeline

@Jrdnch thank you for reporting, but as you can see, the Varnish project is archived now, wondering if you could pick another project? Or otherwise we can just decline or invalid this task?

elukey subscribed.

Going to triage/work on it as part of Analytics, thanks :)

@Liuxinyu970226 Thanks, I wasn't aware that the Varnish project is archived.

Very nice, just read http://man7.org/linux/man-pages/man3/daemon.3.html

daemon():
    Since glibc 2.21:
        _DEFAULT_SOURCE
    In glibc 2.19 and 2.20:
        _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
    Up to and including glibc 2.19:
        _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)

@Jrdnch this issue will be probably fixed/worked on next quarter since it doesn't seem super pressing for our use case, but if you have time and you'd want to help feel free to send a patch!

I can submit a patch. Thanks for the man page, that's helpful.

My patch would probably just remove the _BSD_SOURCE macro, since daemon() has been in _DEFAULT_SOURCE since glibc 2.19. The patch would introduce a dependency on glibc 2.19 or later.

It looks like glibc 2.19 was released in 2014. It's in Ubuntu 14.04 and Debian 8. Is that too recent? Alternatively, I could check the glibc version and conditionally enable _BSD_SOURCE. I think it's probably fine to leave it out, since varnishkafka requires librdkafka 0.9, which was released in 2016.

I can submit a patch. Thanks for the man page, that's helpful.

My patch would probably just remove the _BSD_SOURCE macro, since daemon() has been in _DEFAULT_SOURCE since glibc 2.19. The patch would introduce a dependency on glibc 2.19 or later.

It looks like glibc 2.19 was released in 2014. It's in Ubuntu 14.04 and Debian 8. Is that too recent? Alternatively, I could check the glibc version and conditionally enable _BSD_SOURCE. I think it's probably fine to leave it out, since varnishkafka requires librdkafka 0.9, which was released in 2016.

Confirmed in https://sourceware.org/glibc/wiki/Glibc%20Timeline, it seems that just removing _BSD_SOURCE would be the easiest thing to do, but it would also be great to highlight it in the documentation (https://github.com/wikimedia/varnishkafka#requirements).

Alright, I'll do both of those things.

Change 422425 had a related patch set uploaded (by Jrdnch; owner: Jrdnch):
[operations/software/varnish/varnishkafka@master] Update to glibc >=2.19

https://gerrit.wikimedia.org/r/422425

Change 422425 merged by Elukey:
[operations/software/varnish/varnishkafka@master] Update to glibc >=2.19

https://gerrit.wikimedia.org/r/422425

elukey claimed this task.

Just merged the change, thanks a lot!

Great, thanks for your help all along the way!