Bug 20410

Summary: Compile-failure: undefined token in WebCore/platform/network/curl/FormDataStreamCurl.cpp
Product: WebKit Reporter: Daniel Macks <dmacks>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
patch per Comment #3 mrowe: review+

Description Daniel Macks 2008-08-16 10:57:23 PDT
Compiling webkit source (nightly r35788) on OS X 10.4, using all gtk and other non-apple-supplied support libs using latest available from fink unstable tree...

1. ./autogen.sh --prefix=/sw --with-target=x11 --with-http-backend=curl --with-font-backend-pango --disable-video

no configure problems...Build configuration reports "HTTP backend: curl"

2. make

/bin/sh ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.  -DWTF_USE_ICU_UNICODE=1 -DBUILDING_CAIRO__=1 -DBUILDING_GTK__=1 -DWTF_CHANGES  -DXP_UNIX -DNDEBUG    -I./WebCore -I./WebCore/platform -I./WebCore/platform/network -I./WebCore/platform/graphics -I./WebCore/platform/graphics/filters -I./WebCore/platform/text -I./WebCore/loader -I./WebCore/loader/appcache -I./WebCore/loader/archive -I./WebCore/loader/icon -I./WebCore/css -I./WebCore/dom -I./WebCore/page -I./WebCore/bridge -I./WebCore/bridge/c -I./WebCore/editing -I./WebCore/history -I./WebCore/xml -I./WebCore/html -I./WebCore/bindings/js -I./WebCore/platform/image-decoders -I./WebCore/platform/image-decoders/bmp -I./WebCore/platform/image-decoders/gif -I./WebCore/platform/image-decoders/ico -I./WebCore/platform/image-decoders/jpeg -I./WebCore/platform/image-decoders/png -I./WebCore/platform/image-decoders/xbm -I./WebCore/plugins -I./WebCore/rendering -I./WebCore/rendering/style -I./WebCore/bindings/js -DWTF_USE_CURL=1 -I./WebCore/platform/network/curl  -DENABLE_OFFLINE_WEB_APPLICATIONS=1 -DENABLE_DASHBOARD_SUPPORT=1 -DENABLE_DATABASE=1 -I./WebCore/platform/sql -I./WebCore/storage -DENABLE_DOM_STORAGE=1 -I./WebCore/storage -DENABLE_ICONDATABASE=1   -DENABLE_XPATH=1 -DENABLE_XSLT=1 -DENABLE_SVG=1 -I\./WebCore/svg -I\./WebCore/svg/animation -I\./WebCore/svg/graphics -I\./WebCore/svg/graphics/filters -DENABLE_SVG_USE=1 -DENABLE_SVG_FOREIGN_OBJECT=1 -DENABLE_SVG_FONTS=1  -DENABLE_SVG_AS_IMAGE=1 -DENABLE_SVG_ANIMATION=1 -I./JavaScriptCore -I./JavaScriptCore/ForwardingHeaders -I./JavaScriptCore/wtf -I./JavaScriptCore/kjs -I./DerivedSources -I./JavaScriptCore/API -I./JavaScriptCore/ForwardingHeaders -I./JavaScriptCore/VM -I./JavaScriptCore/profiler -I./JavaScriptCore/wtf/unicode -I./JavaScriptCore/pcre -I./JavaScriptCore/kjs  -I./WebCore/platform/gtk -I./WebCore/platform/graphics/gtk -I./WebCore/platform/graphics/cairo -I./WebCore/loader/gtk -I./WebCore/page/gtk -DUSE_FREETYPE=1  -I./WebCore/svg/graphics/cairo  -I/sw/include -fno-strict-aliasing -O2 -fvisibility-inlines-hidden -fno-rtti -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -fvisibility=hidden -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I./JavaScriptCore/icu -I./WebCore/icu -I/sw/lib/pango-ft219/include/pango-1.0 -I/sw/lib/fontconfig2/include -I/sw/lib/freetype219/include/freetype2 -I/sw/lib/freetype219/include -I/sw/include/libxml2 -I/sw/include -I/sw/include/pixman-1 -I/sw/include/libpng12 -I/sw/include/cairo -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/gtk-2.0 -I/sw/include/atk-1.0 -I/sw/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/X11R6/include   -I/sw/include    -I/sw/lib/fontconfig2/include -I/sw/lib/freetype219/include/freetype2 -I/sw/lib/freetype219/include -I/sw/include/pixman-1 -I/sw/include/libpng12 -I/sw/include -I/sw/include/cairo -I/usr/X11R6/include -I/sw/include    -I/sw/include/libxml2 -I/sw/include    -MT WebCore/platform/network/curl/libWebCore_la-FormDataStreamCurl.lo -MD -MP -MF WebCore/platform/network/curl/.deps/libWebCore_la-FormDataStreamCurl.Tpo -c -o WebCore/platform/network/curl/libWebCore_la-FormDataStreamCurl.lo `test -f 'WebCore/platform/network/curl/FormDataStreamCurl.cpp' || echo './'`WebCore/platform/network/curl/FormDataStreamCurl.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -DWTF_USE_ICU_UNICODE=1 -DBUILDING_CAIRO__=1 -DBUILDING_GTK__=1 -DWTF_CHANGES -DXP_UNIX -DNDEBUG -I./WebCore -I./WebCore/platform -I./WebCore/platform/network -I./WebCore/platform/graphics -I./WebCore/platform/graphics/filters -I./WebCore/platform/text -I./WebCore/loader -I./WebCore/loader/appcache -I./WebCore/loader/archive -I./WebCore/loader/icon -I./WebCore/css -I./WebCore/dom -I./WebCore/page -I./WebCore/bridge -I./WebCore/bridge/c -I./WebCore/editing -I./WebCore/history -I./WebCore/xml -I./WebCore/html -I./WebCore/bindings/js -I./WebCore/platform/image-decoders -I./WebCore/platform/image-decoders/bmp -I./WebCore/platform/image-decoders/gif -I./WebCore/platform/image-decoders/ico -I./WebCore/platform/image-decoders/jpeg -I./WebCore/platform/image-decoders/png -I./WebCore/platform/image-decoders/xbm -I./WebCore/plugins -I./WebCore/rendering -I./WebCore/rendering/style -I./WebCore/bindings/js -DWTF_USE_CURL=1 -I./WebCore/platform/network/curl -DENABLE_OFFLINE_WEB_APPLICATIONS=1 -DENABLE_DASHBOARD_SUPPORT=1 -DENABLE_DATABASE=1 -I./WebCore/platform/sql -I./WebCore/storage -DENABLE_DOM_STORAGE=1 -I./WebCore/storage -DENABLE_ICONDATABASE=1 -DENABLE_XPATH=1 -DENABLE_XSLT=1 -DENABLE_SVG=1 -I./WebCore/svg -I./WebCore/svg/animation -I./WebCore/svg/graphics -I./WebCore/svg/graphics/filters -DENABLE_SVG_USE=1 -DENABLE_SVG_FOREIGN_OBJECT=1 -DENABLE_SVG_FONTS=1 -DENABLE_SVG_AS_IMAGE=1 -DENABLE_SVG_ANIMATION=1 -I./JavaScriptCore -I./JavaScriptCore/ForwardingHeaders -I./JavaScriptCore/wtf -I./JavaScriptCore/kjs -I./DerivedSources -I./JavaScriptCore/API -I./JavaScriptCore/ForwardingHeaders -I./JavaScriptCore/VM -I./JavaScriptCore/profiler -I./JavaScriptCore/wtf/unicode -I./JavaScriptCore/pcre -I./JavaScriptCore/kjs -I./WebCore/platform/gtk -I./WebCore/platform/graphics/gtk -I./WebCore/platform/graphics/cairo -I./WebCore/loader/gtk -I./WebCore/page/gtk -DUSE_FREETYPE=1 -I./WebCore/svg/graphics/cairo -I/sw/include -fno-strict-aliasing -O2 -fvisibility-inlines-hidden -fno-rtti -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type -Wformat -Wformat-security -Wno-format-y2k -Wundef -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-unused-parameter -Wno-parentheses -fno-exceptions -fvisibility=hidden -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I./JavaScriptCore/icu -I./WebCore/icu -I/sw/lib/pango-ft219/include/pango-1.0 -I/sw/lib/fontconfig2/include -I/sw/lib/freetype219/include/freetype2 -I/sw/lib/freetype219/include -I/sw/include/libxml2 -I/sw/include -I/sw/include/pixman-1 -I/sw/include/libpng12 -I/sw/include/cairo -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/gtk-2.0 -I/sw/include/atk-1.0 -I/sw/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/X11R6/include -I/sw/include -I/sw/lib/fontconfig2/include -I/sw/lib/freetype219/include/freetype2 -I/sw/lib/freetype219/include -I/sw/include/pixman-1 -I/sw/include/libpng12 -I/sw/include -I/sw/include/cairo -I/usr/X11R6/include -I/sw/include -I/sw/include/libxml2 -I/sw/include -MT WebCore/platform/network/curl/libWebCore_la-FormDataStreamCurl.lo -MD -MP -MF WebCore/platform/network/curl/.deps/libWebCore_la-FormDataStreamCurl.Tpo -c WebCore/platform/network/curl/FormDataStreamCurl.cpp  -fno-common -DPIC -o WebCore/platform/network/curl/.libs/libWebCore_la-FormDataStreamCurl.o
WebCore/platform/network/curl/FormDataStreamCurl.cpp:36:8: warning: undefining "__STDC_LIMIT_MACROS"
WebCore/platform/network/curl/FormDataStreamCurl.cpp: In member function 'size_t WebCore::FormDataStream::read(void*, size_t, size_t)':
WebCore/platform/network/curl/FormDataStreamCurl.cpp:58: error: 'SIZE_MAX' was not declared in this scope
make[1]: *** [WebCore/platform/network/curl/libWebCore_la-FormDataStreamCurl.lo] Error 1
make: *** [all] Error 2

I think SIZE_MAX is in stdint.h; will test
Comment 1 Daniel Macks 2008-08-16 11:25:44 PDT
FormDataStreamCurl.cpp tries to get stdint.h:

#include "config.h"
// We need to define __STDC_LIMIT_MACROS to define SIZE_MAX.
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#include <stdint.h>
#undef __STDC_LIMIT_MACROS
#else
#include <stdint.h>
#endif

but tracing the #include jungle, it looks like that's too late, as stdint.h has already been loaded...

In file included from /usr/include/sys/_endian.h:88,
                 from /usr/include/ppc/endian.h:107,
                 from /usr/include/machine/endian.h:30,
                 from /usr/include/sys/wait.h:182,
                 from /usr/include/stdlib.h:64,
                 from ./JavaScriptCore/wtf/FastMalloc.h:25,
                 from ./WebCore/config.h:77,
                 from WebCore/platform/network/curl/FormDataStreamCurl.cpp:30

Moving the config.h *after* stdint.h solves it for me (and makes some sense...load all the system headers before webkit's own stuff. Not sure if that affects win32, which may do headers differently and/or need local overrides of standard-on-unix stuff.
Comment 2 Mark Rowe (bdash) 2008-08-16 18:00:16 PDT
It's probably a lot more portable, and definitely cleaner, to use std::numeric_limits<size_t>::max() instead.
Comment 3 Daniel Macks 2008-08-17 09:06:40 PDT
Using that instead of SIZE_MAX (and scrapping the whole stdint.h block entirely) allows building with no warnings or undefined symbols.
Comment 4 Alexey Proskuryakov 2008-08-18 05:52:49 PDT
Thanks! Would you be willing to submit a patch <http://webkit.org/coding/contributing.html>?
Comment 5 Daniel Macks 2008-08-18 14:50:31 PDT
Created attachment 22863 [details]
patch per Comment #3
Comment 6 Mark Rowe (bdash) 2008-08-18 15:44:30 PDT
Comment on attachment 22863 [details]
patch per Comment #3

r=me
Comment 7 Mark Rowe (bdash) 2008-08-18 15:47:36 PDT
Landed in r35826.