From: Reto <reto@labrat.space>
To: Peter Lawrence <peter@peterlawrence.org>
Cc: notmuch@notmuchmail.org
Subject: Re: macOS and go language bindings
Date: Sun, 26 Nov 2023 14:11:26 +0100 [thread overview]
Message-ID: <z4ccamugmimacuyffmpxkxoodql2ao56plch4djn5qvvbmrwbs@l4y6a7fyibsy> (raw)
In-Reply-To: <CX4SJ8QUVM8O.19W4WP96Y15ON@peterlawrence.org>
Hi both,
I realize I am a bit late to the party, nevertheless here's some information.
> I'm trying to build an email client (aerc) with support for notmuch
> on macOS. aerc is written in go. I can't find an aerc package for brew
> which includes notmuch headers/library files. Where can I get these
> language bindings and how do I "install" them, or where do I place them
> in the aerc source directory to get the notmuch library built and then
> accessible to aerc?
You are confusing things here.
Aerc wrote their own go notmuch bindings which uses the C library directly.
Stuff in contrib/ doesn't matter whatsoever.
So you don't install the "language bindings", it's part of the aerc source
already.
All you need to make sure is that the C compiler go invokes finds the dependencies.
Meaning you need libnotmuch installed or build from source.
> GO111MODULE
> Controls whether the go command runs in module-aware mode or GOPATH mode.
> May be "off", "on", or "auto".
> See https://golang.org/ref/mod#mod-commands.
>
> So, I set my GO111MODULE to off with this command:
> go env -w GO111MODULE="off"
Do not mess with that, aerc is a proper module aware source.
`Go build` will fetch the go dependencies it needs automatically.
> I wonder if anyone proficient with Go might know how to get the source
> to build against a Go 1.20+ version?
If by source you mean aerc, make will do (within their source tree).
However, you need to make sure that your C compiler is setup properly.
Go will execute a C compiler / linker as usual.
In your case, you basically need to setup 2 things:
1) notmuch.h in some include dir, normally /usr/include/notmuch.h or some such,
which is needed by the compiler.
2) libnotmuch.so, which is normally located at /usr/lib/libnotmuch.so or some such,
which is needed by the linker.
I have no clue where brew stores those things, shouldn't be too hard to figure out though.
Assuming that's not in some standard dir your C compiler / linker already look (else the build would work)
you can override that by setting some env vars.
CGO_CFLAGS: set that to "-I/usr/include" where /usr/include is the folder where notmuch.h resides
CGO_LDFLAGS: set that tho "-L/usr/lib" where /usr/lib is the folder where libnotmuch.so resides.
That will make the C side of things do what you expect.
The rest is handled by go.
Cheers,
Reto
next prev parent reply other threads:[~2023-11-26 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 1:51 macOS and go language bindings Peter Lawrence
2023-11-21 19:19 ` Carl Worth
2023-11-21 21:00 ` Peter Lawrence
2023-11-21 21:38 ` Carl Worth
2023-11-26 13:11 ` Reto [this message]
2023-11-26 13:29 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=z4ccamugmimacuyffmpxkxoodql2ao56plch4djn5qvvbmrwbs@l4y6a7fyibsy \
--to=reto@labrat.space \
--cc=notmuch@notmuchmail.org \
--cc=peter@peterlawrence.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).