Closed Bug 226470 Opened 21 years ago Closed 21 years ago

NSS incorrectly uses C++ compiler to compile C code on AIX

Categories

(NSS :: Build, defect)

Other
AIX
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pkwarren, Assigned: wtc)

Details

(Keywords: fixed1.4.2)

Attachments

(3 files)

NSS should use the xlc_r compiler to compile C code, and xlC_r to compile C++
code on AIX. The AIX.mk file currently specifies the C++ compiler to use for
both C and C++ code. This breaks compiling Mozilla with ccache. I will attach a
patch to fix this problem.
Attached patch Patch v1Splinter Review
Changes the DEFAULT_COMPILER and CC variables in AIX.mk to xlc_r.
Attachment #136065 - Flags: review?(wchang0222)
Comment on attachment 136065 [details] [diff] [review]
Patch v1

r=wtc.	Philip, just curious: what's the problem with
compiling C code using a C++ compiler?
Attachment #136065 - Flags: review?(wchang0222) → review+
Comment on attachment 136065 [details] [diff] [review]
Patch v1

I checked in this patch on the NSS tip for NSS 3.9.

mozilla/security/coreconf/AIX4.2.mk still contains
-L/usr/lpp/xlC/lib.  Is that OK?
Under normal conditions, compiling .c files with the C++ compiler works 
properly. However, when using ccache, all files are first preprocessed into .i 
files, and then fed to the compiler. Since the compiler can't tell whether .i 
files are C or C++, it determines the type of the file based on the compiler 
name (xlC_r for C++, xlc_r for C). Some of the NSS C files fail to compile 
when the compiler believes they are C++. For example, try the following:

1) Compiling nsinstall.c with xlC_r:
pkw@ut:~/sb/mozilla/trunk/mozilla/security/coreconf/nsinstall$ xlC_r 
nsinstall.c -c -o nsinstall.o

2) Compiling nsinstall.i with xlC_r:
pkw@ut:~/sb/mozilla/trunk/mozilla/security/coreconf/nsinstall$ cp nsinstall.c 
nsinstall.i  
pkw@ut:~/sb/mozilla/trunk/mozilla/security/coreconf/nsinstall$ xlC_r 
nsinstall.i -c -o nsinstall.o
"nsinstall.i", line 187.35: 1540-0257 (S) An object or reference of type "char 
*" cannot be initialized with an expression of type "void * const".
"nsinstall.i", line 188.35: 1540-0257 (S) An object or reference of type "char 
*" cannot be initialized with an expression of type "void * const".
"nsinstall.i", line 189.35: 1540-0257 (S) An object or reference of type "char 
*" cannot be initialized with an expression of type "void * const".
"nsinstall.i", line 194.35: 1540-0257 (S) An object or reference of type "char 
*" cannot be initialized with an expression of type "void * const".
"nsinstall.i", line 196.35: 1540-0257 (S) An object or reference of type "char 
*" cannot be initialized with an expression of type "void * const".
"nsinstall.i", line 197.35: 1540-0257 (S) An object or reference of type "char 
*" cannot be initialized with an expression of type "void * const".

3) Compiling nsinstall.cpp with xlC_r:
pkw@ut:~/sb/mozilla/trunk/mozilla/security/coreconf/nsinstall$ cp nsinstall.c 
nsinstall.cpp
pkw@ut:~/sb/mozilla/trunk/mozilla/security/coreconf/nsinstall$ xlC_r 
nsinstall.cpp -c -o nsinstall.o
"nsinstall.cpp", line 187.35: 1540-0257 (S) An object or reference of 
type "char *" cannot be initialized with an expression of type "void * const".
"nsinstall.cpp", line 188.35: 1540-0257 (S) An object or reference of 
type "char *" cannot be initialized with an expression of type "void * const".
"nsinstall.cpp", line 189.35: 1540-0257 (S) An object or reference of 
type "char *" cannot be initialized with an expression of type "void * const".
"nsinstall.cpp", line 194.35: 1540-0257 (S) An object or reference of 
type "char *" cannot be initialized with an expression of type "void * const".
"nsinstall.cpp", line 196.35: 1540-0257 (S) An object or reference of 
type "char *" cannot be initialized with an expression of type "void * const".
"nsinstall.cpp", line 197.35: 1540-0257 (S) An object or reference of 
type "char *" cannot be initialized with an expression of type "void * const".
> I checked in this patch on the NSS tip for NSS 3.9.

Thanks.

> mozilla/security/coreconf/AIX4.2.mk still contains -L/usr/lpp/xlC/lib. Is 
that OK?

I have never compiled Mozilla on AIX 4.2 (which is out of service), so I can't 
verify if that setting is correct.
Philip, thank you for answering my questions.

I will ignore AIX4.2.mk since it most likely will never
get used.

If this change is important to your work, please request
drivers' approval for 1.6b.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.9
Philip, NSPR (also C code only) is also compiled with xlC_r.
Should we also change NSPR to use xlc_r to compile C code?

(I may have made NSPR compilable as C++ code before.  Someone
accidentally compiled NSPR with a C++ compiler on IRIX and
I remember I checked in his patches.)
Attached patch NSPR PatchSplinter Review
I have tested this patch works properly for NSPR. I have removed the section
which adds -qarch=com to the command line options - this is the default for the
compiler.

I did not have any problems using ccache to compile NSPR, however this doesn't
hurt to specify the C compiler here.
Attachment #136119 - Flags: review?(wchang0222)
Attachment #136119 - Flags: review?(wchang0222) → review+
Philip, I guess we can remove -qarch=com from NSS's coreconf
build system, too.
Attachment #136154 - Flags: review?(pkw)
Attachment #136154 - Flags: review?(pkw) → review+
Comment on attachment 136154 [details] [diff] [review]
NSS supplemental patch

This NSS patch has been checked into the NSS tip (NSS 3.9).
Comment on attachment 136119 [details] [diff] [review]
NSPR Patch

This NSPR patch has been checked into the NSPR tip (NSPR 4.5).
Comment on attachment 136065 [details] [diff] [review]
Patch v1

Seeking approval to get these checked in to the 1.4 and 1.6 branches. This is
an AIX-specific change which just specifies that the C compiler should be used
to compile C code instead of the C++ compiler.
Attachment #136065 - Flags: approval1.6?
Attachment #136065 - Flags: approval1.4.2?
Comment on attachment 136119 [details] [diff] [review]
NSPR Patch

Seeking approval to get these checked in to the 1.4 and 1.6 branches. This is
an AIX-specific change which just specifies that the C compiler should be used
to compile C code instead of the C++ compiler.
Attachment #136119 - Flags: approval1.6?
Attachment #136119 - Flags: approval1.4.2?
Comment on attachment 136154 [details] [diff] [review]
NSS supplemental patch

Seeking approval to get these checked in to the 1.4 and 1.6 branches. This is
an AIX-specific change which removes the usage of the qarch=com compiler
argument, which is already the default.
Attachment #136154 - Flags: approval1.6?
Attachment #136154 - Flags: approval1.4.2?
Comment on attachment 136065 [details] [diff] [review]
Patch v1

a=mkaply
Attachment #136065 - Flags: approval1.6?
Attachment #136065 - Flags: approval1.6+
Attachment #136065 - Flags: approval1.4.2?
Attachment #136065 - Flags: approval1.4.2+
Comment on attachment 136119 [details] [diff] [review]
NSPR Patch

a=mkaply
Attachment #136119 - Flags: approval1.6?
Attachment #136119 - Flags: approval1.6+
Attachment #136119 - Flags: approval1.4.2?
Attachment #136119 - Flags: approval1.4.2+
Comment on attachment 136154 [details] [diff] [review]
NSS supplemental patch

a=mkaply
Attachment #136154 - Flags: approval1.6?
Attachment #136154 - Flags: approval1.6+
Attachment #136154 - Flags: approval1.4.2?
Attachment #136154 - Flags: approval1.4.2+
Comment on attachment 136065 [details] [diff] [review]
Patch v1

This patch has been checked into NSS_CLIENT_TAG
for Mozilla 1.6.
Comment on attachment 136154 [details] [diff] [review]
NSS supplemental patch

This patch has been checked into NSS_CLIENT_TAG for
Mozilla 1.6.
Comment on attachment 136119 [details] [diff] [review]
NSPR Patch

This patch has been checked into the NSPRPUB_PRE_4_2_CLIENT_BRANCH
for Mozilla 1.6.
Fixed on 1.4 branch.

Checking in security/coreconf/AIX.mk;
/cvsroot/mozilla/security/coreconf/AIX.mk,v  <--  AIX.mk
new revision: 1.4.6.1; previous revision: 1.4
done
Checking in nsprpub/configure;
/cvsroot/mozilla/nsprpub/configure,v  <--  configure
new revision: 1.78.2.63.2.1; previous revision: 1.78.2.63
done
Checking in nsprpub/configure.in;
/cvsroot/mozilla/nsprpub/configure.in,v  <--  configure.in
new revision: 1.83.2.63.2.3; previous revision: 1.83.2.63.2.2
done
Keywords: fixed1.4.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: