Can't build Go support in gcc-4.8.1 on OpenBSD

Ian Lance Taylor
Sat Sep 28 19:27:00 GMT 2013

On Sat, Sep 28, 2013 at 12:20 AM, niXman <> wrote:
> I successfully build gcc-4.8.1 with c,c++,fortran support on OpenBSD
> pre-5.4 using patches from ports, but I can't build with Go support.
> Also I successfully build gcc-4.6.x with c,c++,fortran,go support.
> The problem is that OpenBSD has no ucontext.h header.
> Error message:
> In file included from ../../../../unpack/gcc-4.8.1/libgo/runtime/go-main.c:17:0:
> ../../../../unpack/gcc-4.8.1/libgo/runtime/runtime.h:18:22: fatal
> error: ucontext.h: No such file or directory
>  #include <ucontext.h>
>                       ^
> compilation terminated.

The current implementation of goroutines in gccgo requires the
makecontext, getcontext, and setcontext functions.  Those functions
were standardized in POSIX-1.2001 but then removed in POSIX-1.2008
with no replacement.  Most systems provide them for backward
compatibility.  However, it is possible that OpenBSD does not.  I
really don't know.

It's possible to fix this by writing processor-dependent functions
that would serve the same purpose as the *context functions, and in
fact that would be more efficient.  But I have not actually done this.


More information about the Gcc-help mailing list