Bug 76476

Summary: Build failure on Snow Leopard i386: implicit conversion warnings
Product: WebKit Reporter: Jeff Johnson <opendarwin>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: aroben, barraclough, burg, ggaren, mrowe, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 109834    

Description Jeff Johnson 2012-01-17 13:09:31 PST
I'm trying to build WebKit trunk at git commit 790c9d7dc9ceed0e8283c70013d273be222e7a24, git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105183 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Building the Debug configuration fails on Snow Leopard, arch i386, Xcode 3.2.6. Here's where it fails in the build transcript:

CompileC /Users/Shared/source/WebKit/WebKitBuild/JavaScriptCore.build/Debug/JavaScriptCore.build/Objects-normal/i386/DatePrototype.o runtime/DatePrototype.cpp normal i386 c++ com.apple.compilers.gcc.4_2
    cd /Users/Shared/source/WebKit/Source/JavaScriptCore
    setenv LANG en_US.US-ASCII
    /Developer/usr/bin/gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fno-exceptions -fno-rtti -fpascal-strings -fasm-blocks -O0 -Werror -Wmissing-prototypes -Wnon-virtual-dtor -Wnewline-eof -DHAVE_DTRACE=1 -DWEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST -DHAVE_HEADER_DETECTION_H -fstrict-aliasing -fvisibility-inlines-hidden -fno-threadsafe-statics -mmacosx-version-min=10.6 -gdwarf-2 -I/Users/Shared/source/WebKit/WebKitBuild/JavaScriptCore.build/Debug/JavaScriptCore.build/JavaScriptCore.hmap -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wshorten-64-to-32 -F/Users/Shared/source/WebKit/WebKitBuild/Debug -I/Users/Shared/source/WebKit/WebKitBuild/Debug/include -I/Users/Shared/source/WebKit/WebKitBuild/Debug/DerivedSources/JavaScriptCore -I. -Iicu -I/Users/Shared/source/WebKit/WebKitBuild/JavaScriptCore.build/Debug/JavaScriptCore.build/DerivedSources/i386 -I/Users/Shared/source/WebKit/WebKitBuild/JavaScriptCore.build/Debug/JavaScriptCore.build/DerivedSources -include /var/folders/YN/YN5rYxFcFny7MbZuKAQAw++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/JavaScriptCorePrefix-fqfopdxsbxxzoagbayqcsvgxdjft/JavaScriptCorePrefix.h -c /Users/Shared/source/WebKit/Source/JavaScriptCore/runtime/DatePrototype.cpp -o /Users/Shared/source/WebKit/WebKitBuild/JavaScriptCore.build/Debug/JavaScriptCore.build/Objects-normal/i386/DatePrototype.o

cc1plus: warnings being treated as errors
/Users/Shared/source/WebKit/Source/JavaScriptCore/runtime/DatePrototype.cpp: In function 'JSC::EncodedJSValue JSC::dateProtoFuncToISOString(JSC::ExecState*)':
/Users/Shared/source/WebKit/Source/JavaScriptCore/runtime/DatePrototype.cpp:513: warning: implicit conversion shortens 64-bit value into a 32-bit value
Comment 1 Jeff Johnson 2012-01-17 14:06:49 PST
I built WebKit with GCC_TREAT_WARNINGS_AS_ERRORS=NO and found implicit conversion warnings in a bunch of other files too. Otherwise the build seemed to be fine though.
Comment 2 Mark Rowe (bdash) 2012-06-27 11:35:16 PDT
Very few people actively build WebKit with such an old version of Xcode. Patches are welcome to address the issues you run in to though.
Comment 3 Jeff Johnson 2012-06-27 12:51:59 PDT
I found something interesting. If I build i386 with Xcode 4.2 on Snow Leopard instead of Xcode 3.2.6, it succeeds, but I can see in the build transcript that it's using "-Wno-shorten-64-to-32", whereas you can see in my transcript above that it used -Wshorten-64-to-32 with Xcode 3.2.6.

I did a search of the WebKit project and found the xcconfig file:

https://trac.webkit.org/browser/trunk/Source/JavaScriptCore/Configurations/Base.xcconfig

67	WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_macosx_$(CURRENT_ARCH));
68	WARNING_CFLAGS_macosx_ = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
69	WARNING_CFLAGS_macosx_i386 = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
70	WARNING_CFLAGS_macosx_ppc = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
71	// FIXME: JavaScriptCore 64-bit builds should build with -Wshorten-64-to-32
72	WARNING_CFLAGS_macosx_ppc64 = $(WARNING_CFLAGS_BASE);
73	WARNING_CFLAGS_macosx_x86_64 = $(WARNING_CFLAGS_BASE);

Notice the FIXME comment. If I add -Wshorten-64-to-32 to line 73, then the build fails even with Xcode 4.2.
Comment 4 Jeff Johnson 2012-06-27 12:53:54 PDT
I should note that I usually do build-webkit ONLY_ACTIVE_ARCH=NO ARCHS="i386 x86_64"
Comment 5 Mark Rowe (bdash) 2012-06-27 12:56:16 PDT
I don't think any of that is all that interesting. When building 32-bit we've always built with -Wshorten-64-to-32 and we've never built with it enabled for 64-bit. I think the difference you're seeing between Xcode 3.2.6 and Xcode 4.2 is actually the difference between building for i386 and x86_64.
Comment 6 Jeff Johnson 2012-06-27 14:02:38 PDT
Ok, you're right, I saw the -Wno-shorten-64-to-32 in the transcript for x86_64 and also for i386, but I didn't notice the second -Wshorten-64-to-32 for i386 that overrides the first.

There are probably way too many warnings here to fix in patches.