Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Building PCC for "tools" is broken (missing symbol __USE)- PCC bug or NetBSD source tree error?



On Sat, 19 Jul 2014, William D. Jones wrote:

> > it certainly is. I think I remember that __USE() now, it was a local
> > (NetBSD) addition due to a set but unused variable, which is changed in
> > upstream versions now.
> Alright then. What do you suggest I do to reconcile the NetBSD version with
> the current upstream tree? Should I wait for the next major release of PCC,
> and then attempt to integrate the changes, or is there something I can do now
> (to start)?

I will try to import a new version later this week..

or, if you can't wait you can look at the prepare-import.sh script in
external/bsd/pcc which will copy in a pcc checkout to the dist subdir..
since the upstream sources have changed a bit, there would be some changes
to the build files in that folder, and also the set lists and system make
files, see patche attached

> > I am not sure, but it may not.. predictably the GCC developers use GCC
> > language features within their code, and these are not always supported. I
> > have been concentrating on other things lately and have not tried to build
> > GCC with PCC. At least I know that the binutils we have in tree won't
> > build, as there is an unsupported feature which causes an error (restrict
> > keyword in array declaration).
> GCC 4.7.3 and below can in theory (emphasis on theory) be built with a pure
> ANSI C compiler that has a working libc.

one problem is that pcc is defining __GNUC__ by default, so although it
may be possible with an ANSI C or C99 compiler, the sources might assume
that GCC language features are available and they are not complete.

(incidentally, that is partly why I was trying to get pcc to *not* define
that by default.. but I have not had the time to really work at that)

> Versions above 4.7.3 sadly require a C++ compiler. Still, one could compile
> GCC 4.7.3 and use that to create the C++ compiler.

Hm, the gcc we have in tree is 4.8.3 now .. pcc does now include a C++
front end, but I am not sure that it is complete .. in fact I know
something is wrong, since I think it used to compile games/dab but now it
does not, sigh.

regards,
iain
Index: distrib/sets/lists/comp/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/comp/mi,v
retrieving revision 1.1887
diff -u -p -r1.1887 mi
--- distrib/sets/lists/comp/mi  25 Mar 2014 09:52:55 -0000      1.1887
+++ distrib/sets/lists/comp/mi  20 Jul 2014 08:30:03 -0000
@@ -4081,6 +4081,7 @@
 ./usr/libexec/ccom                             comp-c-bin              pcc
 ./usr/libexec/collect2                         comp-obsolete           obsolete
 ./usr/libexec/cpp                              comp-obsolete           
pcc,obsolete
+./usr/libexec/cxxcom                           comp-c-bin              pcc
 ./usr/libexec/f771                             comp-fortran-bin        
gcc=3,gcccmds
 ./usr/libexec/f771                             comp-obsolete           
gcc=4,obsolete
 ./usr/libexec/lint1                            comp-c-bin
Index: distrib/sets/lists/debug/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/debug/mi,v
retrieving revision 1.55
diff -u -p -r1.55 mi
--- distrib/sets/lists/debug/mi 6 Apr 2014 19:51:39 -0000       1.55
+++ distrib/sets/lists/debug/mi 20 Jul 2014 08:30:30 -0000
@@ -885,6 +885,7 @@
 ./usr/libdata/debug/usr/libexec/ching/printching.debug comp-games-debug        
debug
 ./usr/libdata/debug/usr/libexec/comsat.debug   comp-mail-debug         debug
 ./usr/libdata/debug/usr/libexec/cpp.debug      comp-obsolete           
pcc,obsolete
+./usr/libdata/debug/usr/libexec/cxxcom.debug   comp-c-debug            
pcc,debug
 ./usr/libdata/debug/usr/libexec/digest-service.debug   comp-krb5-debug         
kerberos,debug
 ./usr/libdata/debug/usr/libexec/f771.debug     comp-fortran-debug      
gcc=3,gcccmds,debug
 ./usr/libdata/debug/usr/libexec/f771.debug     comp-obsolete           
gcc=4,obsolete
Index: share/mk/bsd.own.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.own.mk,v
retrieving revision 1.796
diff -u -p -r1.796 bsd.own.mk
--- share/mk/bsd.own.mk 5 Apr 2014 02:22:56 -0000       1.796
+++ share/mk/bsd.own.mk 20 Jul 2014 08:34:17 -0000
@@ -271,6 +271,7 @@ TOOL_OBJC.clang=    ${TOOLDIR}/bin/${MACHIN
 # PCC supports C and Fortran
 TOOL_CC.pcc=           ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc
 TOOL_CPP.pcc=          ${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-cpp
+TOOL_CXX.pcc=          ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-p++
 
 #
 # Make sure DESTDIR is set, so that builds with these tools always
@@ -403,6 +404,7 @@ TOOL_OBJC.gcc=      gcc
 # PCC supports C and Fortran
 TOOL_CC.pcc=           pcc
 TOOL_CPP.pcc=          /usr/libexec/pcpp
+TOOL_CXX.pcc=          p++
 
 TOOL_AMIGAAOUT2BB=     amiga-aout2bb
 TOOL_AMIGAELF2BB=      amiga-elf2bb
Index: external/bsd/pcc/libexec/Makefile
===================================================================
RCS file: /cvsroot/src/external/bsd/pcc/libexec/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- external/bsd/pcc/libexec/Makefile   20 May 2011 16:02:23 -0000      1.6
+++ external/bsd/pcc/libexec/Makefile   20 Jul 2014 08:06:26 -0000
@@ -2,6 +2,6 @@
 
 .include <bsd.own.mk>
 
-SUBDIR=                mkext .WAIT ccom cpp
+SUBDIR=                mkext .WAIT ccom cpp cxxcom
 
 .include <bsd.subdir.mk>
Index: external/bsd/pcc/libexec/ccom/Makefile
===================================================================
RCS file: /cvsroot/src/external/bsd/pcc/libexec/ccom/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- external/bsd/pcc/libexec/ccom/Makefile      14 Mar 2014 00:06:52 -0000      
1.12
+++ external/bsd/pcc/libexec/ccom/Makefile      20 Jul 2014 08:06:26 -0000
@@ -15,7 +15,7 @@ SRCS+=        scan.l
 SRCS+= optim.c pftn.c trees.c inline.c symtabs.c
 SRCS+= gcc_compat.c init.c local.c code.c stabs.c builtins.c
 SRCS+= match.c reader.c optim2.c regs.c local2.c order.c table.c
-SRCS+= common.c main.c external.c
+SRCS+= common.c main.c external.c unicode.c
 
 MAN=    ccom.1
 
@@ -28,7 +28,7 @@ CPPFLAGS+=    -I${PCC_DIST}/os/${TARGOS}
 CPPFLAGS+=     -I${PCC_DIST}/arch/${TARGMACH}
 CPPFLAGS+=     -I${PCC_DIST}/cc/ccom
 
-COPTS.pftn.c+= -Wno-uninitialized
+COPTS.pftn.c+= ${${ACTIVE_CC} == "gcc" :? -Wno-uninitialized :}
 
 DPSRCS=        external.c
 
Index: external/bsd/pcc/libexec/cpp/Makefile
===================================================================
RCS file: /cvsroot/src/external/bsd/pcc/libexec/cpp/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- external/bsd/pcc/libexec/cpp/Makefile       7 Jun 2011 13:30:35 -0000       
1.9
+++ external/bsd/pcc/libexec/cpp/Makefile       20 Jul 2014 08:06:26 -0000
@@ -2,8 +2,7 @@
 
 .include <bsd.init.mk>
 
-.PATH: ${PCC_DIST}/cc/cpp \
-       ${PCC_DIST}/mip
+.PATH: ${PCC_DIST}/cc/cpp
 
 #
 # We build cpp(1) as pcpp(1) to avoid confusion with GCC
@@ -28,12 +27,6 @@ CPPFLAGS+=   -I${PCC_DIST}/cc/cpp
 # generate cpy.h
 YHEADER=
 
-# some files include y.tab.h instead
-DPSRCS=                y.tab.h
-
-y.tab.h:       cpy.h
-       ${HOST_LN} -f ${.ALLSRC} ${.TARGET}
-
-CLEANFILES+=   pcpp.1 y.tab.h
+CLEANFILES+=   pcpp.1
 
 .include <bsd.prog.mk>
Index: external/bsd/pcc/libexec/cxxcom/Makefile
===================================================================
RCS file: libexec/cxxcom/Makefile
diff -N libexec/cxxcom/Makefile
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ external/bsd/pcc/libexec/cxxcom/Makefile    20 Jul 2014 08:06:26 -0000
@@ -0,0 +1,43 @@
+#      $NetBSD: Makefile,v 1.11 2011/09/01 13:00:14 plunky Exp $
+
+WARNS?=        2
+
+.include <bsd.init.mk>
+
+.PATH: ${PCC_DIST}/cc/cxxcom \
+       ${PCC_DIST}/arch/${TARGMACH} \
+       ${PCC_DIST}/mip
+
+PROG=  cxxcom
+
+SRCS=   cgram.y
+SRCS+= scan.l
+SRCS+= optim.c pftn.c trees.c inline.c symtabs.c
+SRCS+= gcc_compat.c init.c local.c code.c stabs.c builtins.c
+SRCS+= match.c reader.c optim2.c regs.c local2.c order.c table.c
+SRCS+= common.c main.c external.c cxxcode.c
+
+MAN=
+
+# generate cgram.h
+YHEADER=
+
+CPPFLAGS+=     -I${.OBJDIR}
+CPPFLAGS+=     -I${PCC_DIST}/mip
+CPPFLAGS+=     -I${PCC_DIST}/os/${TARGOS}
+CPPFLAGS+=     -I${PCC_DIST}/arch/${TARGMACH}
+CPPFLAGS+=     -I${PCC_DIST}/cc/cxxcom
+
+COPTS.pftn.c+= ${${ACTIVE_CC} == "gcc" :? -Wno-uninitialized :}
+
+DPSRCS=        external.c
+
+MKEXTDIR!=     cd ${.CURDIR}/../mkext && ${PRINTOBJDIR}
+
+external.c:    ${MKEXTDIR}/mkext
+       ${_MKTARGET_CREATE}
+       ${MKEXTDIR}/mkext
+
+CLEANFILES+=   external.c external.h
+
+.include <bsd.prog.mk>
Index: external/bsd/pcc/usr.bin/pcc/Makefile
===================================================================
RCS file: /cvsroot/src/external/bsd/pcc/usr.bin/pcc/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- external/bsd/pcc/usr.bin/pcc/Makefile       1 Sep 2011 13:00:15 -0000       
1.8
+++ external/bsd/pcc/usr.bin/pcc/Makefile       20 Jul 2014 08:06:26 -0000
@@ -4,20 +4,21 @@ WARNS?=       2
 
 .include <bsd.init.mk>
 
-.PATH: ${PCC_DIST}/cc/cc
+.PATH: ${PCC_DIST}/cc/cc ${PCC_DIST}/cc/driver
 
 #
 # we build PCC cc(1) as pcc(1) to avoid conflicts with GCC
 #
 
 PROG=  pcc
-SRCS=  cc.c
+SRCS=  cc.c strlist.o xalloc.o
 MAN=   pcc.1
 
 CPPFLAGS+=     -DTARGOS=\"${TARGOS}\"
 CPPFLAGS+=     -DTARGMACH=\"${TARGMACH}\"
 CPPFLAGS+=     -DLIBEXECDIR=\"/usr/libexec/\"
 CPPFLAGS+=     -DINCLUDEDIR=\"/usr/include/\"
+CPPFLAGS+=     -I${PCC_DIST}/cc/driver
 CPPFLAGS+=     -I${PCC_DIST}/mip
 CPPFLAGS+=     -I${PCC_DIST}/os/${TARGOS}
 CPPFLAGS+=     -I${PCC_DIST}/arch/${TARGMACH}


Home | Main Index | Thread Index | Old Index