building NetBSD with pcc

NetBSD的安装、升级、更新等日常问题请在这里讨论。

版主: lionux

回复
头像
lionux
锌 Zn
帖子: 457
注册时间: 2010-02-04 11:09

building NetBSD with pcc

帖子 lionux » 2010-06-09 11:26

http://blog.netbsd.org/tnf/entry/portable_c_compiler
Portable C Compiler

June 07, 2010 posted by Iain Hibbert


After reading about progress with the Portable C Compiler (PCC) last year, I was inspired to try building it on NetBSD. Gregory McGarry had done some work integrating it into the toolchain though it is not yet useable to build a full release, but the native build framework in external/bsd/pcc was incomplete.

I updated this a while ago so that it is possible to build a distribution or release containing pcc(1), pcpp(1) and ccom(1) binaries for the target architecture by setting the following two variables in your /etc/mk.conf or passing them to build.sh on the commandline
MKPCC=yes
MKPCCCMDS=yes


There had been many bug fixes and features added since previous import in September 2009, but the major addition was that GCC compatibility is now enabled by default, and many commonly used attributes and builtin functions are now supported. I had heard of people trying to use pcc to build a kernel without success and went for an alternative approach, building userland programs, as my feeling was that testing smaller code units would be a lot easier. I wrote a script (src/external/bsd/pcc/prepare-import.sh) to configure the PCC sources for import to NetBSD in a consistent manner, and have been using it to follow development for a few months, reporting problems along the way where I could.

The latest pcc can build all of bin/ and sbin/, most of games/ (except for dab(6) which is C++), and only a few issues remain in usr.bin/ and usr.sbin/. There are still issues outstanding with PIC support on i386 at least, which prevents building shared libraries within the NetBSD framework at this time, though this can be worked around by setting MKPIC=no.

The in-tree version has been updated and is now at "pcc 0.9.9 [20100603]" which I've been using successfully on i386 though there is support included for amd64, arm, hppa, mips, powerpc, sparc64 & vax CPUs which may also work.

All the credit and many thanks go to Anders Magnusson who has been working on pcc for many years, he is very responsive to problem reports, sometimes with fixes posted the same day.

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

帖子 leo » 2010-06-10 9:26

也摘录一段吧,感觉路还很长:
更简洁、更小巧、更快速,最重要是采用BSD许可协议的编译器PCC被引入进 OpenBSD CVS和NetBSD pkgsrc,作为新的源码维护工具。PCC编译器的基础是S. C. Johnson在70年代写的原始Portable C Compiler,虽然新版的大部分代码都经过了重写,但一些基础部分仍然被保留。PCC并非是bug免疫,但可编译x86平台的用户空间,现在它将担负起GCC原先做的工作。PCC编译速度比GCC快5到10倍,能生产出更可靠的代码。

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 4 访客