Back to wiki

RCS History

/ TOP / supported-platforms.mdwn

Revision 1.23


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

__Microsoft Windows__  *(stable)*

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 and runtime startup code.

__Fedora Core 8__ *(stable)*

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

__Debian GNU/Linux 4.0r0__

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

__SuSE Linux Ent Svr 10__

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

__Mandriva Corporate Server 4.0__

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

__Red Hat Ent Linux 5__

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

__Ubuntu Linux 8.04__ *(stable)*

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

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 runtime startup code.
  
    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)__ *(stable)*

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)__  *(i386 stable, mips/arm/powerpc experimental)*

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) \

__NetBSD 1.6.2 (i386)__

pcc can be built on NetBSD 1.6.2.  Since the system compiler is gcc 2.95 and not fully c99 compliant, a slight modification to pcc is required.  In pass1.h the flexible array should be replaced with the gcc-specified "zero-length" array.  The build will continue to completion and work fine.

You'll also need to modify the cdefs.h, stdarg.h and stdlib.h as for more recent NetBSD releases.

__OpenBSD 4.6 (and later...)__

pcc should compile and run just fine.  Note that -Werror must be removed from some parts of the system Makefiles since pcc does more type correctness checks than the gcc version that follows the system.


__Mac OS X 10.4 (powerpc)__  *(experimental)*

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

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)__  *(experimental)*

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

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

__Mac OS X 10.5 (intel)__  *(stable)*

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

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.

__FreeBSD 7__ 

You must build and install the pcc-libs module which contains libpcc.a for C99 long long math support.

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.

__Solaris 10 x86__  *(stable)*

It's possible to cross-build pcc to a fresh solaris 10 installation.  Although solaris 10 has a toolchain in /usr/ccs/bin, there isn't a cc compiler.  To cross-build pcc for solaris 10:

- tar /usr/include and /lib on the solaris system and transfer these directories to /usr/local/i386-solaris on the build system
- build a pcc cross-compiler on the build system: ./configure --target=i386-solaris&& make&& make install
- build GNU binutils on the build system: ./configure --target=i386-solaris&& make&& make install

Now you have a full solaris development system on your build machine.  The next step is to build pcc to run on the solaris system:

- cross-build pcc for the solaris host: CC=i386-solaris-pcc ./configure --host=i386-solaris --target=i386-solaris
- cross-build libpcc for the solaris host: CC=i386-solaris-pcc ./configure --target=i386-solaris

Now you have pcc compiled to run on the solaris system.  Transfer these files to the solaris system:

- transfer pcc (/usr/local/bin), cpp (/usr/local/libexec), ccom (/usr/local/libexec), libpcc.a (/usr/local/lib/pcc/i386-solaris/0.9.9/lib/) to solaris system
- ensure /usr/ccs is in the path on the solaris system
- pcc should now run as the system compiler - you will need to update some solaris header files (see below)

The pcc compiler can now be used on the solaris system to build itself:

- download m4-1.4.1.tar.gz, configure and install
- download flex-2.5.34, configure and install
- download pcc, configure and install

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

Additionally, stdargs.h doesn't work correctly.  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

Powered by rcshistory.cgi 0.3