[comp.lang.perl] Perl 4.0 refuses to compile using gcc 1.30

phil@cgrg.ohio-state.EDU (Phil Ritzenthaler) (04/10/91)

Background:
	Sun 4/280
	Sun OS 4.1.1
	GNU gcc compiler version 1.39

Problem:
Unfortunately, I don't read this news group as often as I probably should, but
I cannot get perl 4.0 to compile using gcc.  I run through the standard
Configure just changing the line cc to gcc when it asks.  Judging by what
occurs after, Larry obviously has made provisions for gcc in the Configure.

From the compilation:

gcc -c -fpcc-struct-return -I/usr/include/sun -O -g  perly.c
gcc -c -fpcc-struct-return -I/usr/include/sun -O -g  array.c
gcc -c -fpcc-struct-return -I/usr/include/sun -O -g  cmd.c
gcc -c -fpcc-struct-return -I/usr/include/sun -O -g  cons.c
gcc -c -fpcc-struct-return -I/usr/include/sun -O -g  consarg.c
gcc -c -fpcc-struct-return -I/usr/include/sun -O -g  doarg.c
doarg.c: In function do_assign:
doarg.c:1067: `environ' undeclared (first use this function)
doarg.c:1067: (Each undeclared identifier is reported only once
doarg.c:1067: for each function it appears in.)
doarg.c: In function do_undef:
doarg.c:1297: `environ' undeclared (first use this function)
*** Error code 1
make: Fatal error: Command failed for target `doarg.o'

========================================================

It compiles fine using cc . . . anyone have a work around for this?

Thanks . . .

Phil Ritzenthaler  The Advanced Computing Center for the Arts & Design (ACCAD)
Systems Manager    The Ohio State University
                   UUCP: ...!{pyramid,killer}!grumpy.cgrg.ohio-state.edu!phil
(614) 292-3416     ARPA: phil@grumpy.cgrg.ohio-state.edu

khera@thneed.cs.duke.edu (Vick Khera) (04/10/91)

In article <1553@sunc.osc.edu> phil@cgrg.ohio-state.EDU (Phil Ritzenthaler) writes:

   Background:
	   Sun 4/280 Sun OS 4.1.1 GNU gcc compiler version 1.39

   Problem:

   Unfortunately, I don't read this news group as often as I probably
   should, but I cannot get perl 4.0 to compile using gcc.  I run
   through the standard Configure just changing the line cc to gcc
   when it asks.  Judging by what occurs after, Larry obviously has
   made provisions for gcc in the Configure.

don't bother compiling Perl with gcc on a SPARC based machine.  it
just is not going to work.  the problem is that gcc and Sun's cc pass
structures differently, and the dbm routines take parameters that way.
since the dbm library is compiled using cc, calling those functions
from gcc will cause major league problems.  what about using gcc's
-fpcc-struct-return, you may ask?  well, that works for structure
*returns* not structure passing.  'tis a pity, though.  i really like
gcc.  when gcc 2.0 finally comes out, this will be fixed.  should
there be a note to this effect in the perl distribution?  or is there
one and i missed it?
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vick Khera, Gradual Student/Systems Guy   Department of Computer Science
ARPA:   khera@cs.duke.edu                 Duke University
UUCP:   ...!mcnc!duke!khera               Durham, NC 27706     (919) 660-6528

purtill@morley.rutgers.edu (Mark Purtill) (04/11/91)

khera@thneed.cs.duke.edu (Vick Khera) writes:
>don't bother compiling Perl with gcc on a SPARC based machine.  it
>just is not going to work.  the problem is that gcc and Sun's cc pass
>structures differently, and the dbm routines take parameters that way.
>since the dbm library is compiled using cc, calling those functions
>from gcc will cause major league problems. 
	I compiled the file the calls to the dbm routines are in
(whichever one that is) with cc and everything else with gcc (v
1.37.1, I think) and everything worked fine.  This was perl 3.0 at
patchlevel 40, I think.

^.-.^ Mark Purtill         purtill@dimacs.rutgers.edu         (908)932-4580 (O)
((")) DIMACS, P.O. Box 1179, Rutgers U., Piscataway, NJ 08855 (908)220-6905 (H)
********** Note new area code!  We are now (908) rather than (201)!  **********

jbw@bigbird.bu.edu (Joe Wells) (04/11/91)

In article <KHERA.91Apr10120433@thneed.cs.duke.edu> khera@thneed.cs.duke.edu (Vick Khera) writes:

   the problem is that gcc and Sun's cc pass structures differently, and
   the dbm routines take parameters that way.  since the dbm library is
   compiled using cc, calling those functions from gcc will cause major
   league problems.  what about using gcc's -fpcc-struct-return, you may
   ask?  well, that works for structure *returns* not structure passing.

What files have to be compiled with cc to make the dbm stuff work?  I hope
not all of them!

-- 
Joe Wells <jbw@cs.bu.edu>

rwelch@isis.cs.du.edu (Randy S. Welch) (04/11/91)

In article <KHERA.91Apr10120433@thneed.cs.duke.edu> khera@thneed.cs.duke.edu (Vick Khera) writes:
   In article <1553@sunc.osc.edu> phil@cgrg.ohio-state.EDU (Phil Ritzenthaler) writes:

      Background:
	      Sun 4/280 Sun OS 4.1.1 GNU gcc compiler version 1.39

      Problem:

      Unfortunately, I don't read this news group as often as I probably
      should, but I cannot get perl 4.0 to compile using gcc.  I run
      through the standard Configure just changing the line cc to gcc
      when it asks.  Judging by what occurs after, Larry obviously has
      made provisions for gcc in the Configure.

I believe that Phil was having a problem with the *environment variable. (
Supposed to be defined in an include file Std. )
If I  remember correctly there was a fix for Configure for this problem
posted a few days ago.  You can also get around this by adding -U__STDC__
to the CFLAGS.  It worked for me on a 68k platform.

-randy

--
Randy Welch   Mail to :  ...!ncar!scicom!bldr!randy or rwelch@du.edu
Boulder, CO              rwelch@nyx.cs.du.edu or (303) 442-6717
"Unfortunately, life contains an unavoidable element of unpredictability"
-David Lynch "The Angriest Dog in the World"

rbj@uunet.UU.NET (Root Boy Jim) (04/12/91)

>In article <KHERA.91Apr10120433@thneed.cs.duke.edu> khera@thneed.cs.duke.edu (Vick Khera) writes:
>
>   the problem is that gcc and Sun's cc pass structures differently, and
>   the dbm routines take parameters that way.

Of course some of us think that passing, returning, and assigning
structures is A BAD THING and never should have been legalized.

Fortunately, only the DBM people were stupid enuf to use it.
-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane

phil@cgrg.ohio-state.EDU (Phil Ritzenthaler) (04/13/91)

In article <128361@uunet.UU.NET>, rbj@uunet.UU.NET (Root Boy Jim) writes:
|> >In article <KHERA.91Apr10120433@thneed.cs.duke.edu> khera@thneed.cs.duke.edu (Vick Khera) writes:
|> >
|> >   the problem is that gcc and Sun's cc pass structures differently, and
|> >   the dbm routines take parameters that way.
|> 
|> Of course some of us think that passing, returning, and assigning
|> structures is A BAD THING and never should have been legalized.
|> 
|> Fortunately, only the DBM people were stupid enuf to use it.

I did as a person from MIT suggested (thanks) and commented out the ifdef's
around the environ variables and got perl 4.0 to work with gcc . . . kinda.

It fails the test perl/t/op/dbm.t . . . hence the reply to the posting from
rbj@uunet.UU.NET.  Since these structures are passed, is dbm.t EXPECTED to
fail if you use the gcc compiler?  They all pass using Sun's cc . . . of
course who said Sun's cc was a standard??

Sometimes I'd just like to take another's advice and give up on gcc and perl,
but right now I feel this shouldn't be . . .

Any takers??  Thanks . . .

Phil Ritzenthaler  The Advanced Computing Center for the Arts & Design (ACCAD)
Systems Manager    The Ohio State University
                   UUCP: ...!{pyramid,killer}!grumpy.cgrg.ohio-state.edu!phil
(614) 292-3416     ARPA: phil@grumpy.cgrg.ohio-state.edu

rwelch@isis.cs.du.edu (Randy S. Welch) (04/13/91)

In article <1557@sunc.osc.edu> phil@cgrg.ohio-state.EDU (Phil Ritzenthaler) writes:

   Newsgroups: comp.lang.perl
   Date: 12 Apr 91 17:15:45 GMT
   References: <1553@sunc.osc.edu> <KHERA.91Apr10120433@thneed.cs.duke.edu> <JBW.91Apr10134057@bigbird.bu.edu> <128361@uunet.UU.NET>
   Sender: news@osc.edu
   Reply-To: phil@cgrg.ohio-state.edu
   Organization: Advanced Computing Center for Arts & Design
   Lines: 28
   Nntp-Posting-Host: fac1.cgrg.ohio-state.edu
   It fails the test perl/t/op/dbm.t . . . hence the reply to the posting from
   rbj@uunet.UU.NET.  Since these structures are passed, is dbm.t EXPECTED to
   fail if you use the gcc compiler?  They all pass using Sun's cc . . . of
   course who said Sun's cc was a standard??

   Sometimes I'd just like to take another's advice and give up on gcc and perl,
   but right now I feel this shouldn't be . . .

   Any takers??  Thanks . . .

Well, I remember in Perl3.0.xx Configure used to have -fpcc-struct-return,
but whether that works on sparcs I don't remember for sure.  You could use
gdbm instead n/dbm, that should work.

-randy
--
Randy Welch   Mail to :  ...!ncar!scicom!bldr!randy or rwelch@du.edu
Boulder, CO              rwelch@nyx.cs.du.edu or (303) 442-6717
"Unfortunately, life contains an unavoidable element of unpredictability"
-David Lynch "The Angriest Dog in the World"

hokey@plus5.com (Hokey) (04/14/91)

Have you considered using one of the dbm replacement packages, compiled
with gcc?  I think at least one of them is compatible with the stock dbm,
or comes with a utility to convert old dbm files to new ones.
-- 
Hokey				We are Space Guys.  We know what we are doing.