Closed Bug 219458 Opened 21 years ago Closed 21 years ago

libnspr4.so does not compile on SunOS 5.9 (Solaris 9)

Categories

(NSPR :: NSPR, defect)

Sun
SunOS
defect
Not set
blocker

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mkhusid, Assigned: wtc)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624

gcc -shared -Wl,-h,libnspr4.so,-z,combreloc,-z,defs -Wl,-f,\$ORIGIN/cpu/\$ISALIS
T/libnspr_flt4.so -o libnspr4.so -Wl,--version-script,./nsprmap.sun ./prvrsion.o
 io/./prfdcach.o io/./prmwait.o io/./prmapopt.o io/./priometh.o io/./pripv6.o io
/./prlayer.o io/./prlog.o io/./prmmap.o io/./prpolevt.o io/./prprf.o io/./prscan
f.o io/./prstdio.o threads/./prcmon.o threads/./prrwlock.o threads/./prtpd.o lin
king/./prlink.o malloc/./prmem.o md/./prosdep.o memory/./prshm.o memory/./prshma
.o memory/./prseg.o misc/./pralarm.o misc/./pratom.o misc/./prcountr.o misc/./pr
dtoa.o misc/./prenv.o misc/./prerr.o misc/./prerror.o misc/./prerrortable.o misc
/./prinit.o misc/./prinrval.o misc/./pripc.o misc/./prlog2.o misc/./prlong.o mis
c/./prnetdb.o misc/./prolock.o misc/./prrng.o misc/./prsystem.o misc/./prthinfo.
o misc/./prtpool.o misc/./prtrace.o misc/./prtime.o malloc/./prmalloc.o pthreads
/./ptsynch.o pthreads/./ptio.o pthreads/./ptthread.o pthreads/./ptmisc.o md/unix
/./unix.o md/unix/./unix_errors.o md/unix/./uxproces.o md/unix/./uxrng.o md/unix
/./uxshm.o md/unix/./uxwrap.o md/unix/./solaris.o md/unix/./os_SunOS.o -lpthread
 -lthread -lrt -lsocket -lnsl -ldl -lc
/usr/lib/librt.so: undefined reference to `__aio_suspend'
/usr/lib/librt.so: undefined reference to `__aio_cancel'
/usr/lib/librt.so: undefined reference to `__aio_fsync'
/usr/lib/librt.so: undefined reference to `__lio_listio64'
/usr/lib/librt.so: undefined reference to `_libaio_close'
/usr/lib/libnsl.so: undefined reference to `mp_madd'
/usr/lib/libnsl.so: undefined reference to `mp_sdiv'
/usr/lib/librt.so: undefined reference to `_libaio_fork'
/usr/lib/librt.so: undefined reference to `__aio_return64'
/usr/lib/librt.so: undefined reference to `__aio_read64'
/usr/lib/librt.so: undefined reference to `__aio_error'
/usr/lib/librt.so: undefined reference to `__aio_write'
/usr/lib/libnsl.so: undefined reference to `mp_mtox'
/usr/lib/librt.so: undefined reference to `__aio_return'
/usr/lib/librt.so: undefined reference to `__aio_error64'
/usr/lib/libnsl.so: undefined reference to `mp_mfree'
/usr/lib/librt.so: undefined reference to `md5_calc'
/usr/lib/libnsl.so: undefined reference to `mp_itom'
/usr/lib/librt.so: undefined reference to `__aio_cancel64'
/usr/lib/libnsl.so: undefined reference to `mp_mult'
/usr/lib/libnsl.so: undefined reference to `mp_pow'
/usr/lib/librt.so: undefined reference to `__aio_waitn'
/usr/lib/librt.so: undefined reference to `__lio_listio'
/usr/lib/libnsl.so: undefined reference to `_mp_move'
/usr/lib/librt.so: undefined reference to `__aio_write64'
/usr/lib/libnsl.so: undefined reference to `mp_xtom'
/usr/lib/libnsl.so: undefined reference to `mp_mdiv'
/usr/lib/librt.so: undefined reference to `__aio_read'
/usr/lib/librt.so: undefined reference to `__aio_fsync64'
collect2: ld returned 1 exit status
gmake[5]: *** [libnspr4.so] Error 1

==================================================
Details of my .mozconfig:
# sh
# Build configuration script
#
# See http://www.mozilla.org/build/unix.html for build instructions.
#

# Options for 'configure' (same as command-line options).

ac_add_options --enable-crypto
ac_add_options --disable-mathml
ac_add_options --disable-installer
ac_add_options --disable-activex
ac_add_options --disable-activex-scripting
ac_add_options --disable-tests
ac_add_options --disable-oji
ac_add_options --disable-necko-disk-cache

# Note: remove enable-optmize and disable debug if you want a debug build
ac_add_options --enable-optimize
ac_add_options --disable-debug

ac_add_options --disable-profilesharing
ac_add_options --enable-extensions=wallet,spellcheck
ac_add_options --enable-necko-protocols=http,file,jar,viewsource,res,data

# Note: Only include icon for mac, windows and os2
#ac_add_options --enable-image-decoders=icon,png,gif,jpeg

export MOZ_THUNDERBIRD=1

mk_add_options MOZ_THUNDERBIRD=1


Reproducible: Always

Steps to Reproduce:
   1.  setenv CVSROOT :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
   2. cvs login (password: anonymous; you only need to login once)
   3. cvs co mozilla/client.mk
   4. cd mozilla
   5. put the .mozconfig listed in details in this directory.
   6. gmake -f client.mk pull_all
   7. gmake -f client.mk build_all

Actual Results:  
gmake[5]: *** [libnspr4.so] Error 1

Expected Results:  
Gmake should not exit on error at this point.
OS: other → SunOS
Hardware: Other → Sun
re-assigning.
Assignee: scott → wchang0222
Component: Build Config → NSPR
Product: Thunderbird → NSPR
QA Contact: asa → wchang0222
Version: unspecified → 3.0
I have no idea what's wrong.

Could you provide the output of the following commands?

1. ldd /usr/lib/librt.so
2. ldd /usr/lib/libnsl.so
3. gcc -v
4. `gcc -print-prog-name=ld` -V
/source/thunderbird/mozilla>ldd /usr/lib/librt.so
        libaio.so.1 =>   /usr/lib/libaio.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libmd5.so.1 =>   /usr/lib/libmd5.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        /usr/platform/SUNW,Sun-Fire-280R/lib/libc_psr.so.1
        /usr/platform/SUNW,Sun-Fire-280R/lib/libmd5_psr.so.1
/source/thunderbird/mozilla>ldd /usr/lib/libnsl.so
        libdl.so.1 =>    /usr/lib/libdl.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libmp.so.2 =>    /usr/lib/libmp.so.2
        /usr/platform/SUNW,Sun-Fire-280R/lib/libc_psr.so.1
/source/thunderbird/mozilla>gcc -v
Reading specs from /usr/gcc/lib/gcc-lib/sparc-sun-solaris2.9/3.2.1/specs
Configured with: ../src/configure --prefix=/usr/gcc --disable-shared
Thread model: posix
gcc version 3.2.1
/source/thunderbird/mozilla>`gcc -print-prog-name=ld` -V
GNU ld version 2.11.2 (with BFD 2.11.2)
  Supported emulations:
   elf32_sparc
   elf64_sparc
I don't know why gcc or GNU ld can't find the dependencies
of /usr/lib/librt.so and /usr/lib/libnsl.so (libaio.so.1,
libmd5.so.1, and libmp.so.2) in the standard system directory
/usr/lib.

So I don't know what the right fix is or if there is something
wrong with your gcc or GNU ld.

I suspect that you can work around this problem by editing
mozilla/nsprpub/pr/src/Makefile.in and add -laio -lmd5 -lmp
to the OS_LIBS for Solaris (between -lnsl and -ldl).  But
that is just a workaround.
Wait wait.
GNU ld?

/source/thunderbird/mozilla>which ld
/usr/ccs/bin/ld
/source/thunderbird/mozilla>ld -V
ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.377

Do I have two ld's on this Solaris box?
Your gcc is using GNU ld, according to the output
of

    `gcc -print-prog-name=ld` -V
Sanity check: I modified mozilla/nsprpub/pr/src/Makefile.in with the workaround
you suggested and it had no effect. Gcc used the old OS_LIBS flags.

Then, I modified Makefile with the workaround and the libnspr4.so compilation
went through. In this case, I got a host of new errors later on.

Did it work as intended?
Right.  I neglected to tell you that you need to
regenerate Makefile after modifying Makefile.in.
It's also okay to make the same change to Makefile,
as you did.

If the new errors are also undefined references,
you may be able to work around them the same way.

If the command

    gcc -B/usr/ccs/bin/ -print-prog-name=ld

returns /usr/ccs/bin/ld, you can tell your gcc to
use Solaris ld by setting the environment variable
CC to

    gcc -B/usr/ccs/bin/

and rerun configure.
gcc -B/usr/ccs/bin/ -print-prog-name=ld
returned "/usr/ccs/bin/ld"

did
setenv CC 'gcc -B/usr/ccs/bin/'

however, the gmake didn't use the value. I ran mozilla/configure. Am I doing
something wrong? Should I gmake clean first?
gmake clean is definitely necessary.  You also need to
make sure that configure uses and substitutes the new
value of CC in the makefiles.
Quite a bit progress.

1. libnspr4.so now compiles. 

Non-functional workaround: add -laio -lmd5 -lmp to the OS_LIBS does help with
libnspr4.so compilation, but creates unresolved references later on.

Working solution: 
gcc -B/usr/ccs/bin/ -print-prog-name=ld
returns "/usr/ccs/bin/ld"

setenv CC 'gcc -B/usr/ccs/bin/'
helps gcc find needed libraries and gets through complete gcc section.
Apparently, gnu ld
>/usr/gcc/lib/gcc-lib/sparc-sun-solaris2.9/3.2.1/ld -v
GNU ld version 2.11.2 (with BFD 2.11.2)
is having heart-ache with Solaris 9 installation. I have no clue why.

2. More library trouble with c++? Suggestions welcome.

rm -f libxpcom_compat_c.so
c++ -I/usr/openwin/include -fno-rtti -fno-exceptions -Wno-long-long -pedantic
-fshort-wchar -pthreads  -DNDEBUG -DTRIMMED -O -fPIC -G -h libxpcom_compat_c.so
-o libxpcom_compat_c.so  nsXPCOMObsolete.o nsRegistry.o      
-L../../../dist/bin -lxpcom  -L../../../dist/bin
-L/afs/sipb.mit.edu/project/firebird/source/thunderbird/mozilla/dist/lib -lplds4
-lplc4 -lnspr4 -ldl -lrt  -L../../../dist/lib -lxpcom_compat  -Wl,-M
-Wl,../../../build/unix/gnu-ld-scripts/components-mapfile -lsocket -ldl -lm    
/usr/gcc/lib/gcc-lib/sparc-sun-solaris2.9/3.2.1/ld:../../../build/unix/gnu-ld-scripts/components-mapfile:
file format not recognized; treating as linker script
/usr/gcc/lib/gcc-lib/sparc-sun-solaris2.9/3.2.1/ld:../../../build/unix/gnu-ld-scripts/components-mapfile:1:
parse error
collect2: ld returned 1 exit status
gmake[4]: *** [libxpcom_compat_c.so] Error 1
gmake[4]: Leaving directory `/source/thunderbird/mozilla/xpcom/obsolete/component'

Update:
I set up:
CC=gcc -B/usr/ccs/bin/
CXX=g++ -B/usr/ccs/bin/

Now, I went very far through the process.

I am trying to use Sun ld in both cases. However, I found another problem: Why
doesn't gcc use the right ld in this case?

rm -f SunOS5.9_OPT.OBJ/libfreebl_hybrid_3.so
gcc -shared -h libfreebl_hybrid_3.so -Wl,-Bsymbolic,-z,defs,-z,now,-z,text,--ver
sion-script,mapfile.Solaris -o SunOS5.9_OPT.OBJ/libfreebl_hybrid_3.so SunOS5.9_O
PT.OBJ/ldvector.o SunOS5.9_OPT.OBJ/prng_fips1861.o SunOS5.9_OPT.OBJ/sysrand.o Su
nOS5.9_OPT.OBJ/sha_fast.o SunOS5.9_OPT.OBJ/md2.o SunOS5.9_OPT.OBJ/md5.o SunOS5.9
_OPT.OBJ/sha512.o SunOS5.9_OPT.OBJ/alg2268.o SunOS5.9_OPT.OBJ/arcfour.o SunOS5.9
_OPT.OBJ/arcfive.o SunOS5.9_OPT.OBJ/desblapi.o SunOS5.9_OPT.OBJ/des.o SunOS5.9_O
PT.OBJ/rijndael.o SunOS5.9_OPT.OBJ/aeskeywrap.o SunOS5.9_OPT.OBJ/dh.o SunOS5.9_O
PT.OBJ/ec.o SunOS5.9_OPT.OBJ/GFp_ecl.o SunOS5.9_OPT.OBJ/GF2m_ecl.o SunOS5.9_OPT.
OBJ/pqg.o SunOS5.9_OPT.OBJ/dsa.o SunOS5.9_OPT.OBJ/rsa.o SunOS5.9_OPT.OBJ/shvfy.o
 SunOS5.9_OPT.OBJ/mpprime.o SunOS5.9_OPT.OBJ/mpmontg.o SunOS5.9_OPT.OBJ/mplogic.
o SunOS5.9_OPT.OBJ/mpi.o SunOS5.9_OPT.OBJ/mp_gf2m.o SunOS5.9_OPT.OBJ/mpi_sparc.o
 SunOS5.9_OPT.OBJ/mpv_sparcv8.o SunOS5.9_OPT.OBJ/montmulfv8.o   /source/thunderb
ird/mozilla/dist/lib/libsecutil.a  -L/source/thunderbird/mozilla/dist/lib/ -lplc4
-lplds4 -lnspr4 -lc
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `getipnodebyaddr'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `dlerror'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `recv'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `connect'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `inet_pton'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `shm_open'
/usr/lib/libc.so: undefined reference to `_dlclose'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `getipnodebyname'
/usr/lib/libc.so: undefined reference to `_dlsym'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `recvfrom'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `sem_wait'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `sem_post'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `gethostbyname_r'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `socket'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `sem_unlink'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `dladdr'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `dlclose'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `freeaddrinfo'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `accept'
/usr/lib/libc.so: undefined reference to `_dlopen'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `h_errno'
/usr/lib/libc.so: undefined reference to `dladdr1'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `bind'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `getprotobyname_r'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `setsockopt'
/usr/lib/libc.so: undefined reference to `_dlerror'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `sem_close'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `dlopen'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `sendto'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `listen'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `getprotobynumber_r'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `dlsym'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `sigtimedwait'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `freehostent'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `shm_unlink'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `shutdown'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `sem_open'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `getpeername'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `getsockopt'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `getaddrinfo'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `socketpair'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `inet_ntop'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `sched_yield'
/source/thunderbird/mozilla/dist/lib//libnspr4
.so: undefined reference to `getsockname'
collect2: ld returned 1 exit status
gmake[6]: *** [SunOS5.9_OPT.OBJ/libfreebl_hybrid_3.so] Error 1
Posted the last error message to Bug 219728.
Let me know if we should close this Bug and open a new one related to ld.
Could you clarify which ld you are referring to?
Will the new bug be about the original build failure
reported in this bug?
Sorry for some silence while I was out of town. I have two next steps:
1. Apply a patch to bug 93206 and getting freebl to compile.

2. Think of generalizing a problem with two "ld"s. 
(1) GNU ld
~>gcc -print-prog-name=ld
/usr/gcc/lib/gcc-lib/sparc-sun-solaris2.9/3.2.1/ld
~>`gcc -print-prog-name=ld` -V
GNU ld version 2.11.2 (with BFD 2.11.2)
  Supported emulations:
   elf32_sparc
   elf64_sparc
(2) SUN ld
~>which ld
/usr/ccs/bin/ld
~>/usr/ccs/bin/ld -V
ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.377
~>gcc -B/usr/ccs/bin/ -print-prog-name=ld
/usr/ccs/bin/ld

It looks like neither you nor I understand while (seemingly preferred) GNU ld is
not working (see earlier thread). I have not compiled gcc nor Sun ld nor GNU ld
myself as I used the ones that were provided by Sun or Sunfreeware binary
distributions.

My web searching for the root of the problem got me as close as this link
http://sources.redhat.com/ml/binutils/2003-04/msg00221.html
which is likely unrelated to this particular case. It doesn't look like others
have experienced what I am experiencing now. It seems that most Solaris 9 users
are running version 8 binaries which are compatible with the newer release.

Question: should I open a more general Seamonkey bug on this issue?
The problem you found by web search seems to be a different problem.

Yes, you can open a SeaMonkey Build-Config bug on the more general
problem: the GNU ld from the Sunfreeware binary distribution cannot
find the implicit dependencies of system libraries (the .so's in
/usr/lib).  GNU ld has a command-line option called -rpath-link
for finding implicit dependencies of libraries, but you'd think
that it should always look in /usr/lib by default.  One thing you
can try is to add "-rpath-link /usr/lib" (or "-Wl,-rpath-link,/usr/lib"
if you use gcc/g++ to link) to the link command line whenever the
build fails in this way.
OK, I am satisfied with the results.

Here is what is required to compile Thunderbird on Solaris 9:

CC=gcc -B/usr/ccs/bin/
CXX=g++ -B/usr/ccs/bin/

Apply patch specified in bug 93206

Use gmake, not make:
gmake -f client.mk build_all

Tools used: 
gcc, g++ and gmake from GNU distribution
ld, as from Sun distribution

OK.  I'll mark this bug fixed then.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.