Back to wiki

RCS History

/ TOP / supported-platforms.mdwn

Revision 1.16


The following list describes steps to make PCC the system compiler.

__Microsoft Windows__

Snapshots are now available from the [pcc ftp server](http://pcc.ludd.ltu.se/ftp/pub/win32/) which include all the executables and libraries.  Alternatively, you can build your own system using the following instructions.

You must install the w32api and mingw-runtime libraries available from the [pcc ftp server](http://pcc.ludd.ltu.se/ftp/pub/win32/).  These libraries expand into the /usr/local/i386-pe/ directory.  You can copy these files to your windows machine and follow the directions [here](http://pcc.ludd.ltu.se/building/) for compiling on the Microsoft Windows platform.

You must also build and install the pcc-libs module which contains libpcc.a.

__Debian GNU/Linux 4.0r0__

You must build and install the pcc-libs module which contains libpcc.a and stddef.h header files.

__SuSE Linux Ent Svr 10__

You must build and install the pcc-libs module which contains libpcc.a and stddef.h header files.

__Mandriva Corporate Server 4.0__

You must build and install the pcc-libs module which contains libpcc.a and stddef.h header files.

__Red Hat Ent Linux 5__

You must build and install the pcc-libs module which contains libpcc.a and stddef.h header files.

__Ubuntu Linux 8.04__

You must build and install the pcc-libs module which contains libpcc.a and stddef.h header files.

The alloca.h glibc header file is broken so alloca() doesn't work.  The header file undefines alloca and then fails to set it to something useful if _GNUC_ is not defined.

Try putting the following into /usr/local/include/pcc/alloca.h:

    #ifndef _ALLOCA_H
    #define _ALLOCA_H

    #include <features.h>

    #define __need_size_t
    #include <stddef.h>

    __BEGIN_DECLS

    /* Remove any previous definitions.  */
    #undef  alloca

    /* Allocate a block that will be freed when the calling function exits.  */
    extern void *alloca (size_t __size) __THROW;

    #if defined(__GNUC__) || defined(__PCC__)
    # define alloca(size)   __builtin_alloca (size)
    #endif /* GCC.  */

    __END_DECLS

    #endif /* alloca.h */

__Ubuntu Linux: Intrepid Ibex 8.10__
  
You must build and install the pcc-libs module which contains libpcc.a and stddef.h header files.
  
    me@MY-BOX:~$ cvs -d :pserver:anonymous@pcc.ludd.ltu.se:/cvsroot co pcc-libs  
    me@MY-BOX:~$ cd pcc-libs  
    me@MY-BOX:~/pcc-libs$ ./configure  
    me@MY-BOX:~/pcc-libs$ make  
    me@MY-BOX:~/pcc-libs$ sudo make install  
  
Then build and install pcc  
  
    me@MY-BOX:~$ cvs -d :pserver:anonymous@pcc.ludd.ltu.se:/cvsroot co pcc  
    me@MY-BOX:~$ cd pcc  
    me@MY-BOX:~/pcc$ ./configure  
    me@MY-BOX:~/pcc$ gedit cc/cpp/Makefile cc/ccom/Makefile&  
  
delete the "-Werror" from the "CFLAGS =" line in both files and save  
  
    me@MY-BOX:~/pcc$ make  
    me@MY-BOX:~/pcc$ sudo make install  
  
__MidnightBSD-current (i386/sparc64)__

Unless you're using the MirPorts Framework to install pcc, you must build and install the pcc-libs module.

__MirBSD-current (i386)__

The MirPorts Framework contains a tested snapshot in lang/pcc, which works without the pcc-libs module, as the required quad functions are all part of libc.

Building pcc from source (including bootstrapping) is possible as well.

The necessary header changes are integrated starting MirBSD #10. It is, however, not possible yet to compile MirBSD itself with pcc; using it as ports compiler is planned.

__NetBSD-current (i386/mips/arm/powerpc)__

NetBSD-current (to be released as NetBSD 5.0) should contain support for PCC to build applications.

Currently it is not possible to build the complete NetBSD operating system with build.sh using PCC.

__NetBSD 4.0 (i386/mips/arm/powerpc)__

NetBSD 4.0 needs at least this change:

    --- sys/sys/cdefs.h     13 Nov 2006 05:44:37 -0000      1.64
    +++ sys/sys/cdefs.h     12 Apr 2008 13:30:29 -0000
    @@ -245,7 +245,7 @@
     #endif /* _KERNEL */
     
     #if !defined(_STANDALONE)&& !defined(_KERNEL)
    -#ifdef __GNUC__
    +#if defined(__GNUC__) || defined(__PCC__)
     #define        __RENAME(x)     ___RENAME(x)
     #else
     #ifdef __lint__

and for varargs to work on arm:

    --- sys/arch/arm/include/stdarg.h    11 Dec 2005 12:16:47 -0000      1.9
    +++ sys/arch/arm/include/stdarg.h    12 Apr 2008 13:36:13 -0000
    @@ -46,7 +46,7 @@
     #define        __builtin_va_copy(d, s)         ((d) = (s))
     #endif
     
    -#if __GNUC_PREREQ__(2, 96)
    +#if (__GNUC_PREREQ__(2, 96) || defined(__PCC__))
     #define        va_start(ap, last)      __builtin_stdarg_start((ap), (last))
     #define        va_arg                  __builtin_va_arg
     #define        va_end                  __builtin_va_end

A similar change may be required for other platforms as well.

__NetBSD 3.0 (i386/mips/arm/powerpc)__

The following patch is required:

    --- cdefs.h.orig   2007-12-02 16:45:11.000000000 -0300
    +++ cdefs.h     2007-11-27 02:09:52.000000000 -0300
    @@ -92,7 +92,7 @@
     #define        __const         const           /* define reserved names to standard */
     #define        __signed        signed
     #define        __volatile      volatile
    -#if defined(__cplusplus)
    +#if defined(__cplusplus) || defined(__PCC__)
     #define        __inline        inline          /* convert to C++ keyword */
     #else
     #if !defined(__GNUC__)&& !defined(__lint__)
    @@ -201,6 +201,10 @@
     #define        __packed        __attribute__((__packed__))
     #define        __aligned(x)    __attribute__((__aligned__(x)))
     #define        __section(x)    __attribute__((__section__(x)))
    +#elif defined(__PCC__)
    +#define        __packed        /* not yet */
    +#define        __aligned(x)    /* not yet */
    +#define        __section(x)    /* not yet */
     #elif defined(__lint__)
     #define        __packed        /* delete */
     #define        __aligned(x)    /* delete */
    @@ -245,7 +249,7 @@
     #endif /* _KERNEL */
 
     #if !defined(_STANDALONE)&& !defined(_KERNEL)
    -#if defined(__GNUC__)
    +#if defined(__GNUC__) || defined(__PCC__)
     #define        __RENAME(x)     ___RENAME(x)
     #else
     #ifdef __lint__
    --- stdlib.h.orig       2007-12-02 16:47:42.000000000 -0300
    +++ stdlib.h    2007-11-30 19:48:58.000000000 -0300
    @@ -237,6 +237,8 @@
     #if defined(alloca)&& (alloca == __builtin_alloca)
           && defined(__GNUC__) && (__GNUC__ < 2)
     void   *alloca(int);     /* built-in for gcc */ 
    +#elif defined(__PCC__)
    +#define alloca(size)   __builtin_alloca(size)
     #else 
     void   *alloca(size_t); 
     #endif /* __GNUC__ */

Additionally, for stdargs to work properly, changes to the machine-dependent stdargs.h is required (something like this):

    --- mips/stdarg.h.orig       2007-12-02 17:02:55.000000000 -0300
    +++ mips/stdarg.h    2007-12-02 17:01:59.000000000 -0300
    @@ -59,6 +59,13 @@
     #define va_end(ap)             __builtin_va_end((ap))
     #define __va_copy(dest, src)   __builtin_va_copy((dest), (src))
 
    +#elif defined(__PCC__)
    +
    +#define va_start(ap, last)     __builtin_stdarg_start((ap), last)
    +#define va_arg(ap, type)       __builtin_va_arg((ap), type)
    +#define va_end(ap)             __builtin_va_end((ap))
    +#define __va_copy(dest, src)   __builtin_va_copy((dest), (src))
    +
     #else
 
     #define        va_start(ap, last) \

__Mac OS X 10.4 (powerpc)__

You must build and install the pcc-libs module which contains libpcc.a

Additionally, stdargs.h only works with gcc.  Paste the following lines into /usr/local/lib/pcc/stdarg.h:

    #ifndef _STDARG_H_
    #define _STDARG_H_

    #define va_list char *
    #define _VA_LIST

    #define va_start(ap, last)      __builtin_stdarg_start((ap), last)
    #define va_arg(ap, type)        __builtin_va_arg((ap), type)
    #define va_end(ap)              __builtin_va_end((ap))
    #define va_copy(dest, src)      __builtin_va_copy((dest), (src))

    #endif

__Mac OS X 10.5 (powerpc)__

You must build and install the pcc-libs module which contains libpcc.a.

Some of the issues may apply from OS X 10.4 discussed above.

__Mac OS X 10.5 (intel)__

You must build and install the pcc-libs module which contains libpcc.a.

OS X on intel has a bug in /usr/include/libkern/_OSByteOrder.h for non-GNU compilers.
uint16_t, uint32_t and uint64_t are not defined in this case.  Copy the file to /usr/local/include/pcc/libkern and replace the undefined types with
__uint16_t, __uint32_t and __uint64_t respectively.

Some of the issues may apply from OS X 10.4 discussed above.

Currently has a bug with 16-byte stack alignment.

__FreeBSD 7__

You probably want to add something like this to sys/cdefs.h. 

    --- cdefs.h.orig 2009-01-05 13:34:21.000000000 +0100 
    +++ cdefs.h 2009-01-05 13:35:39.000000000 +0100 
    @@ -221,6 +221,15 @@ 
    #define __aligned(x) __attribute__((__aligned__(x))) 
    #define __section(x) __attribute__((__section__(x))) 
    #endif 
    +#if defined(__PCC__) 
    +#define __dead2 __attribute__((__noreturn__))
    +#define __pure2 __attribute__((__const__)) 
    +#define __unused __attribute__((__unused__)) 
    +#define __used __attribute__((__used__)) 
    +#define __packed __attribute__((__packed__)) 
    +#define __aligned(x) __attribute__((__aligned__(x))) 
    +#define __section(x) __attribute__((__section__(x))) 
    +#endif 
     #endif 
  
    #if __GNUC_PREREQ__(2, 96) 

This patch only works if you have pcc compiled with GCC_COMPAT (which is the default).  Otherwise you want to use the _Pragmas() as shown in patches for other operating systems.

Powered by rcshistory.cgi 0.3