[comp.lang.c] ranlib

pjh@mccc.UUCP (Pete Holsberg) (08/02/89)

Some recently posted programs have requested the use of 'ranlib' but my
3B2/400 SV R3.1 doesn't have it.  

Wjat is 'ranlib'?  What can I use as a work-around?

Thanks,
Pete
-- 
Pete Holsberg -- Mercer College -- Trenton, NJ 08690
...!rutgers!princeton!njsmu!mccc!pjh

guy@auspex.auspex.com (Guy Harris) (08/04/89)

>Some recently posted programs have requested the use of 'ranlib' but my
>3B2/400 SV R3.1 doesn't have it.  
>
>Wjat is 'ranlib'?

A program that adds a "table of contents" as the first member of an
archive; said "table of contents" basically lists external symbol
definitions from members of the archive that are object files, and gives
a pointer to the archive member that defines them.

The equivalent program in System V is called "ar"; it automatically
reconstructs a table-of-contents member every time you modify the
archive.

>What can I use as a work-around?

Change the Makefile to have

	#
	# For BSD (and V7? - it was there, but I don't know how well it
	# worked) systems, uncomment the "RANLIB=ranlib" line.
	# For S5 systems (and S3 systems), uncomment the "RANLIB=:" line.
	#
	#RANLIB=ranlib
	#RANLIB=:

at the beginning (or wherever the other configuration instructions were
put - if somebody posts a program, there *should* be configuration
instructions unless they've only gotten it to work on one particular
UNIX version), and replace all other occurences of "ranlib" with
"$(RANLIB)".  That way, on S5 systems, "ranlib" will be defined as ":",
which is a do-nothing command.

scott@dtscp1.UUCP (Scott Barman) (08/04/89)

In article <457@mccc.UUCP> you write:
>Some recently posted programs have requested the use of 'ranlib' but my
>3B2/400 SV R3.1 doesn't have it.  
>
>Wjat is 'ranlib'?  What can I use as a work-around?

For SV, I use the following to build a library:

	ar cuv libwhatever.a `lorder *.o | tsort`

lorder(1) exists under bsd but is really not necessary with ranlib.

-- 
scott barman
{gatech, emory}!dtscp1!scott

gwyn@smoke.BRL.MIL (Doug Gwyn) (08/04/89)

In article <457@mccc.UUCP> pjh@mccc.UUCP (Pete Holsberg) writes:
>Some recently posted programs have requested the use of 'ranlib' but my
>3B2/400 SV R3.1 doesn't have it.  
>Wjat is 'ranlib'?  What can I use as a work-around?

"ranlib" was a utility supplied with 7th Edition UNIX that added or updated
a special archive member that constituted a table of entry points for the
object modules contained in the archive.  System V "ar" takes care of this
automatically and so there is no need for a separate "ranlib" operation on
System V.  If you have a sensible Makefile, it will use a symbolic name
like RANLIB which you can set to e.g. "echo" or ":" for System V.

karl@haddock.ima.isc.com (Karl Heuer) (08/04/89)

In article <867@dtscp1.UUCP> scott@dtscp1.UUCP (Scott Barman) writes:
>lorder(1) exists under bsd but is really not necessary with ranlib.

Conversely, ranlib is not really necessary if you have lorder and tsort.
(If tsort reports a circular dependency, the solution is to merge the objects
in question into a single module, either with `ld -r' or by recompiling them
as a single source.)

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint
Followups to comp.unix.questions only; this isn't a C issue.