Porting GDC to QNX

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Mar 30 06:04:44 PDT 2007


Sheff wrote:
> I think I understood what's the problem, the values of POSIX constants are different in linux and QNX (i.e O_CREAT, MAP_ANON, etc ), but in phobos they're defined like in linux, for example:
> In phobos O_CREAT defined like:
> const int O_CREAT = 0100; //0x64
> In linux fcntl.h header:
> #define  O_CREAT 0100 //0x64
> but in QNX fcntl.h header it's defined like this:
> #define  O_CREAT 0400 //0x100
> 0x64 != 0x100, so file creation always fails, so do other system calls.
> What shall I do about it ? I don't want to manually redefine all POSIX constants...

There should be a file called gen_unix.c in the GDC tree (specifically, 
gcc/d/phobos/config/gen_unix.c) that generates data for 
std/c/unix/unix.d when compiled and ran on the target platform. This 
should be automatic for a native build, but IIRC for a cross-build you 
need to do this manually.
(This is mentioned in gcc/d/INSTALL).

You'll want to do the same for gen_config1.c and gen_math.c, and then 
put the output in a directory like gcc/d/phobos/config/qnx (with 
filenames frag-unix, frag-gen and frag-math) and pass 
--enable-phobos-config-dir=<dir> to GDC's ./configure command.

Note: I've never done this myself, this is just from what I remember 
reading in these newsgroups and from looking at the GDC source tree.



More information about the Digitalmars-d mailing list