Hi tech@, I'm working on a port for lang/dart and got stuck on ucontext.h compile errors. The first one was quite easy, changing sys/ucontext.h to signal.h since ucontext_t is defined there
sys/signal.h: typedef struct sigcontext ucontext_t; This allowed me to move forward and stop on the next bit: In file included from runtime/vm/thread_interrupter.h:9:0, from runtime/vm/profiler.h:13, from runtime/vm/dart.ca c:22: runtime/vm/signal_handler.h:49:44: error: 'mcontext_t' does not name a type static uintptr_t GetProgramCounter(const mcontext_t& mcontext); ^ runtime/vm/signal_handler.h:50:42: error: 'mcontext_t' does not name a type Which lead me to a hunt on how other parts of base/ports handle this. I grepped /usr/src and found something interesting. /gnu/gcc/gcc/config/pa/hpux-unwind.h which contains a: #include <sys/ucontext.h> Now taking this example C program: $ cat dead.c #include <sys/ucontext.h> int main(int argc, char *argv[]) { return 0; } $ and trying to compile it: $ make dead cc -O2 -pipe -o dead dead.c dead.c:1:26: error: sys/ucontext.h: No such file or directory *** Error 1 in /home/mulander/code/c (<sys.mk>:85 'dead') We can see that sys/ucontext.h is not present. Hence the hpux-unwind.h header file must be dead code. Grepping src I found some more occurrences, all in base gcc (minus some changelog/comment entries). Should header files including sys/ucontext.h be removed along with their paired .c files? ./gnu/gcc/fixincludes/ChangeLog: * tests/base/sys/ucontext.h: New file. ./gnu/gcc/fixincludes/fixincl.x: "|sys/ucontext.h|"; ./gnu/gcc/fixincludes/inclhack.def:/* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines ./gnu/gcc/fixincludes/inclhack.def: files = "sys/ucontext.h"; ./gnu/gcc/fixincludes/tests/base/sys/ucontext.h: "fixinc/tests/inc/sys/ucontext.h" ./gnu/gcc/gcc/config/alpha/linux-unwind.h:#include <sys/ucontext.h> ./gnu/gcc/gcc/config/i386/linux-unwind.h:#include <sys/ucontext.h> ./gnu/gcc/gcc/config/i386/linux-unwind.h:/* There's no sys/ucontext.h for glibc 2.0, so no ./gnu/gcc/gcc/config/i386/linux-unwind.h:#include <sys/ucontext.h> ./gnu/gcc/gcc/config/ia64/linux-unwind.h:#include <sys/ucontext.h> ./gnu/gcc/gcc/config/mips/linux-unwind.h: * struct ucontext from sys/ucontext.h so this private copy is used. */ ./gnu/gcc/gcc/config/pa/hpux-unwind.h:#include <sys/ucontext.h> ./gnu/gcc/gcc/config/pa/linux-unwind.h:#include <sys/ucontext.h> ./gnu/gcc/gcc/config/rs6000/host-darwin.c:#include <sys/ucontext.h> ./gnu/gcc/gcc/config/sh/linux-unwind.h:#include <sys/ucontext.h> ./gnu/usr.bin/binutils/gdb/s390-nat.c:#include <sys/ucontext.h> ./gnu/usr.bin/binutils/gdb/sparc-nat.c: fp_status' in <sys/ucontext.h>, which is automatically included by ./gnu/usr.bin/binutils/gdb/user-regs.c: <sys/ucontext.h> includes <sys/procfs.h> includes <sys/user.h>, which ./gnu/usr.bin/binutils/gdb/osf-share/cma_tcb_defs.h:# include <sys/ucontext.h> ./gnu/usr.bin/gcc/gcc/ChangeLog: sys/ucontext.h inclusion in ifndef USE_GNULIBC_1. ./gnu/usr.bin/gcc/gcc/ChangeLog.7: including signal.h and sys/ucontext.h, not needed. ./gnu/usr.bin/gcc/gcc/ChangeLog.7: to avoid clash with Irix header file sys/ucontext.h. Rename gp_regs ./gnu/usr.bin/gcc/gcc/config/alpha/linux.h:#include <sys/ucontext.h> ./gnu/usr.bin/gcc/gcc/config/i386/linux.h:/* There's no sys/ucontext.h for some (all?) libc1, so no ./gnu/usr.bin/gcc/gcc/config/i386/linux.h:#include <sys/ucontext.h> ./gnu/usr.bin/gcc/gcc/config/i386/linux64.h:#include <sys/ucontext.h> ./gnu/usr.bin/gcc/gcc/config/ia64/linux.h:#include <sys/ucontext.h> PS. I would greatly appreciate If anyone pointed me at a file that still defines mcontext_t or an acceptable workaround :) Regards, -- Adam Wolk adam.w...@koparo.com