Subject: SunOS 4.1.3_U1 compile problems

From: Terrill Yuhas <[email-masked]>
Date: Mon, 15 Feb 1999 14:11:14 -0700 (MST)

I first tried to compile 2.4.2-beta-18-vr13 but kept getting errors when
compiling ftpd due to a missing library (-liberty).  I couldn't find
anything about that library but then vr14 came up so I thought I'd try
that.  Now I get:

Making ftpd.
gcc -g -I.. -I../support -L../support  -target sun4 -c  ftpd.c
ftpd.c: In function `passive':
ftpd.c:5185: `RAND_MAX' undeclared (first use this function)
ftpd.c:5185: (Each undeclared identifier is reported only once
ftpd.c:5185: for each function it appears in.)
*** Error code 1
make: Fatal error: Command failed for target `ftpd.o'

I'm using gcc as a compiler and have tried it on one machine with gcc
2.7.0 and the other with 2.8.1 (both are SunOS 4.1.3_U1).  The other
components compile without errors.

Thanks for any suggestions,

Terrill

---

From: Gregory A Lundberg <[email-masked]>
Date: Mon, 15 Feb 1999 16:30:19 -0500 (EST)

> ftpd.c:5185: `RAND_MAX' undeclared (first use this function)

Some runtimes are more ANSI/ISO compliant than others. :P

Append the following line to src/config/config.<system>

#define RAND_MAX 32767

and hope that's the correct value (or call your OS vendor to find out).  I
have a report of this for SunOS 4.1 (s41); anyone else please let me khow
so I can add the fix to VR15.

Also, take a peak in /usr/include/limits.h and let me know if RAND_MAX is
there or not.

-- 

Gregory A Lundberg              Senior Partner, VRnet Company
1441 Elmdale Drive              [email-masked]
Kettering, OH 45409-1615 USA    1-800-809-2195

---

From: "Terrill Yuhas" <[email-masked]>
Date: Mon, 15 Feb 1999 15:37:06 -0700

> so I can add the fix to VR15.

After I appended that line, it compiles/runs fine.

> Also, take a peak in /usr/include/limits.h and let me know if RAND_MAX is

Couldn't find the RAND_MAX statement.

Terrill

---

From: Gregory A Lundberg <[email-masked]>
Date: Mon, 15 Feb 1999 18:16:30 -0500 (EST)

> Couldn't find the RAND_MAX statement.

Drat.  The peril of 'guessing' the value like this is it it's too small
the PASV port randomizer can overrun the array of valid ports assinging
invalid port numbers.  If it's too large the randomizer will not use all
the available ports.

I like the gcc posting a while ago which indicates the problem is cleanly
solvable.

--

---

From: Chad Price <[email-masked]>
Date: Mon, 15 Feb 1999 17:29:28 -0600

>Also, take a peak in /usr/include/limits.h and let me know if RAND_MAX is

It's not there under Solaris 2.4, but it compiles fine under gcc 2.8.1

./build sol CC=gcc

does the trick.

Chad

Chad Price
Systems Manager
University of Nebraska Medical Center
600 S 42nd St
Omaha, NE 68506-6495
[email-masked]
(402) 559-9527 
(402) 559-4077 (FAX)

---

From: Gregory A Lundberg <[email-masked]>
Date: Tue, 16 Feb 1999 07:30:48 -0500 (EST)

> I like the gcc posting a while ago which indicates the problem is cleanly

So after this email my friend who does SunOS testing for me goes "oops"
and sends the following:

> It's my mistake...
> 
> /* SunOS4 */
>         #define RAND_MAX 2147483647
> 

The fact that gcc didn't have a problem means someone somewhere has put
the value in an include file.  If someone could find that file on SunOS
I'd be very appreciative.

--

---

From: Richard L Hoesly <[email-masked]>
Date: Tue, 16 Feb 1999 10:22:57 -0800

> I'd be very appreciative.

I found the following on my SunOS 4.1.4 system by searching every include file.

./usr/lang/SC3.0.1/include/cc_411/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1/include/cc_412/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1/include/cc_413/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1/include/cc_413_U1/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1patch/include/cc_411/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1patch/include/cc_412/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1patch/include/cc_413/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1patch/include/cc_413_U1/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1patch/include/cc_413_JL/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1patch/include/cc_414/stdlib.h:  #define RAND_MAX   32767
./usr/lang/SC3.0.1patch/include/cc_414_JL/stdlib.h:  #define RAND_MAX   32767
./usr/5include/stdlib.h:  #define       RAND_MAX        0x7fff

------------------------------------------------------------------
  Richard L. Hoesly                            Phone: 310-214-2922
  Directory of Software Systems                FAX:   310-214-3420
  Universal Analytics, Inc.                    Email: [email-masked]
  3625 Del Amo Blvd., Suite 370
  Torrance, California 90503

---

From: Gregory A Lundberg <[email-masked]>
Date: Tue, 16 Feb 1999 14:44:43 -0500 (EST)

It just so happens I'm logged into an s41 box right now.

> ./usr/lang/SC3.0.1patch/include/cc_414_JL/stdlib.h:  #define RAND_MAX   32767

Don't see any of these guys.

> ./usr/5include/stdlib.h:  #define       RAND_MAX        0x7fff

this one's there

question becomes: how to convince the Makefile to use this include file,
and is this the right one for the runtime routine being linked?  since I
know squat about SunOS (I'm working on another problem) maybe someone can
give me a clue.

-- 

Gregory A Lundberg              Senior Partner, VRnet Company
1441 Elmdale Drive              [email-masked]
Kettering, OH 45409-1615 USA    1-800-809-2195

---

From: Richard L Hoesly <[email-masked]>
Date: Tue, 16 Feb 1999 12:51:25 -0800

> Don't see any of these guys.

These are from the  C compiler that comes as part of the SPARCWorks, not
the free one.