Following is the list of platforms supported by PCC.
- __Microsoft Windows__ *(stable)*
More information available [[here|build-windows]].
- __Fedora Core 8__ *(stable)*
You must build and install the [[pcc-libs|pcc-libs]] module which contains libpcc.a and runtime startup code.
- __Fedora 11__
In Fedora 11 (and others), the pcc package (group Other) provides the pcc compiler. Should you wish to install a newer version you will need the source code from this site for both pcc and pcc-libs from [pcc-beta](ftp://pcc.ludd.ltu.se/pub/pcc-beta/) or via cvs, along with a working gcc, bison and flex (all available from Fedora packages with the same name).
These instructions assume you have these installed and are retrieving source via cvs, and also have the root password for installation. For users without root access, installation to $HOME is possible using './configure --prefix=$HOME/pccbin/' (and 'export PATH="$PATH:$HOME/pccbin/bin"' to be able to run pcc).
Stage 1: Build pcc using gcc/flex/bison:
cvs -d :pserver:anonymous@pcc.ludd.ltu.se:/cvsroot co pcc
cd pcc
./configure
make CC=gcc
su -c 'make install'
Stage 2: Build pcc-libs with newly built and installed pcc (remember to change arch/i386 as necessary for your architecture):
cd ..
cvs -d :pserver:anonymous@pcc.ludd.ltu.se:/cvsroot co pcc-libs
cd pcc-libs
./configure
make CC=pcc CPPFLAGS+="-I`pwd`/libpcc/include/ -I`pwd`/libsoftfloat/arch/i386/ -I`pwd`/libsoftfloat/"
su -c 'make install'
Stage 3 (Optional): Rebuild pcc using pcc itself (this requires pcc-libs to have been installed):
cd ../pcc
make clean
make CC=pcc
su -c 'make install'
pcc -v
- __Debian GNU/Linux 4.0r0__
You must build and install the [[pcc-libs|pcc-libs]] module which contains libpcc.a and runtime startup code.
- __SuSE Linux Enterprise Server 10__
You must build and install the [[pcc-libs|pcc-libs]] module which contains libpcc.a and runtime startup codes.
- __Mandriva Corporate Server 4.0__
You must build and install the [[pcc-libs|pcc-libs]] module which contains libpcc.a and runtime startup code.
- __Red Hat Enterprise Linux 5__
You must build and install the [[pcc-libs|pcc-libs]] module which contains libpcc.a and runtime startup code.
- __Ubuntu Linux 8.04__ *(stable)*
More information available [[here|build-ubuntu-804]].
- __Ubuntu Linux: Intrepid Ibex 8.10__
You must build and install the [[pcc-libs|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
- __Ubuntu Linux 10.10 (i386/amd64)__
You must build and install the [[pcc-libs|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$ sh -c './configure&& 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$ sh -c './configure&& make all'
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|pcc-libs]] module.
- __MirBSD-current (i386)__ *(stable)*
The MirPorts Framework contains a tested snapshot in lang/pcc, which works without the [[pcc-libs|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/amd64/mips/arm/powerpc)__ *(i386 and amd64 stable, mips/arm/powerpc experimental)*
NetBSD-current 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 5.0 (i386/amd64)__
If you include signal.h in your programs, NetBSD 5.0.x needs at least the following change:
--- signal-orig.h 2011-01-11 16:08:46.000000000 -0800
+++ signal.h 2011-01-11 16:08:11.000000000 -0800
@@ -101,7 +101,11 @@
#endif
#ifndef _SIGINLINE
+#if defined(__GNUC__)&& !defined(__GNUC_STDC_INLINE__)
#define _SIGINLINE extern __inline
+#else
+#define _SIGINLINE __inline
+#endif
#endif
_SIGINLINE int
This should be fixed in more recent releases.
- __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) \
Note that NetBSD 3.0 is no longer in active development.
- __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.
Note that the NetBSD 1.x branches are no longer in active development.
- __OpenBSD 4.6 and later... (i386 stable, other under development)__
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|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|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|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 8 (-current)__
You must build and install the [[pcc-libs|pcc-libs]] module which contains libpcc.a for C99 long long math support.
If you want to compile the system you can use something like:
make CC=/usr/local/bin/pcc WITHOUT_GROFF=1 WITHOUT_CLANG=1 WITHOUT_TOOLCHAIN=1 WITHOUT_BOOT=1 WITHOUT_NS_CACHING=1
the avoided stuff are usually very compiler-specific or contains old unsupported gcc constructs.
- __FreeBSD 7__
You must build and install the [[pcc-libs|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|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