Closed Bug 545634 Opened 10 years ago Closed 9 years ago

AIX failure to run configure script in js/ctypes/libffi

Categories

(Core :: js-ctypes, defect)

1.9.2 Branch
PowerPC
AIX
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla2.0b12
Tracking Status
status1.9.1 --- unaffected

People

(Reporter: ul-mcamafia, Assigned: ul-mcamafia)

References

()

Details

Attachments

(3 files, 6 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; AIX 5.2; en-US; rv:1.9.1.8) Gecko/20100206 SeaMonkey/2.0.3
Build Identifier: MOZILLA 1.9.2

configure:3057: checking for C compiler version
configure:3065: xlc_r --version >&5
xlc_r: 1501-216 (W) command option --version is not recognized - passed to ld



  xlc(1)                     IBM (2007)                      xlc(1)



  NAME
         xlc, xlc++, xlC, cc, c89, c99, xlCcore, xlc++core and
...



Reproducible: Always

Steps to Reproduce:
1. compile on AIX with IBM compiler (every version is affected

Actual Results:  
failure to configure, you'll have to press Enter until the end of compiler's short help page is reached.

Expected Results:  
Successful non-interactive configure script

the compiler is invoked with --version flag.
This flag is unknown for IBM XLC/C++.
The correct flag would be -qversion instead
Version: unspecified → 1.9.2 Branch
libffi needs to be built with gcc. If you have gcc, we can easily stick something in configure to make libffi use it. (Assuming there are no issues with mixing binary C code built with xlc and gcc.)
https://bugzilla.mozilla.org/show_bug.cgi?id=527410

I get the same error message.

 gxlc -DHAVE_CONFIG_H -I. -I../libffi -I. -I../libffi/include -Iinclude -I../libffi/src -I. -I../libffi/include -Iinclude -I../libffi/src -O2 -qarch=com -qmaxmem=32768 -MT src/powerpc/aix_closure.lo -MD -MP -MF src/powerpc/.deps/aix_closure.Tpo -c ../libffi/src/powerpc/aix_closure.S  -DPIC -o src/powerpc/.libs/aix_closure.o
gxlc: 1501-257 Option -qarch=com is not recognized.  Option will be ignored.
gxlc: 1501-257 Option -qmaxmem=32768 is not recognized.  Option will be ignored.
gxlc: 1501-257 Option -MT is not recognized.  Option will be ignored.
gxlc: 1501-257 Option -MP is not recognized.  Option will be ignored.
Assembler:
/tmp/xlcS0qGswUd.s: line 111: undefined symbol ".ffi_closure_helper_DARWIN"
/tmp/xlcS0qGswUd.s: line 111: illegal expression type for branch address
xlc -DHAVE_CONFIG_H -I. -I../libffi -I. -I../libffi/include -Iinclude -I../libffi/src -I. -I../libffi/include -Iinclude -I../libffi/src -O2 -qmakedep=gcc -MF src/powerpc/.deps/aix_closure.Tpo -c ../libffi/src/powerpc/aix_closure.S -DPIC -o src/powerpc/.libs/aix_closure.o
gmake[2]: *** [src/powerpc/aix_closure.lo] Error 1

Even with GCC on AIX it is recommended to use the native as and mandatory to use native ld. The error ".ffi_closure_helper_DARWIN" is in the intermediate assembly file. 
I'm not able to fix this code. Seems the powerpc part is just copied from MacOS X, never tested.
Depends on: 527410
After building a GCC 4.2.4 I was able to compile libffi.
I reinvoked the configure script:
"../../../../js/ctypes/libffi/configure CC=gcc CFLAGS=-O"

Then I could gmake the libffi dir.
This should be hacked into the toplevel configure make target.
Building deps for /home/ulink/src/mozilla-1.9.2/js/ctypes/Function.cpp
xlC_r -o Function.o -c  -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1 -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_COM_OBSOLETE -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DOSTYPE=\"AIX5.2\" -DOSARCH=AIX -Ilibffi/include  -I/home/ulink/src/mozilla-1.9.2/js/ctypes -I. -I../../dist/include -I../../dist/include/nsprpub  -I/home/ulink/src/mozilla-1.9.2/obj-fx36-aix52/dist/include/nspr -I/home/ulink/src/mozilla-1.9.2/obj-fx36-aix52/dist/include/nss        -qflag=w:w      -DNDEBUG -DTRIMMED -O -qmaxmem=-1 -qalias=noansi   -DMOZILLA_VERSION=\"1.9.2.2pre\" -DMOZILLA_VERSION_U=1.9.2.2pre -DAIX=1 -DHAVE_S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DMOZ_DEFAULT_TOOLKIT=\"cairo-gtk2\" -DMOZ_X11=1 -DMOZ_WIDGET_GTK2=1 -DMOZ_ENABLE_XREMOTE=1 -DMOZ_OFFICIAL_BRANDING=1 -DMOZ_DISTRIBUTION_ID=\"org.mozilla\" -DMOZ_PANGO=1 -DIBMBIDI=1 -DMOZ_VIEW_SOURCE=1 -DMOZ_XPINSTALL=1 -DMOZ_JSLOADER=1 -DNS_PRINTING=1 -DNS_PRINT_PREVIEW=1 -DMOZ_NO_XPCOM_OBSOLETE=1 -DMOZ_OGG=1 -DMOZ_WAVE=1 -DMOZ_SYDNEYAUDIO=1 -DMOZ_MEDIA=1 -DMOZ_XTF=1 -DMOZ_CRASHREPORTER_ENABLE_PERCENT=100 -DMOZ_MATHML=1 -DMOZ_ENABLE_CANVAS=1 -DMOZ_SVG=1 -DMOZ_UPDATE_CHANNEL=default -DMOZ_PLACES=1 -DMOZ_FEEDS=1 -DMOZ_STORAGE=1 -DMOZ_SAFE_BROWSING=1 -DMOZ_URL_CLASSIFIER=1 -DMOZ_LOGGING=1 -DMOZ_USER_DIR=\".mozilla\" -DMOZ_ENABLE_LIBXUL=1 -DHAVE_STDINT_H=1 -DHAVE_INTTYPES_H=1 -DMOZ_XUL=1 -DMOZ_PROFILELOCKING=1 -DMOZ_RDF=1 -DBUILD_CTYPES=1 -DMOZ_MORKREADER=1 -DMOZ_DLL_SUFFIX=\".so\" -DHAVE_FONTCONFIG_FCFREETYPE_H=1 -DXP_UNIX=1 -DUNIX_ASYNC_DNS=1  -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT /home/ulink/src/mozilla-1.9.2/js/ctypes/Function.cpp
"libffi/include/ffi.h", line 131.27: 1540-0840 (W) The integer literal "9223372036854775807" is out of range.
"libffi/include/ffi.h", line 132.3: 1540-0859 (S) #error directive: "no 64-bit data type supported".
gmake[3]: *** [Function.o] Error 1
gmake[3]: Leaving directory `/home/ulink/src/mozilla-1.9.2/obj-fx36-aix52/js/ctypes'
gmake[2]: *** [libs_tier_gecko] Error 2
gmake[2]: Leaving directory `/home/ulink/src/mozilla-1.9.2/obj-fx36-aix52'
gmake[1]: *** [tier_gecko] Error 2
gmake[1]: Leaving directory `/home/ulink/src/mozilla-1.9.2/obj-fx36-aix52'
gmake: *** [default] Error 2

AIX > 4.3 has longlong 64 integer types.
You'll need to get ffi.h able to compile with xlc. Appropriate #ifdefs and such should do the trick. After that, we can use your CC=gcc configure hack.
ripped and copied from Solaris
Version: 1.9.2 Branch → Trunk
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee: nobody → ul.mcamafia
Comment on attachment 427606 [details] [diff] [review]
Patch to configure.in for using gcc for libffi

This will need to be updated, since trunk has changed a bunch since then.

Otherwise this looks fine -- did the ffi.h header build OK with xlc, when included in ctypes files?
Duplicate of this bug: 577503
Blocks: 618660
use GCC for libffi and make ffi.h compile with both GCC and IBM XLC/C++ compilers by replacing the overflowing literal "9223372036854775807" with "0x7fffffffffffffffLL". No long long int literals in preprocessor with XLC/C++.
Attachment #427606 - Attachment is obsolete: true
Attachment #497266 - Flags: review?(ted.mielczarek)
Attachment #497266 - Flags: review?(dwitte)
Blocks: 527407
Duplicate of this bug: 527407
Version: Trunk → 1.9.2 Branch
This patch also raises the minimum comipler version in ./configure.in and ./js/src/configure.in
Attachment #497266 - Attachment is obsolete: true
Attachment #497266 - Flags: review?(ted.mielczarek)
Attachment #497266 - Flags: review?(dwitte)
Attachment #501611 - Flags: review?(ted.mielczarek)
Attachment #501611 - Flags: review?(dwitte)
Comment on attachment 501611 [details] [diff] [review]
branch 1.9.2 patch for build libffi on AIX5

r=me on the configure bits.
Attachment #501611 - Flags: review?(ted.mielczarek) → review+
Attached patch patch ported to branch2.0/trunk (obsolete) — Splinter Review
Attachment #504376 - Flags: review?(ted.mielczarek)
Attachment #504376 - Flags: review?(dwitte)
Comment on attachment 504376 [details] [diff] [review]
patch ported to branch2.0/trunk

>diff -r 859a97109032 js/src/ctypes/libffi/include/ffi.h.in

> #if LONG_MAX == 2147483647
>-# if FFI_LONG_LONG_MAX != 9223372036854775807
>+# ifdef _AIX
>+#  if FFI_LONG_LONG_MAX != 0x7fffffffffffffffLL
>  #error "no 64-bit data type supported"

Hm. Those two numbers are the same; why does XLC need it in hex form? Or does it interpret literals as int or long, such that the LL is required?

If so, can we just add the LL to the former number and drop the #ifdef?
(In reply to comment #14)
> >diff -r 859a97109032 js/src/ctypes/libffi/include/ffi.h.in
> 
> > #if LONG_MAX == 2147483647
> >-# if FFI_LONG_LONG_MAX != 9223372036854775807
> >+# ifdef _AIX
> >+#  if FFI_LONG_LONG_MAX != 0x7fffffffffffffffLL
> >  #error "no 64-bit data type supported"
> 
> Hm. Those two numbers are the same; why does XLC need it in hex form? Or does
> it interpret literals as int or long, such that the LL is required?

The latter, (unsuffixed) literals are int == long for AIX 32bit

> If so, can we just add the LL to the former number and drop the #ifdef?

Yes, decimal suffixed with LL works fine.
Should I suffix only the one occurence needed by 32bit AIX5 or all?
When porting I usually use the minimal impact approach...
I must test on 1.9.2 branch, as trunk isn't ported so far at the moment.
Therefore the trunk patch comes second.
carrying forward r+=ted.mielczarek for the unchange configure bits
Attachment #504837 - Flags: review?
Attachment #504837 - Flags: review? → review?(dwitte)
Attached patch patch for mozilla-central (obsolete) — Splinter Review
Attachment #504376 - Attachment is obsolete: true
Attachment #504376 - Flags: review?(ted.mielczarek)
Attachment #504376 - Flags: review?(dwitte)
Attachment #504874 - Flags: review?(ted.mielczarek)
Attachment #504874 - Flags: review?(dwitte)
Comment on attachment 504874 [details] [diff] [review]
patch for mozilla-central

Sigh. This detection thing should be a configure check.

What you've got here will probably break windows. I'd recommend defining an FFI_64_BIT_MAX to be 9223372036854775807 in general and 9223372036854775807LL for XLC. Then just replace all the 9223372036854775807 literals with FFI_64_BIT_MAX. It's at least a little cleaner...

Please add this to js/src/ctypes/ffi.patch, reference this bug# there, and push the patch upstream (mail to libffi-discuss@sourceware.org). r=dwitte with that.
Attachment #504874 - Flags: review?(dwitte) → review-
Following dwitte's comment# 18, the toplevel configure.in and js/configure.in is intentionally not included in the libffi.patch.
Attachment #501611 - Attachment is obsolete: true
Attachment #504837 - Attachment is obsolete: true
Attachment #504874 - Attachment is obsolete: true
Attachment #507525 - Flags: review?
Attachment #501611 - Flags: review?(dwitte)
Attachment #504837 - Flags: review?(dwitte)
Attachment #504874 - Flags: review?(ted.mielczarek)
Attachment #507525 - Flags: review?(ted.mielczarek)
Attachment #507525 - Flags: review?(dwitte)
Attachment #507525 - Flags: review?
Same trick as for trunk patch adopted for stable branch 1.9.2,
changed to different minimum needed compiler version check and enable OJI plugin support, hacking the GCC only for building libffi.a down to toplevel configure.in script.
Attachment #507542 - Flags: review?
Attachment #507542 - Flags: review?(ted.mielczarek)
Attachment #507542 - Flags: review?(dwitte)
Attachment #507542 - Flags: review?
Comment on attachment 507525 [details] [diff] [review]
m-c patch fixed according c# 18

Nice, r=dwitte. Don't forget to push upstream :)
Attachment #507525 - Flags: review?(dwitte) → review+
(In reply to comment #21)
> Don't forget to push upstream :)

Done!
Attachment #507525 - Flags: review?(ted.mielczarek) → review+
Attachment #507542 - Flags: review?(ted.mielczarek) → review+
Comment on attachment 507525 [details] [diff] [review]
m-c patch fixed according c# 18

Requesting approval for trunk/branch-2.0:
Have tested the patch not to break Windows and MacOSX. Very low risc.
On AIX I cannot really test the patch, but the branch-1.9.2 patch is similiar.
Attachment #507525 - Flags: approval2.0?
Attachment #507525 - Flags: approval2.0? → approval2.0+
Keywords: checkin-needed
Whiteboard: [check in attachment 507525 to m-c]
http://hg.mozilla.org/mozilla-central/rev/e79e4e9768e6
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [check in attachment 507525 to m-c]
Target Milestone: --- → mozilla2.0b12
Reworked the branch patch. No GCC needed anymore, removing some uneeded GCC-only flags.
mozilla-1.9.2 branch only!
Attachment #528311 - Flags: review?(dwitte)
Attachment #528311 - Flags: review?(ted.mielczarek)
Comment on attachment 528311 [details] [diff] [review]
reworked branch patch for build libffi with IBM XLC/C++

Review of attachment 528311 [details] [diff] [review]:

Looks fine to me.
Attachment #528311 - Flags: review?(ted.mielczarek) → review+
Attachment #507542 - Flags: review?(dwitte)
Comment on attachment 528311 [details] [diff] [review]
reworked branch patch for build libffi with IBM XLC/C++

Clearing stale request, sorry -- I'm sure there are better qualified people to look at this if you're still interested in pursuing it :)
Attachment #528311 - Flags: review?(dwitte)
You need to log in before you can comment on or make changes to this bug.