Closed Bug 536821 Opened 10 years ago Closed 10 years ago

IPv6 code compilation errors on AIX 4.3.3

Categories

(NSPR :: NSPR, defect)

PowerPC
AIX
defect
Not set

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ul-mcamafia, Assigned: wtc)

Details

Attachments

(1 file, 4 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.6) Gecko/20091206 SeaMonkey/2.0.1
Build Identifier: NSPR_4_7_6_RTM

Build Firefox/Seamonkey/Thunderbird fails on AIX 4.3.3.
Easiest solution is to unconfigure IPv6 support for this near-to-obsolete platform.

Reproducible: Always

Steps to Reproduce:
1. Compile on AIX 4.3.3 ML11 with VisualAge C++ 6.0.0.8 or later
Actual Results:  
Failure to compile nsprpub/pr/src/misc/prnetdb.c
IPv6 support on AIX 4.3.3 isn't really useable, so I doubt fixing is worth.

Expected Results:  
successful compilation
OS: Other → AIX
Version: other → 4.7.6
This patch simply removes the broken IPv6 for AIX 4.3, leaving AIX 5.x configuration untouched working.
Attachment #419211 - Flags: review?
Attachment #419211 - Flags: review? → review?(wtc)
Thanks for the patch.  I guess IPv6 isn't broken in AIX 4.3.3,
but rather it's the NSPR file prnetdb.c that has compilation
errors on AIX 4.3.3.  Correct?

Could you post the compilation errors?  It may be easy to fix
them.  If not, we can check in your patch (with a comment saying
that USE_IPV6 could be set to 1 but someone needs to do the work).
Status: UNCONFIRMED → NEW
Ever confirmed: true
Also, please use the NSPR CVS tag NSPR_HEAD_20091219 instead
of NSPR_4_7_6_RTM if you can.
I will checkout NSPR_HEAD_20091219 into my Firefox 3.0.17 source tree, and backout my patch locally to reproduce the exact error message.
But I cannot test IPv6 connectivity from my only left AIX 4.3.3 machine, IPv4 only network.
The problem appeared with the update Seamonkey 1.1.17 -> 1.1.18.
Uli: You don't need to test IPv6 connectivity.  You just need to
test my fixes for the compilation errors (if they're easy to fix).
Thanks.
Here is the output compiling pr/src/misc/prnetdb.c tag NSPR_4_7_6_RTM :

xlc_r -qlanglvl=stdc99 -o prnetdb.o -c      -qro -qroconst -O2 -qarch=com -qmaxmem=-1 -qalias=noansi   -UDEBUG  -DMOZILLA_CLIENT=1 -DNDEBUG=1 -DXP_UNIX=1 -DAIX=1 -DSYSV=1 -DAIX_HAVE_ATOMIC_OP_H=1 -DAIX_TIMERS=1 -D_PR_HAVE_OFF64_T=1 -DAIX4_3_PLUS=1 -DHAVE_SOCKLEN_T=1 -DHAVE_FCNTL_FILE_LOCKING=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -DHAVE_POINTER_LOCALTIME_R=1 -D_PR_HAVE_THREADSAFE_GETHOST=1  -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_PR_INET6 -D_NSPR_BUILD_ -I/home/ulink/Src/mozilla/FX3-OBJ-NSPR/dist/include/nspr -I/home/ulink/Src/mozilla/nsprpub/pr/include -I/home/ulink/Src/mozilla/nsprpub/pr/include/private  "/home/ulink/Src/mozilla/nsprpub/pr/src/misc/prnetdb.c"
"/home/ulink/Src/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2135.22: 1506-045 (S) Undeclared identifier AI_NUMERICHOST.
gmake[5]: *** [prnetdb.o] Error 1
gmake[5]: Leaving directory `/home/ulink/Src/mozilla/FX3-OBJ-NSPR/nsprpub/pr/src/misc'
gmake[4]: *** [export] Error 2
gmake[4]: Leaving directory `/home/ulink/Src/mozilla/FX3-OBJ-NSPR/nsprpub/pr/src'
gmake[3]: *** [export] Error 2
gmake[3]: Leaving directory `/home/ulink/Src/mozilla/FX3-OBJ-NSPR/nsprpub/pr'
gmake[2]: *** [export] Error 2
gmake[2]: Leaving directory `/home/ulink/Src/mozilla/FX3-OBJ-NSPR/nsprpub'
gmake[1]: *** [tier_nspr] Error 2
gmake[1]: Leaving directory `/home/ulink/Src/mozilla/FX3-OBJ-NSPR'
gmake: *** [default] Error 2
After updating to NSPR_HEAD_20091219 same error message:
xlc_r -qlanglvl=stdc99 -o prnetdb.o -c      -qro -qroconst -O2 -qarch=com -qmaxmem=-1 -qalias=noansi   -UDEBUG  -DMOZILLA_CLIENT=1 -DNDEBUG=1 -DXP_UNIX=1 -DAIX=1 -DSYSV=1 -DAIX_HAVE_ATOMIC_OP_H=1 -DAIX_TIMERS=1 -D_PR_HAVE_OFF64_T=1 -DAIX4_3_PLUS=1 -DHAVE_SOCKLEN_T=1 -DHAVE_FCNTL_FILE_LOCKING=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -DHAVE_POINTER_LOCALTIME_R=1 -D_PR_HAVE_THREADSAFE_GETHOST=1  -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_PR_INET6 -D_NSPR_BUILD_ -I/home/ulink/Src/mozilla/FX3-OBJ-NSPR/dist/include/nspr -I/home/ulink/Src/mozilla/nsprpub/pr/include -I/home/ulink/Src/mozilla/nsprpub/pr/include/private  "/home/ulink/Src/mozilla/nsprpub/pr/src/misc/prnetdb.c"
"/home/ulink/Src/mozilla/nsprpub/pr/src/misc/prnetdb.c", line 2146.22: 1506-045 (S) Undeclared identifier AI_NUMERICHOST.
gmake[5]: *** [prnetdb.o] Error 1

I found another error before this in pr/src/linking/prlink.c:
"/home/ulink/Src/mozilla/nsprpub/pr/src/linking/prlink.c", line 1400.33: 1506-04
5 (S) Undeclared identifier L_IGNOREUNLOAD.
gmake[5]: *** [prlink.o] Error 1

The L_IGNOREUNLOAD flag was introduced with AIX 5.1, so if no one ever reported this one, no one has compiled NSPR on AIX 4.3.3 for a few years (Firefox 1.5beta or earlier), except me and the fix is in my local porting patch bundle.
Can create a better fix with properly ifdef (_AIX51) around.
I also have tried without -qlanglvl=stdc99, same error.
Attachment #419980 - Flags: review? → review?(wtc)
Attached patch Proposed patch (obsolete) — Splinter Review
Uli: please test this patch.  Note that in the prlink.c change
please replace 0 with the value of L_IGNOREUNLOAD if you have
access to AIX 5.1.

Re: AI_NUMERICHOST

Could you find out which header defines the macro AI_PASSIVE?
It should be /usr/include/netdb.h.  Does that header also define
AI_NUMERICHOST and AI_CANONNAME?

If that header doesn't define AI_NUMERICHOST, then we can fix
this problem by changing mozilla/nsprpub/pr/include/md/_aix.h
define _PR_HAVE_GETADDRINFO only for AIX 5.1 or later.

Re: L_IGNOREUNLOAD

This code was added in bug 189332.  But in bug 280984 we modified
the code to handle the case that L_IGNOREUNLOAD isn't supported,
so we can try to use that code for AIX 4.3.
Comment on attachment 419980 [details] [diff] [review]
Makes pr/src/linking/prlink.c compile on AIX 4.3.3

r=wtc.

Is _AIX51 defined by the IBM compiler or some AIX system header?
If so, it is preferrable over NSPR's AIX4_3_PLUS macro.

Another option is to just test L_IGNOREUNLOAD:

+#ifdef L_IGNOREUNLOAD
     int loadflags = L_GETINFO | L_IGNOREUNLOAD;
+#else
+    int loadflags = L_GETINFO;
+#endif

This is equivalent to my patch if we simply define L_IGNOREUNLOAD as 0:

#ifndef L_IGNOREUNLOAD
#define L_IGNOREUNLOAD 0
#endif
Attachment #419980 - Flags: review?(wtc) → review+
(In reply to comment #10)

> Re: AI_NUMERICHOST
> 
> Could you find out which header defines the macro AI_PASSIVE?
> It should be /usr/include/netdb.h.  Does that header also define
> AI_NUMERICHOST and AI_CANONNAME?

Yes:
/* Flag definitions for addrinfo hints in protocol-independent name/addr/service
 service. RFC2133 */
#define AI_CANONNAME    0x01    /* canonical name to be included in return */
#define AI_PASSIVE      0x02    /* prepare return for call to bind() */

AI_NUMERICHOST isn't defined in netdb.h (nor another system header) on AIX 4.3.3


> If that header doesn't define AI_NUMERICHOST, then we can fix
> this problem by changing mozilla/nsprpub/pr/include/md/_aix.h
> define _PR_HAVE_GETADDRINFO only for AIX 5.1 or later.

That's really easy if you know where to fix.
 
> Re: L_IGNOREUNLOAD
> 
> This code was added in bug 189332.  But in bug 280984 we modified
> the code to handle the case that L_IGNOREUNLOAD isn't supported,
> so we can try to use that code for AIX 4.3.

#ifdef _AIX43
#ifndef _AIX51
#define L_IGNOREUNLOAD 0
#endif /* not _AIX51 or later */
#endif /* _AIX43 */

For e.g. on AIX 4.3.x the IBM compiler defines:
-D_AIX,-D_AIX32,-D_AIX41,-D_AIX43
on AIX 5.2 additionally:
-D_AIX50,-D_AIX51,-D_AIX52
and so on in the compilers option file /etc/vac.cfg
Please try attachment 419983 [details] [diff] [review].  You can replace AIX4_3_PLUS
by _AIX51 in that patch.  Thanks.
(In reply to comment #11)
> Is _AIX51 defined by the IBM compiler or some AIX system header?
> If so, it is preferrable over NSPR's AIX4_3_PLUS macro.

_AIX51 is defined by the IBM compiler 
(can be overridden by editing /etc/vac.cfg),
the AIX4_3_PLUS macro does not help here. It's set on AIX 4.3.3
and later. It's not set on AIX 4.2.1 or earlier.

What I haven't thought about 'till now, should GCC also be supported for NSPR on AIX? Firefox/Thunderbird/Seamonkey only compile with IBM compilers, which is checked in the toplevel configure script. No way to use GCC but NSPR may be used standalone...
You're right about AIX4_3_PLUS.  It is no replacement for
_AIX51.  Sorry about the confusion.

NSPR should support GCC if someone is actually compiling
NSPR with GCC.  Until that happens, it's fine to only
support IBM compilers.  Of course, we should not break
GCC for no good reason either.
This revised patch is tested on AIX 4.3.3 and AIX 5.1.
Attachment #419211 - Attachment is obsolete: true
Attachment #419980 - Attachment is obsolete: true
Attachment #419999 - Flags: review?
Attachment #419211 - Flags: review?(wtc)
Attachment #419999 - Flags: review? → review?(wtc)
(In reply to comment #15)
> NSPR should support GCC if someone is actually compiling
> NSPR with GCC.  Until that happens, it's fine to only
> support IBM compilers.  Of course, we should not break
> GCC for no good reason either.

The revised patch does not change the ability to build NSPR with GCC on AIX, except that _PR_HAVE_GETADDRINFO isn't defined. 
This can circumvented in the Makefile. ( if GNU_CC += CPPFLAGS -D_AIX51 )
AFAIR GCC doesn't use the versioning scheme on AIX. 
Usually when using GCC the user passes the D_AIX(version release) macro in CFLAGS.
Comment on attachment 419999 [details] [diff] [review]
fixes compilation errors in AIX 4.3.3 to reenable IPv6

r=wtc.  Thanks for the patch!

Could you run the "gmake" command in
mozilla/nsprpub/pr/tests directory, and
then run the libfilename test program?
Run it with the -d option:
  libfilename -d
to get more output.  This test program
tests the code that uses L_IGNOREUNLOAD.
Attachment #419999 - Flags: review?(wtc) → review+
GCC also sets the predefined macro _AIX51 if compiling on AIX 5.1 or higher.
So the patch does not change behaviour when building with GCC.

gcc -o prvrsion.o -c      -qro -qroconst -pthread -g   -UNDEBUG -DDEBUG_ulink  -DDEBUG=1 -DXP_UNIX=1 -DAIX=1 -DSYSV=1 -DAIX_HAVE_ATOMIC_OP_H=1 -DAIX_TIMERS=1 -D_PR_HAVE_OFF64_T=1 -DAIX4_3_PLUS=1 -DHAVE_SOCKLEN_T=1 -DHAVE_FCNTL_FILE_LOCKING=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -DHAVE_POINTER_LOCALTIME_R=1 -D_PR_HAVE_THREADSAFE_GETHOST=1  -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_PR_INET6 -D_NSPR_BUILD_ -I../../dist/include/nspr -I../../../nsprpub/pr/include -I../../../nsprpub/pr/include/private  -I. ../../../nsprpub/pr/src/prvrsion.c
gcc: unrecognized option '-qro'
gcc: unrecognized option '-qroconst'

These flags can be removed from CFLAGS in configure.in, as they are default for AIX C compiler. The "cc/cc_r" invocations set -qnoro,-qnoroconst to relax the default.

But linking the shared lib will fail:
rm -f libnspr4.so
/usr/bin/ld -brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib -binitfini::_PR_Fini -o libnspr4.so ./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/./prscanf.o io/./prstdio.o threads/./prcmon.o threads/./prrwlock.o threads/./prtpd.o linking/./prlink.o malloc/./prmalloc.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/./prdtoa.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 misc/./prnetdb.o misc/./praton.o misc/./prolock.o misc/./prrng.o misc/./prsystem.o misc/./prthinfo.o misc/./prtpool.o misc/./prtrace.o misc/./prtime.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/./aix.o    -lodm -lcfg -lpthreads -ldl -lC_r -lC -lc_r -lm /usr/lib/libc.a
ld: 0711-328 ERROR: Undefined initfini symbol: _PR_Fini
ld: 0711-317 ERROR: Undefined symbol: .__udivdi3
ld: 0711-317 ERROR: Undefined symbol: .__umoddi3
ld: 0711-317 ERROR: Undefined symbol: .__divdi3
ld: 0711-317 ERROR: Undefined symbol: .__moddi3
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
gmake[2]: *** [libnspr4.so] Error 8
gmake[2]: Leaving directory `/home/ulink/NSPR/GNUCC/build/pr/src'
gmake[1]: *** [export] Error 2
gmake[1]: Leaving directory `/home/ulink/NSPR/GNUCC/build/pr'
gmake: *** [export] Error 2

I suggest porting NSPR to GCC on AIX should be moved to another bug, if at all.
(In reply to comment #18)

> Run it with the -d option:
>   libfilename -d
> to get more output.  This test program
> tests the code that uses L_IGNOREUNLOAD.

Result on AIX 5.1 / 32bit before patch:

bash-3.00$ ./libfilename -d
Pathname is /home/ulink/Src/AIX-51/suite/com-nspr/dist/lib/libnspr4.so
Loading library dll/libmy.so
Pathname is dll/libmy.so
PASS

Result on AIX 5.1 / 32bit with patch:
bash-3.00$ ./libfilename -d
Pathname is /home/ulink/Src/AIX-51/suite/com-nspr/dist/lib/libnspr4.so
Loading library dll/libmy.so
Pathname is dll/libmy.so
PASS

Result AIX 5.1 / 64bit with patch:
bash-3.00$ file libfilename
libfilename:    64-bit XCOFF executable or object module not stripped
bash-3.00$ ./libfilename -d
Pathname is /home/ulink/Src/comm-1.9.1/SM2_OBJ64/mozilla/dist/lib/libnspr4.so
Loading library dll/libmy.so
Pathname is dll/libmy.so
PASS
bash-3.00$ 

Result on AIX 4.3.3 / 32bit with patch:
bash-3.00$ ./libfilename -d 
Pathname is /home/ulink/Src/mozilla/FX3-OBJ-NSPR/dist/lib/libnspr4.so
Loading library dll/libmy.so
Pathname is dll/libmy.so
PASS
(In reply to comment #17)

> The revised patch does not change the ability to build NSPR with GCC on AIX,
> except that _PR_HAVE_GETADDRINFO isn't defined. 
> This can circumvented in the Makefile. ( if GNU_CC += CPPFLAGS -D_AIX51 )
> AFAIR GCC doesn't use the versioning scheme on AIX. 
> Usually when using GCC the user passes the D_AIX(version release) macro in
> CFLAGS.

My comment #17 was plainly false:

bash-3.00$ gcc -E -dM - < /dev/null | sort
#define _AIX 1
#define _AIX32 1
#define _AIX41 1
#define _AIX43 1
#define _AIX51 1
#define _ARCH_COM 1
#define _BIG_ENDIAN 1
#define _IBMR2 1
#define _LONG_LONG 1
#define _POWER 1
#define __BIG_ENDIAN__ 1
...

looks same as with IBM compilers. Verified with gcc 4.2.4
Keywords: checkin-needed
Version: 4.7.6 → other
I checked in Uli's patch on the NSPR trunk (NSPR 4.8.4)
after editing the comments slightly.

Checking in pr/include/md/_aix.h;
/cvsroot/mozilla/nsprpub/pr/include/md/_aix.h,v  <--  _aix.h
new revision: 3.16; previous revision: 3.15
done
Checking in pr/src/linking/prlink.c;
/cvsroot/mozilla/nsprpub/pr/src/linking/prlink.c,v  <--  prlink.c
new revision: 3.104; previous revision: 3.103
done
Attachment #419983 - Attachment is obsolete: true
Attachment #419999 - Attachment is obsolete: true
Uli, the libfilename test results in your comment 20 look good.
Thanks for all your help with this bug!
Status: NEW → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Summary: IPv6 broken on AIX 4.3.3 → IPv6 code compilation errors on AIX 4.3.3
Target Milestone: --- → 4.8.4
With recent NSPR update in mozilla-1.9.1 branch the above patch is included now.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.