digitalmars.D - basic incomplete NetBSD support
- Thomas Klausner (56/56) Jan 30 2011 Content-Disposition: inline
Content-Disposition: inline Hi! Since it looked like I would need D for a project, I started porting it to NetBSD. The project has been cancelled in the meantime, but I don't want my patches to be lost, so I offer them here for inclusion. Most of the time, NetBSD can be handled just like FreeBSD. Following this rule, I got dmd to compile rather quickly; however, I didn't get it to compile a simple d program. int main() { return 42; } ./work/dmd2/src/dmd/dmd -Iwork/dmd2/src/druntime/import -Iwork/dmd2/src/phobos/ foo.d -L-Lwork/dmd2/src/phobos/generated/freebsd/release work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(thread_e9_897.o): In function `thread_suspendHandler': src/core/thread.d:(.text.thread_suspendHandler+0x91): warning: warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(runtime_d7_76e.o): In function `runModuleUnitTests': src/core/runtime.d:(.text.runModuleUnitTests+0x4d): warning: warning: reference to compatibility sigaction(); include <signal.h> for correct reference work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(thread_eb_258.o): In function `_D4core6thread6Thread5sleepFS4core4time8DurationZv': src/core/thread.d:(.text._D4core6thread6Thread5sleepFS4core4ti e8DurationZv+0x65): warning: warning: reference to compatibility nanosleep(); include <time.h> to generate correct reference work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(thread_e9_897.o): In function `thread_suspendHandler': src/core/thread.d:(.text.thread_suspendHandler+0x74): warning: warning: reference to compatibility sigdelset(); include <signal.h> for correct reference work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(runtime_d7_76e.o): In function `runModuleUnitTests': src/core/runtime.d:(.text.runModuleUnitTests+0x23): warning: warning: reference to compatibility sigfillset(); include <signal.h> for correct reference work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(memory_568_620.o): In function `_D2rt6memory16initStaticDataGCFZv': src/rt/memory.d:(.text._D2rt6memory16initStaticDataGCFZv+0x7): undefined reference to `__data_start' work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(runtime_d7_76e.o): In function `_D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5posix6signal9siginfo_tPvZv': src/core/runtime.d:(.text._D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5posix6signal9 iginfo_tPvZv+0x28): undefined reference to `backtrace' src/core/runtime.d:(.text._D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5posix6signal9 iginfo_tPvZv+0x38): undefined reference to `backtrace_symbols_fd' work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(memory_566_5d0.o): In function `rt_stackBottom': src/rt/memory.d:(.text.rt_stackBottom+0x4): undefined reference to `__libc_stack_end' work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(runtime_d8_792.o): In function `_D4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo16DefaultTraceInfo6__ctorMFZC4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo16DefaultTraceInfo': src/core/runtime.d:(.text._D4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo16DefaultTraceInfo6__ctorMFZC4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo16Def ultTraceInfo+0x2b): undefined reference to `backtrace' src/core/runtime.d:(.text._D4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo16DefaultTraceInfo6__ctorMFZC4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo16Def ultTraceInfo+0x3e): undefined reference to `backtrace_symbols' work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(dmain2_513_2f9.o): In function `rt_init': src/rt/dmain2.d:(.text.rt_init+0x1c): undefined reference to `__data_start' work/dmd2/src/phobos/generated/freebsd/release/libphobos2.a(thread_e8_713.o): In function `thread_entryPoint': src/core/thread.d:(.text.thread_entryPoint+0x8a): undefined reference to `_pthread_cleanup_push' src/core/thread.d:(.text.thread_entryPoint+0xc7): undefined reference to `_pthread_cleanup_pop' --- errorlevel 1 That's when I started looking at the runtime in more detail and found that the header files (in C terms; is that the correct term for D?) have cases for every operating system separately. The last patches in the patch set started addressing this issue, but I got exhausted, since basically I wanted to use the FreeBSD case for now and just add NetBSD cases where needed (like for errno). It seems that my port is using Linux as operating system (e.g. patch-bh changes the Linux case to reduce errors), so I must have made an error in the operating system checks as well. My patchset against dmd.2.051.zip is attached. It touches some Makefiles, which you can probably skip, and the patches for the runtime definitely need more work. Is someone interested in working on this? I'm not sure how much time I can spend on this now, since, as I said, the project for which I wanted dmd has been cancelled. Cheers, Thomas
Jan 30 2011