January 2026

Golang compiler CLI options CGO_CFLAGS_ALLOW

I do a lot of building Golang across platforms (honestly I just prefer the work flow under OS X) but frequently you see messages like

% go build
gopkg.in/gographics/imagick.v3/imagick: invalid flag in pkg-config --cflags: -Xpreprocessor


And then Google fails me when you search for the error. It turns out the problem is trivial to fix and that the specific Google search finds lots of things relating to things other than the problem.

The solution:

% env CGO_CFLAGS_ALLOW="-Xpreprocessor" go build


Read More...