Closed Bug 182086 Opened 22 years ago Closed 22 years ago

ranlib needs to be rerun after static libraries are moved to the destination directory.

Categories

(NSS :: Build, defect, P1)

PowerPC
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(1 file, 1 obsolete file)

One difference between Mac OS X and Unix is that on Mac OS X,
ranlib needs to be rerun after static libraries are moved to
the destination directory.

In the coreconf build system, we need to rerun ranlib on the
*.a files after the 'import' rule unpacks the mdbinary.jar file.
Attached patch Proposed patch (obsolete) — Splinter Review
Ulf, could you test this patch?

I was hoping that we could invoke ranlib in the import.pl script,
but I found that the import.pl script is very general and doesn't
know anything about the structure of the mozilla/dist/<platform>.OBJ
directory.  So we have to invoke ranlib after the import.pl script
has run.
The previous patch contains an unrelated change.
Attachment #107516 - Attachment is obsolete: true
I tested my patch and verified that it works.

In the interest of time, I've checked in my patch so
that Ulf can start the NSS tip nightly build on Mac
OS X tonight.

I'd still appreciate a code review of my patch.
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → 3.7
Review comments: This patch (v2) looks correct.

I might have coded it 
    find $(SOURCE_MD_DIR)/lib -name "*.a" -print | xargs $(RANLIB) 
instead of 
    find $(SOURCE_MD_DIR)/lib -name "*.a" -exec $(RANLIB) {} \;

xargs will one RANLIB once for a bunch of .a files at once.  
-exec will run RANLIB once for each individual .a file.

If the number of expected .a files was large, it could make a performance 
difference, but since the number of .a files is probably small, this is 
probably not worth changing now.

One other issue with the xargs approach: if the pathnames have an spaces
in the directory or files names, then they need to be quoted so that xargs
will not break them into separate arguments.  To do that I sometimes use
this sed script:

    sed -e '/ /s/\(.*\)/"\1"/'

e.g. 

    find $(SOURCE_MD_DIR)/lib -name "*.a" -print | sed -e '/ /s/\(.*\)/"\1"/' \
| xargs $(RANLIB) 


Here is an excerpt from "Mac OS X for Unix Geeks" by
Brian Jepson and Ernest E. Rothman, page 91:
    The creation of static libraries in Mac OS X is
    much the same as in Unix variants, with one
    exception. After installation in the destination
    directory, ranlib must be used to recatalog the
    newly installed archive libraries (i.e., the
    lib*.a files).

This is the best description I can find on this problem,
although a Google search turns up many reports of this
problem.

Marked the bug fixed.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: