Re: Build fails on NetBSD

Subject: Re: Build fails on NetBSD

Date: Tue, 13 Oct 2026 19:25:22 +0200

To: notmuch@notmuchmail.org, Frank Seifferth

Cc:

From: Anton Khirnov


Hi Frank,
Quoting Frank Seifferth (2026-10-13 18:57:02)
> Hi everyone,
> 
> building the latest version (as of commit f5e58cdb9b) fails on NetBSD with
> the following error message:
> 
> [...]
> CXX  -g -O2 lib/index.o
> lib/index.cc: In function ‘void _filter_attachment(notmuch_message_t*, const char*, const char*, const char*, char**, size_t*)’:
> lib/index.cc:556:12: error: ‘environ’ was not declared in this scope; did you mean ‘union’?
>   556 |     while (environ[num_env])
>       |            ^~~~~~~
>       |            union
> lib/index.cc:566:23: error: ‘environ’ was not declared in this scope; did you mean ‘union’?
>   566 |     for (num_env = 0; environ[num_env]; num_env++) {
>       |                       ^~~~~~~
>       |                       union
> gmake: *** [Makefile.local:210: lib/index.o] Error 1
> 
> Apparently, environ is implicitly declared on Linux but not on NetBSD.
> At least that's how I interpret the following docs:
> https://www.gnu.org/software/gnulib/manual/html_node/environ.html.
> I am not sure what the proper fix for this issue should look like. The
> patch included below at least seems to fix the build process. If someone
> understands the issue better than I do, feel free to suggest a better
> alternative.

Sorry for the breakage, it was introduced by me. According to [1] and
[2], your patch seems like the correct solution.

[1] https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html
[2] environ(7) from Linux manpages

Cheers,
-- 
Anton Khirnov
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: