Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 256102 - dev-libs/nss fails to build on IRIX
Summary: dev-libs/nss fails to build on IRIX
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All IRIX
: High normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-23 16:57 UTC by Stuart Shelton
Modified: 2011-12-15 18:05 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
MIPSpro/IRIX build.log from NSS (build.log,156.75 KB, text/plain)
2009-09-16 16:41 UTC, Stuart Shelton
Details
Patch for nss stubs.c (nss-3.12.4.patch,3.11 KB, patch)
2009-09-16 17:15 UTC, Stuart Shelton
Details | Diff
Patch for freebl (nss-3.12.4.patch,3.99 KB, patch)
2009-09-16 17:30 UTC, Stuart Shelton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2009-01-23 16:57:09 UTC
dev-libs/nss-3.12-r1 and dev-libs/nss-3.12.2_rc1 both fail with:


>>> Emerging (1 of 3) dev-libs/nss-3.12.2_rc1
 * nss-3.12.2_rc1.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...                                                                                                                                   [ ok ]
 * checking ebuild checksums ;-) ...                                                                                                                                                        [ ok ]
 * checking auxfile checksums ;-) ...                                                                                                                                                       [ ok ]
 * checking miscfile checksums ;-) ...                                                                                                                                                      [ ok ]
>>> Unpacking source...
>>> Unpacking nss-3.12.2_rc1.tar.bz2 to /usr/opt/portage/var/tmp/portage/dev-libs/nss-3.12.2_rc1/work
 * Applying nss-3.11-config.patch ...                                                                                                                                                        [ ok ]
 * Applying nss-3.12-config-1.patch ...                                                                                                                                                      [ ok ]
 * Applying nss-mips64-2.patch ...                                                                                                                                                           [ ok ]
 * Applying nss-3.12-solaris-gcc.patch ...                                                                                                                                                   [ ok ]
>>> Source unpacked in /usr/opt/portage/var/tmp/portage/dev-libs/nss-3.12.2_rc1/work
>>> Compiling source in /usr/opt/portage/var/tmp/portage/dev-libs/nss-3.12.2_rc1/work ...
make -j1 BUILD_OPT=1 'XCFLAGS= -O2 -mips4' CC=cc 
cd nsinstall; make export
make[1]: Entering directory `/usr/opt/portage/var/tmp/portage/dev-libs/nss-3.12.2_rc1/work/mozilla/security/coreconf/nsinstall'
make[1]: Nothing to be done for `export'.
make[1]: Leaving directory `/usr/opt/portage/var/tmp/portage/dev-libs/nss-3.12.2_rc1/work/mozilla/security/coreconf/nsinstall'
cd nsinstall; make libs
make[1]: Entering directory `/usr/opt/portage/var/tmp/portage/dev-libs/nss-3.12.2_rc1/work/mozilla/security/coreconf/nsinstall'
cc -o IRIX6.5_OPT.OBJ/nsinstall.o -c -O -Olimit 4000 -fullwarn -xansi -woff 1209 -32 -multigot -DSVR4 -DIRIX  -multigot -D_SGI_MP_SOURCE -32 -DIRIX6_5 -mips3 -DXP_UNIX -UDEBUG -DNDEBUG -DNSS_ENABLE_ECC -DUSE_UTIL_DIRECTLY -I../../dist/IRIX6.5_OPT.OBJ/include  -I../../dist/public/coreconf -I../../dist/private/coreconf -I/opt/portage/usr/include/nspr -I../../dist/IRIX6.5_OPT.OBJ/include/dbm -O2 -mips4 nsinstall.c
cc WARNING:  -I../../dist/IRIX6.5_OPT.OBJ/include does not refer to a valid directory
cc WARNING:  -I../../dist/public/coreconf does not refer to a valid directory
cc WARNING:  -I../../dist/private/coreconf does not refer to a valid directory
cc WARNING:  -I../../dist/IRIX6.5_OPT.OBJ/include/dbm does not refer to a valid directory
cc -o IRIX6.5_OPT.OBJ/pathsub.o -c -O -Olimit 4000 -fullwarn -xansi -woff 1209 -32 -multigot -DSVR4 -DIRIX  -multigot -D_SGI_MP_SOURCE -32 -DIRIX6_5 -mips3 -DXP_UNIX -UDEBUG -DNDEBUG -DNSS_ENABLE_ECC -DUSE_UTIL_DIRECTLY -I../../dist/IRIX6.5_OPT.OBJ/include  -I../../dist/public/coreconf -I../../dist/private/coreconf -I/opt/portage/usr/include/nspr -I../../dist/IRIX6.5_OPT.OBJ/include/dbm -O2 -mips4 pathsub.c
cc WARNING:  -I../../dist/IRIX6.5_OPT.OBJ/include does not refer to a valid directory
cc WARNING:  -I../../dist/public/coreconf does not refer to a valid directory
cc WARNING:  -I../../dist/private/coreconf does not refer to a valid directory
cc WARNING:  -I../../dist/IRIX6.5_OPT.OBJ/include/dbm does not refer to a valid directory
cc-3201 cc: REMARK File = pathsub.c, Line = 123
  The parameter "dir" was never referenced.

  ino2name(ino_t ino, char *dir)
                            ^

cc -o IRIX6.5_OPT.OBJ/nsinstall -O -Olimit 4000 -fullwarn -xansi -woff 1209 -32 -multigot -DSVR4 -DIRIX  -multigot -D_SGI_MP_SOURCE -32 -DIRIX6_5 -mips3 -DXP_UNIX -UDEBUG -DNDEBUG -DNSS_ENABLE_ECC -DUSE_UTIL_DIRECTLY -I../../dist/IRIX6.5_OPT.OBJ/include  -I../../dist/public/coreconf -I../../dist/private/coreconf -I/opt/portage/usr/include/nspr -I../../dist/IRIX6.5_OPT.OBJ/include/dbm -O2 -mips4 IRIX6.5_OPT.OBJ/nsinstall.o IRIX6.5_OPT.OBJ/pathsub.o -Wl,-s,-x,-n32,-mips4,-rdata_shared,-allow_jump_at_eop,-rpath,/opt/portage/usr/lib:/opt/portage/lib -L/opt/portage/usr/lib -L/opt/portage/lib   
cc WARNING:  -I../../dist/IRIX6.5_OPT.OBJ/include does not refer to a valid directory
cc WARNING:  -I../../dist/public/coreconf does not refer to a valid directory
cc WARNING:  -I../../dist/private/coreconf does not refer to a valid directory
cc WARNING:  -I../../dist/IRIX6.5_OPT.OBJ/include/dbm does not refer to a valid directory
ld32: FATAL   9  : I/O error (4000): No such file or directory
make[1]: *** [IRIX6.5_OPT.OBJ/nsinstall] Error 2
make[1]: Leaving directory `/usr/opt/portage/var/tmp/portage/dev-libs/nss-3.12.2_rc1/work/mozilla/security/coreconf/nsinstall'
make: *** [libs] Error 2
 * ERROR: dev-libs/nss-3.12.2_rc1 failed:
 *   coreconf make failed
 * 
 * Call stack:
 *               ebuild.sh:  49: <call src_compile>
 *             environment:2480:     emake -j1 BUILD_OPT=1 XCFLAGS="${CFLAGS}" CC="$(tc-getCC)" || die "coreconf make failed";


Rather than "../../dist/IRIX6.5_OPT.OBJ/include", for example, the correct path from the "nsinstall" directory would simply be "IRIX6.5_OPT.OBJ/include" (or "../../coreconf/nsinstall/IRIX6.5_OPT.OBJ/include" at least).

The problem might be related to be the following lines in the ebuild:

    # modify install path
    sed -e 's:SOURCE_PREFIX = $(CORE_DEPTH)/\.\./dist:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \
        -i source.mk

... although the result doesn't seem to differ with these commented out (might this indicate that there weren't working in the first place, and this is the problem that they're trying to fix?)
Comment 1 Fabian Groffen gentoo-dev 2009-06-30 19:29:18 UTC
no clue, but is this still the case with the most recent nss?
Comment 2 Stuart Shelton 2009-07-02 13:11:45 UTC
It looks as if NSS did at some point have IRIX support - but it's horribly outdated, and now probably a liability.  Having worked around several breakages in the build system with the IRIX-MIPSpro-wrapper script, the build process got as far as invoking 'shlibsign' and then aborted as this segfaulted on each run.

Optimising at only -O1 fixed this problem, but the build fails with:

ld -no_unresolved -shared -soname libsmime3.so -Wl,-s,-x,-n32,-mips4,-rdata_shared,-allow_jump_at_eop,-rpath,/opt/gentoo/usr/lib32:/opt/gentoo/lib32 -L/opt/gentoo/usr/lib32 -L/opt/gentoo/lib32 -o IRIX6.5_OPT.OBJ/libsmime3.so IRIX6.5_OPT.OBJ/cmsarray.o IRIX6.5_OPT.OBJ/cmsasn1.o IRIX6.5_OPT.OBJ/cmsattr.o IRIX6.5_OPT.OBJ/cmscinfo.o IRIX6.5_OPT.OBJ/cmscipher.o IRIX6.5_OPT.OBJ/cmsdecode.o IRIX6.5_OPT.OBJ/cmsdigdata.o IRIX6.5_OPT.OBJ/cmsdigest.o IRIX6.5_OPT.OBJ/cmsencdata.o IRIX6.5_OPT.OBJ/cmsencode.o IRIX6.5_OPT.OBJ/cmsenvdata.o IRIX6.5_OPT.OBJ/cmsmessage.o IRIX6.5_OPT.OBJ/cmspubkey.o IRIX6.5_OPT.OBJ/cmsrecinfo.o IRIX6.5_OPT.OBJ/cmsreclist.o IRIX6.5_OPT.OBJ/cmssigdata.o IRIX6.5_OPT.OBJ/cmssiginfo.o IRIX6.5_OPT.OBJ/cmsutil.o IRIX6.5_OPT.OBJ/smimemessage.o IRIX6.5_OPT.OBJ/smimeutil.o IRIX6.5_OPT.OBJ/smimever.o ../pkcs12/IRIX6.5_OPT.OBJ/p12local.o ../pkcs12/IRIX6.5_OPT.OBJ/p12creat.o ../pkcs12/IRIX6.5_OPT.OBJ/p12dec.o ../pkcs12/IRIX6.5_OPT.OBJ/p12plcy.o ../pkcs12/IRIX6.5_OPT.OBJ/p12tmpl.o ../pkcs12/IRIX6.5_OPT.OBJ/p12e.o ../pkcs12/IRIX6.5_OPT.OBJ/p12d.o ../pkcs7/IRIX6.5_OPT.OBJ/certread.o ../pkcs7/IRIX6.5_OPT.OBJ/p7common.o ../pkcs7/IRIX6.5_OPT.OBJ/p7create.o ../pkcs7/IRIX6.5_OPT.OBJ/p7decode.o ../pkcs7/IRIX6.5_OPT.OBJ/p7encode.o ../pkcs7/IRIX6.5_OPT.OBJ/p7local.o ../pkcs7/IRIX6.5_OPT.OBJ/secmime.o   -L../../../dist/IRIX6.5_OPT.OBJ/lib -lnss3 -lnssutil3 -L/opt/gentoo/usr/lib32/nspr -lplc4 -lplds4 -lnspr4
ld32: Laying out sections and assigning virtual addresses.
ld32: Fixing up symbol values.
ld32: Sorting symbol table.
ld32: Pass2:  creating output file.
ld32: .MIPS.options.
ld32: .reginfo.
ld32: .dynamic.
ld32: .liblist.
ld32: .dynstr.
ld32: .hash.
ld32: .dynsym.
ld32: .MIPS.symlib.
ld32: .rel.dyn.
ld32: .msym.
ld32: .conflict.
ld32: .MIPS.stubs.
ld32: .text.
ld32: FATAL   2  : Internal: at ../../ld/multigot.c lgot_local_got_offset() seg_ndx exceeds per_seg_lgot_table
ld32: INFO    152: Output file removed because of error.
make[2]: *** [IRIX6.5_OPT.OBJ/libsmime3.so] Error 1
make[2]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.3/work/nss-3.12.3/mozilla/security/nss/lib/smime'
make[1]: *** [libs] Error 2
make[1]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.3/work/nss-3.12.3/mozilla/security/nss/lib'
make: *** [libs] Error 2
 * ERROR: dev-libs/nss-3.12.3 failed:
 *   nss make failed
 * 
 * Call stack:
 *               ebuild.sh:  42: <call src_compile>
 *             environment:2578:     emake -j1 BUILD_OPT=1 XCFLAGS="${CFLAGS}" CC="$(tc-getCC)" || die "nss make failed"


A quick search for the problem has it referenced (in different circumstances) in these pages:

http://gcc.gnu.org/ml/gcc-bugs/2001-07/msg00720.html
http://gcc.gnu.org/ml/gcc/2003-09/msg00894.html
http://unix.derkeiler.com/Newsgroups/comp.sys.sgi.misc/2007-02/msg00003.html

The package is trying to build O32/mips3 code, which cannot link against n32/mips4 libraries - so the wrapper is automatically upgrading this.  I'll carry on investigating...
Comment 3 Stuart Shelton 2009-07-06 09:56:00 UTC
In order to stand a chance of working, the nss ebuild requires the following changes:

--- nss-3.12.3.ebuild
+++ nss-3.12.3.ebuild
@@ -20,7 +20,8 @@ IUSE="utils"
 S="${WORKDIR}/${P}"
 
 DEPEND=">=dev-libs/nspr-${NSPR_VER}
-       >=dev-db/sqlite-3.5"
+       >=dev-db/sqlite-3.5
+       sys-apps/file"
 
 src_unpack() {
        unpack ${A}
@@ -63,6 +64,15 @@ src_compile() {
        export NSDISTMODE=copy
        export NSS_USE_SYSTEM_SQLITE=1
        export NSS_ENABLE_ECC=1
+
+       if [[ ${CHOST} == *-irix* ]]; then
+               # shlibsign segfaults at -O2
+               replace-flags -O? -O1
+               export BUILD_OPT=1
+               export USE_N32=1
+               export USE_PTHREADS=1
+       fi
+
        cd "${S}"/mozilla/security/coreconf
        emake -j1 BUILD_OPT=1 XCFLAGS="${CFLAGS}" CC="$(tc-getCC)" || die "coreconf make failed"
        cd "${S}"/mozilla/security/dbm

... but even with this I hit the multigot problem :(

I will try building without the "-multigot" LDFLAG (automatically added by the NSS source) to see whether it builds, and whether the test-suite passes.

(The 'ld' manpage says:

               multigot
                    This is for internal use.  Usually, the linker attempts
                    to link everything, generating a single GOT.  If this
                    fails, it reruns the layout phase and possibly creates
                    multiple GOT regions.  This option causes the first
                    layout pass to fail.  This is used in conjunction with
                    the mgot_threshold option described previously.

... which all sounds a bit hairy to me)
Comment 4 Stuart Shelton 2009-07-07 14:04:35 UTC
Nope - same error in the same place without the multigot option.

Final thing I can try: building mips3 code at -O1 with the USE_N32 variable set.
Comment 5 Jory A. Pratt gentoo-dev 2009-09-16 00:04:32 UTC
(In reply to comment #4)
> Nope - same error in the same place without the multigot option.
> 
> Final thing I can try: building mips3 code at -O1 with the USE_N32 variable
> set.
> 

If you could please test with nss-3.12.4 would be helpful, you should not need to define anything in the ebuild. Any build failure please post here, upstream has done much work to support all archs much better.
Comment 6 Stuart Shelton 2009-09-16 16:40:08 UTC
Looks as if more work is needed, I'm afraid :(

It's a little complex to tell what's going on, since the '-fullwarn' option (akin to GNU '-Wall') makes the compiler *very* verbose, with lots of "REMARK" notices generated by code-style deviations, functions without prototypes, variables never referenced, type conversions, and other such ephemera.

There are lots of notices of the form:

cc WARNING:  -I../../dist/IRIX6.5_OPT.OBJ/include does not refer to a valid directory
cc WARNING:  -I../../dist/private/dbm does not refer to a valid directory

The actual errors are:

cc -o IRIX6.5_OPT.OBJ/IRIX_SINGLE_SHLIB/stubs.o -c -O -Olimit 4000 -fullwarn -xansi -woff 1209 -32 -multigot -DSVR4 -DIRIX  -multigot -D_SGI_MP_SOURCE -32 -DIRIX6_5 -mips3 -DXP_UNIX -DSHLIB_SUFFIX=\"so\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -DNSS_ENABLE_ECC -DUSE_UTIL_DIRECTLY -DFREEBL_NO_DEPEND -DMP_API_COMPATIBLE -I/opt/gentoo/usr/include/nspr   -I../../../dist/IRIX6.5_OPT.OBJ/include -I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl -c99 -O2 -n32 -mips4 -r14000 -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -diag_error 1035,1999,3333 -woff 1174,1183,1185,1552,3968,3970 stubs.c                                                                                                                           cc WARNING:  -I../../../dist/IRIX6.5_OPT.OBJ/include does not refer to a valid directory                                                                                                           cc-1117 cc: ERROR File = stubs.c, Line = 202
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL1(PORT_Free_Util, ptr);                                                                                                                                                              ^                                                                                                                                                                                            
cc-1117 cc: ERROR File = stubs.c, Line = 203
  An expression appears after a "return" in a "void" function.

      return free(ptr);                                                                                                                                                                                         ^                                                                                                                                                                                                                                                                                                                                                                                        cc-1117 cc: ERROR File = stubs.c, Line = 221                                                                                                                                                         An expression appears after a "return" in a "void" function.                                                                                                                                                                                                                                                                                                                                              STUB_SAFE_CALL2(PORT_ZFree_Util, ptr, len);                                                                                                                                                        ^                                                                                                                                                                                                                                                                                                                                                                                               cc-1117 cc: ERROR File = stubs.c, Line = 223                                                                                                                                                         An expression appears after a "return" in a "void" function.                                                                                                                                                                                                                                                                                                                                              return free(ptr);                                                                                                                                                                                         ^                                                                                                                                                                                                                                                                                                                                                                                        cc-1117 cc: ERROR File = stubs.c, Line = 229                                                                                                                                                         An expression appears after a "return" in a "void" function.                                                                                                                                                                                                                                                                                                                                              STUB_SAFE_CALL1(PR_Free, ptr);                                                                                                                                                                     ^                                               
                                                      
cc-1117 cc: ERROR File = stubs.c, Line = 230          
  An expression appears after a "return" in a "void" function.
                                                      
      return free(ptr);                               
             ^                                        
                                                      
cc-1117 cc: ERROR File = stubs.c, Line = 258          
  An expression appears after a "return" in a "void" function.
                                                      
      STUB_SAFE_CALL2(PORT_FreeArena_Util, arena, zero);
      ^                                               
                                                      
cc-1020 cc: ERROR File = stubs.c, Line = 347          
  The identifier "Dl_info" is undefined.              
                                                      
      Dl_info dli;                                    
      ^                                               
                                                      
cc-1196 cc: WARNING File = stubs.c, Line = 352        
  The indicated function is declared implicitly.      
                                                      
      if (dladdr((void *)addr, &dli) == 0) {          
          ^                                           
                                                      
cc-1117 cc: ERROR File = stubs.c, Line = 376          
  An expression appears after a "return" in a "void" function.
                                                      
      STUB_SAFE_CALL1(PORT_SetError_Util, value);     
      ^                                               
                                                      
cc-1117 cc: ERROR File = stubs.c, Line = 384          
  An expression appears after a "return" in a "void" function.
                                                      
      STUB_SAFE_CALL3(PR_Assert, s, file, ln);        
      ^                                               
                                                      
cc-1117 cc: ERROR File = stubs.c, Line = 419          
  An expression appears after a "return" in a "void" function.
                                                      
      STUB_SAFE_CALL1(PR_Lock, lock);
      ^                                               
                                                      
cc-1117 cc: ERROR File = stubs.c, Line = 427          
  An expression appears after a "return" in a "void" function.
                                                      
      STUB_SAFE_CALL1(PR_DestroyLock, lock);          
      ^                                               
                                                      
cc-1117 cc: ERROR File = stubs.c, Line = 450          
  An expression appears after a "return" in a "void" function.
                                                      
      STUB_SAFE_CALL2(SECITEM_FreeItem_Util, zap, freeit);
      ^                                               
                                                      
cc-1117 cc: ERROR File = stubs.c, Line = 481          
  An expression appears after a "return" in a "void" function.
                                                      
      STUB_SAFE_CALL2(SECITEM_ZfreeItem_Util, zap, freeit);
      ^                                               
                                                      
cc-1079 cc: ERROR File = stubs.c, Line = 541          
  A type specifier is expected.                       
                                                      
  void __attribute ((destructor)) FREEBL_unload()     
                    ^                                 
                                                      
cc-1137 cc: ERROR File = stubs.c, Line = 541          
  Unnamed prototyped parameters not allowed when body is present.
                                                      
  void __attribute ((destructor)) FREEBL_unload()     
       ^                                              
                                                      
cc-1129 cc: ERROR File = stubs.c, Line = 541          
  A left brace ("{") is expected at this point.       
                                                      
  void __attribute ((destructor)) FREEBL_unload()     
                                  ^                   
                                                      
unable to proceed because of earlier errors           
17 errors detected in the compilation of "stubs.c".   
make[3]: *** [IRIX6.5_OPT.OBJ/IRIX_SINGLE_SHLIB/stubs.o] Error 2
make[3]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/lib/freebl'
make[2]: *** [libs] Error 2                           
make[2]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/lib/freebl'
make[1]: *** [libs] Error 2                           
make[1]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/lib'
make: *** [libs] Error 2                              
 * ERROR: dev-libs/nss-3.12.4 failed:                 
 *   nss make failed                                  
 *                                                    
 * Call stack:                                        
 *               ebuild.sh:  51: <call call-ebuildshell 'src_compile'>
 *             environment: 423: <call src_compile>   
 *             environment:2719:     emake -j1 CC="$(tc-getCC)" || die "nss make failed"

... so it looks as if there's still unconditional GNU-specific syntax (__attribute) in there.
Comment 7 Stuart Shelton 2009-09-16 16:41:46 UTC
Created attachment 204338 [details]
MIPSpro/IRIX build.log from NSS
Comment 8 Stuart Shelton 2009-09-16 16:52:08 UTC
(The '../../../dist/IRIX_6.5_OPT.OBJ' directory does exist, but contains only 'bin' and 'lib', not the 'include' directory referenced)

Moving the defintion of WEAK down so that it's only set if used and removing the '__attribute ((destructor))' results in a build failure with the following output:

cd freebl; make libs
make[2]: Entering directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/lib/freebl'
../../../coreconf/nsinstall/IRIX6.5_OPT.OBJ/nsinstall -t -m 664 IRIX6.5_OPT.OBJ/libfreebl.a ../../../dist/IRIX6.5_OPT.OBJ/lib
make FREEBL_CHILD_BUILD=1 \
 OBJDIR=IRIX6.5_OPT.OBJ/IRIX_SINGLE_SHLIB libs
make[3]: Entering directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/lib/freebl'
cc -o IRIX6.5_OPT.OBJ/IRIX_SINGLE_SHLIB/stubs.o -c -O -Olimit 4000 -fullwarn -xansi -woff 1209 -32 -multigot -DSVR4 -DIRIX  -multigot -D_SGI_MP_SOURCE -32 -DIRIX6_5 -mips3 -DXP_UNIX -DSHLIB_SUFFIX=\"so\" -DSHLIB_PREFIX=\"lib\" -DSHLIB_VERSION=\"3\" -DSOFTOKEN_SHLIB_VERSION=\"3\" -DRIJNDAEL_INCLUDE_TABLES -UDEBUG -DNDEBUG -DNSS_ENABLE_ECC -DUSE_UTIL_DIRECTLY -DFREEBL_NO_DEPEND -DMP_API_COMPATIBLE -I/opt/gentoo/usr/include/nspr   -I../../../dist/IRIX6.5_OPT.OBJ/include -I../../../dist/public/nss -I../../../dist/private/nss -Impi -Iecl -c99 -O2 -n32 -mips4 -r14000 -float_const -use_readonly_const -TARG:isa=mips4:platform=ip30:processor=r14000 -TENV:zeroinit_in_bss=ON -OPT:fast_io=ON:Olimit=8192:reorg_common=ON:swp=ON -LNO:auto_dist=ON:fusion_peeling_limit=8:gather_scatter=2 -diag_error 1035,1999,3333 -woff 1174,1183,1185,1552,3968,3970 stubs.c
cc WARNING:  -I../../../dist/IRIX6.5_OPT.OBJ/include does not refer to a valid directory
cc-1117 cc: ERROR File = stubs.c, Line = 202
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL1(PORT_Free_Util, ptr);
      ^

cc-1117 cc: ERROR File = stubs.c, Line = 203
  An expression appears after a "return" in a "void" function.

      return free(ptr);
             ^

cc-1117 cc: ERROR File = stubs.c, Line = 221
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL2(PORT_ZFree_Util, ptr, len);
      ^

cc-1117 cc: ERROR File = stubs.c, Line = 223
  An expression appears after a "return" in a "void" function.

      return free(ptr);
             ^

cc-1117 cc: ERROR File = stubs.c, Line = 229
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL1(PR_Free, ptr);
      ^

cc-1117 cc: ERROR File = stubs.c, Line = 230
  An expression appears after a "return" in a "void" function.

      return free(ptr);
             ^

cc-1117 cc: ERROR File = stubs.c, Line = 258
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL2(PORT_FreeArena_Util, arena, zero);
      ^

cc-1020 cc: ERROR File = stubs.c, Line = 347
  The identifier "Dl_info" is undefined.

      Dl_info dli;
      ^

cc-1196 cc: WARNING File = stubs.c, Line = 352
  The indicated function is declared implicitly.

      if (dladdr((void *)addr, &dli) == 0) {
          ^

cc-1117 cc: ERROR File = stubs.c, Line = 376
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL1(PORT_SetError_Util, value);
      ^

cc-1117 cc: ERROR File = stubs.c, Line = 384
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL3(PR_Assert, s, file, ln);
      ^

cc-1117 cc: ERROR File = stubs.c, Line = 419
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL1(PR_Lock, lock);
      ^

cc-1117 cc: ERROR File = stubs.c, Line = 427
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL1(PR_DestroyLock, lock);
      ^

cc-1117 cc: ERROR File = stubs.c, Line = 450
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL2(SECITEM_FreeItem_Util, zap, freeit);
      ^

cc-1117 cc: ERROR File = stubs.c, Line = 481
  An expression appears after a "return" in a "void" function.

      STUB_SAFE_CALL2(SECITEM_ZfreeItem_Util, zap, freeit);
      ^

cc-1020 cc: ERROR File = stubs.c, Line = 564
  The identifier "RTLD_NOLOAD" is undefined.

        nspr = freebl_getLibrary(nsprLibName);
               ^

cc-1020 cc: ERROR File = stubs.c, Line = 577
  The identifier "RTLD_NOLOAD" is undefined.

        nssutil= freebl_getLibrary(nssutilLibName);
                 ^

16 errors detected in the compilation of "stubs.c".
make[3]: *** [IRIX6.5_OPT.OBJ/IRIX_SINGLE_SHLIB/stubs.o] Error 2
make[3]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/lib/freebl'
make[2]: *** [libs] Error 2
Comment 9 Stuart Shelton 2009-09-16 17:10:28 UTC
IRIX' dlopen() supports RTLD_LAZY as the mode1 specifier, but only RTLD_GLOBAL or RTLD_LOCAL (the default) as the mode2 specifier - not RTLD_NOLOAD.

RTLD_NOLOAD appears to be a non-POSIX extension only valid with glibc-2.2+

Weirdly, even though the SGI documentation states that <dlfcn.h> is needed for dladdr, it doesn't seem to be defined there - or anywhere(!)

Indeed, the SGI manpage ( http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0650&db=man&fname=/usr/share/catman/p_man/cat3/libdl/dladdr.z ) states specifically:

     <dlfcn.h> does not contain a prototype for dladdr or definition of
     Dl_info.  The #include <dlfcn.h>  in the SYNOPSIS line is traditional,
     but contains no dladdr prototype and no IRIX library contains an
     implementation.  Write your own declaration based on the code below.
Comment 10 Stuart Shelton 2009-09-16 17:15:22 UTC
Created attachment 204339 [details, diff]
Patch for nss stubs.c


I've no idea whether these changes will do the right thing - but they do allow compilation to continue.

There seems to be many instances throughout the code of attempting to 'return' a value from functions with 'void' return-types, though - and these are taken to be fatal errors by the IRIX platform compilers.
Comment 11 Stuart Shelton 2009-09-16 17:30:57 UTC
Created attachment 204341 [details, diff]
Patch for freebl


Actually, it looks as if only one other file was trying to return from void functions.

I notice that the dladdr() manpage states:

     The function returns zero if the address cannot be associated with a
     mapped-in object.  In such a case, the Dl_info fields are not touched.
     The function returns non-zero if it can be associated with a mapped-in
     object, and the Dl_info fields are updated.

... can this be used to emulate LD_NOLOAD?
Comment 12 Stuart Shelton 2009-09-17 09:18:07 UTC
The build still fails with:

 make[3]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd/shlibsign/mangle'
cd IRIX6.5_OPT.OBJ ; sh /usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd/shlibsign/./sign.sh /usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd/shlibsign/../../../dist/IRIX6.5_OPT.OBJ \
        /usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd/shlibsign/IRIX6.5_OPT.OBJ IRIX \
        /opt/gentoo/usr/lib32/nspr   /usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd/shlibsign/../../../dist/IRIX6.5_OPT.OBJ/lib/libsoftokn3.so
/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd/shlibsign/IRIX6.5_OPT.OBJ/shlibsign -v -i /usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd/shlibsign/../../../dist/IRIX6.5_OPT.OBJ/lib/libsoftokn3.so
/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd/shlibsign/./sign.sh: line 2: 115444322 Segmentation fault      (core dumped) ${2}/shlibsign -v -i ${5}
make[2]: *** [../../../dist/IRIX6.5_OPT.OBJ/lib/libsoftokn3.chk] Error 139
make[2]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd/shlibsign'
make[1]: *** [libs] Error 2
make[1]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/cmd'
make: *** [libs] Error 2

... so it looks as if building at -O1 is still a requirement.
Comment 13 Stuart Shelton 2009-09-17 13:07:04 UTC
<sigh> nope, fails with the same multigot error even in 3.12.4.

Which means that, due to the patches needed, 3.12.4 is actually less compatible than earlier releases ;)

ld32: Pass2:  creating output file.
ld32: .MIPS.options.
ld32: .reginfo.
ld32: .dynamic.
ld32: .liblist.
ld32: .dynstr.
ld32: .hash.
ld32: .dynsym.
ld32: .MIPS.symlib.
ld32: .rel.dyn.
ld32: .msym.
ld32: .conflict.
ld32: .MIPS.stubs.
ld32: .text.
ld32: FATAL   2  : Internal: at ../../ld/multigot.c lgot_local_got_offset() seg_ndx exceeds per_seg_lgot_table
ld32: INFO    152: Output file removed because of error.
make[2]: *** [IRIX6.5_n32_PTH_OPT.OBJ/libsmime3.so] Error 1
make[2]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/lib/smime'
make[1]: *** [libs] Error 2
make[1]: Leaving directory `/usr/opt/gentoo/var/tmp/portage/dev-libs/nss-3.12.4/work/nss-3.12.4/mozilla/security/nss/lib'
make: *** [libs] Error 2
Comment 14 Fabian Groffen gentoo-dev 2011-12-15 18:05:08 UTC
We are sorry to close this bug.  We lack the man-power and devotion to support mips-irix in the tree.