Closed Bug 176439 Opened 22 years ago Closed 21 years ago

"ld: fatal: file $ORIGIN: open failed: No such file or directory" in "./security/nss/lib/softoken"

Categories

(NSS :: Build, defect)

Sun
Solaris
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ensonic, Assigned: wtc)

References

Details

User-Agent:       Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.1a) Gecko/20020627
Build Identifier: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.1a) Gecko/20020627

I am building mozialla 1.2b on solaris 2.6 and get the above mentioned error. It
looks like $ORIGIN is never set. I grepped the whole tree for usage and
definition, but found only files where it is used.
# find . -type f -exec grep -l '$ORIGIN' {} \;
./security/nss/lib/freebl/loader.c
./security/nss/lib/nss/config.mk
./security/nss/lib/softoken/config.mk
./directory/c-sdk/build.mk
./directory/c-sdk/build.mk~
./other-licenses/expat/conftools/ltconfig
./other-licenses/freetype/builds/unix/aclocal.m4
./other-licenses/freetype/builds/unix/configure
./xpcom/typelib/xpidl/glib/glib-1.2.1/ltconfig
./xpcom/typelib/xpidl/libidl/libIDL-0.6.5/ltconfig
# find . -type f -exec grep -l 'ORIGIN =' {} \;
./directory/c-sdk/ldap/examples/windows/winldap/LDAP16.MAK
# find . -type f -exec grep -l 'ORIGIN +=' {} \;


Reproducible: Always

Steps to Reproduce:
1. ./configure  --prefix=/opt/mozilla-1.2b --with-gtk --disable-logging
--disable-tests --disable-debug --disable-dtd-debug --enable-strip
--enable-optimize --enable-crypto --enable-mathml
--with-default-mozilla-five-home=/opt/mozilla --with-extensions
--with-system-jpeg=/opt/gnome --with-system-zlib=/usr/local
--with-system-png=/opt/gnome --without-system-nspr --enable-ldap-experimental
2. make
3.

Actual Results:  
I got the abobe mentioned error

Expected Results:  
I expected to find a ready build mozilla this morning ;-)
*** Bug 176441 has been marked as a duplicate of this bug. ***
-> NSS
Assignee: seawood → wtc
Component: Build Config → Build
Product: Browser → NSS
QA Contact: granrose → wtc
Version: other → 3.0
I will need your gcc version number and the part
of your build log near the failure.

We only support building NSS with the Solaris ld
and as.  You can use gcc, but it must either be
configured to use Solaris ld and as or recognize
the -B/usr/ccs/bin/ flag.
gcc is : 2.95.2, there is gnu-ld installed (under /usr/local/bin/ld), but
solaris-ld (under /usr/ccs/bin/ld) as well. I usually use gnu-ld without any
problems. The moz-build seems to prefer the solaris one (dunno why).

and here is more of the output
rm -f SunOS5.6_OPT.OBJ/libsoftokn.a
ar cr SunOS5.6_OPT.OBJ/libsoftokn.a SunOS5.6_OPT.OBJ/alghmac.o
SunOS5.6_OPT.OBJ/dbinit.o SunOS5.6_OPT.OBJ/dbmshim.o SunOS5.6_OPT.OBJ/fipstest.o
SunOS5.6_OPT.OBJ/fipstokn.o SunOS5.6_OPT.OBJ/keydb.o SunOS5.6_OPT.OBJ/lowcert.o
SunOS5.6_OPT.OBJ/lowkey.o SunOS5.6_OPT.OBJ/lowpbe.o SunOS5.6_OPT.OBJ/padbuf.o
SunOS5.6_OPT.OBJ/pcertdb.o SunOS5.6_OPT.OBJ/pk11db.o SunOS5.6_OPT.OBJ/pkcs11.o
SunOS5.6_OPT.OBJ/pkcs11c.o SunOS5.6_OPT.OBJ/pkcs11u.o SunOS5.6_OPT.OBJ/rawhash.o
SunOS5.6_OPT.OBJ/rsawrapr.o SunOS5.6_OPT.OBJ/softkver.o
echo SunOS5.6_OPT.OBJ/libsoftokn.a
SunOS5.6_OPT.OBJ/libsoftokn.a
grep -v ';-' softokn.def | sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e
's,;.*,;,' > SunOS5.6_OPT.OBJ/softokn.def
rm -f SunOS5.6_OPT.OBJ/libsoftokn3.so
/usr/ccs/bin/ld -G -h libsoftokn3.so -M -o SunOS5.6_OPT.OBJ/libsoftokn3.so
SunOS5.6_OPT.OBJ/alghmac.o SunOS5.6_OPT.OBJ/dbinit.o SunOS5.6_OPT.OBJ/dbmshim.o
SunOS5.6_OPT.OBJ/fipstest.o SunOS5.6_OPT.OBJ/fipstokn.o SunOS5.6_OPT.OBJ/keydb.o
SunOS5.6_OPT.OBJ/lowcert.o SunOS5.6_OPT.OBJ/lowkey.o SunOS5.6_OPT.OBJ/lowpbe.o
SunOS5.6_OPT.OBJ/padbuf.o SunOS5.6_OPT.OBJ/pcertdb.o SunOS5.6_OPT.OBJ/pk11db.o
SunOS5.6_OPT.OBJ/pkcs11.o SunOS5.6_OPT.OBJ/pkcs11c.o SunOS5.6_OPT.OBJ/pkcs11u.o
SunOS5.6_OPT.OBJ/rawhash.o SunOS5.6_OPT.OBJ/rsawrapr.o
SunOS5.6_OPT.OBJ/softkver.o   /data/download/mozilla/dist/lib/libfreebl.a
/data/download/mozilla/dist/lib/libsecutil.a
/data/download/mozilla/dist/lib/libdbm.a  -L/data/download/mozilla/dist/lib/
-lplc4 -lplds4 -lnspr4 
ld: fatal: file SunOS5.6_OPT.OBJ/libsoftokn3.so: open failed: No such file or
directory
make[4]: *** [SunOS5.6_OPT.OBJ/libsoftokn3.so] Error 1
make[4]: Leaving directory `/data/download/mozilla/security/nss/lib/softoken'
make[3]: *** [libs] Error 2
make[3]: Leaving directory `/data/download/mozilla/security/nss/lib'
make[2]: *** [libs] Error 2
make[2]: Leaving directory `/data/download/mozilla/security/manager'
make[1]: *** [tier_95] Error 2
make[1]: Leaving directory `/data/download/mozilla'
make: *** [default] Error 2
The command that failed is this:

/usr/ccs/bin/ld -G -h libsoftokn3.so -M -o SunOS5.6_OPT.OBJ/libsoftokn3.so
[...]
-lplc4 -lplds4 -lnspr4 
ld: fatal: file SunOS5.6_OPT.OBJ/libsoftokn3.so: open failed: No such file or
directory

This failure does not seem to have anything to do with
the Solaris ld vs. GNU ld issue.  (Solaris ld was invoked
with its full pathname.)  It fails because the argument
for the -M option is missing.  The argument for the -M
option is $(MAPFILE), which should expand to
SunOS5.6_OPT.OBJ/softokn.def.  I don't know why it expands
to nothing.

Did you modify any makefile, such as mozilla/security/coreconf/SunOS5.mk?
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
yes, of couse I do! I use gnu-ld and the mozilla build usually does not object
agianst it directly. To make the build work I modified the following files (habe
been posted to bugzilla several time as diffs) :
./directory/c-sdk/build.mk
./security/nss/lib/freebl/Makefile
./security/coreconf/SunOS5.mk
and fixed the options for the linker. That nss now somehow uses the solaris
liner in a hardcoded way is not nice at all (because I don't understand why this
seems to be neccesary). I habe build all releases since 0.9.5 up to 1.1a with
gcc and gnu-ld succesfully. Not it seems that I have to patch out any reference
to '/usr/ccs/bin/ld' and replace it which the calls to gnu-ld.
I'll try this now (with LD=/usr/ccs/bin/ld changed to LD=/usr/local/bin/ld in
./security/coreconf/SunOS5.mk).

Just would like to tell you that I just have a working mozilla 1.2b. So it is
*not* neccesary to avoid gnu-ld.
I need you to remove the changes you made to
mozilla/security/nss/lib/freebl/Makefile and
mozilla/security/coreconf/SunOS5.mk and try
again.  If you still get build failures in
mozilla/security/nss, please post them here.

You need to file a separate bug for the build
issues in mozilla/directory/c-sdk/build.mk.
The NSS product consists of the files under
mozilla/security/nss and mozilla/security/coreconf.

Some of our needs for the Solaris ld flags are
not obvious.  For example, we use the -M flag to
control the symbols that get exported.  If you
don't use that flag, all the global symbols get
exported.  Mozilla will still work fine in that
case, but the NSS libraries are not built according
to specs.
I modified the makefiles, because of :

#	ld --help
Usage: ld [options] file...
Options:
  ...
  -M, --print-map             Print map file on standard output
  ...

so giving -M a filename is not valid for gnu-ld.
I've noted that in comment #4 is not the right message. When I run make again,
then it finds the lib, but then $ORIGIN is undefined and this causes it to fail.

I still miss an explanation, why using gnu-ld is not sufficient, though I
understand, that what I did is not a proper fix (exporting all symbols isn't
good for a security library).

I'll definitely try again when mozilla 1.2-final is out. Currently I'll leave it
this way, as it taske about 6 to 8 hours to compile the beast.
I modified the makefiles, because of :

#	ld --help
Usage: ld [options] file...
Options:
  ...
  -M, --print-map             Print map file on standard output
  ...

so giving -M a filename is not valid for gnu-ld.
I've noted that in comment #4 is not the right message. When I run make again,
then it finds the lib, but then $ORIGIN is undefined and this causes it to fail.

I still miss an explanation, why using gnu-ld is not sufficient, though I
understand, that what I did is not a proper fix (exporting all symbols isn't
good for a security library).

I'll definitely try again when mozilla 1.2-final is out. Currently I'll leave it
this way, as it takes about 6 to 8 hours to compile the beast.
GNU ld may be sufficient, but you'd need to find
the equivalent GNU ld flags.  It is less work to
simply require Solaris ld.

$ORIGIN is a magic keyword that Solaris ld recognizes.
Our makefiles invoke the Solaris ld with its full
pathname.  You are getting this build failure because
you modified our makefiles.
My patch in bug 198481 should fix the problem.  It will
appear in Mozilla 1.4alpha.
Depends on: 198481
Target Milestone: --- → 3.8
Marked the bug fixed because the patch in bug 198481 has
been checked in.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.