Closed Bug 674133 Opened 13 years ago Closed 6 years ago

build fails with nsStringAPI.h : size of array arg is negative

Categories

(Firefox Build System :: General, defect)

8 Branch
x86_64
Linux
defect
Not set
major

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: f.couperin, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20110430 Firefox/4.0.1 Iceweasel/4.0.1 Build ID: 20110430175745 Steps to reproduce: I'm trying to build firefox (retrieved yesterday from mercurial, mozilla-central), 32 and 64 bits versions, on a Cross Linux From Scratch x86_64 machine (Linux 2.6.39-2-amd64 / GCC-4.6.1 / Eglibc-2.13 / Binutils-2.21.52.0.2). Xulrunner 5.0 was succesfully installed from tarball. ---------------------------------------- Configure options : ---------------------------------------- 32 BITS --enable-application=browser --infodir=/usr/share/info --mandir=/usr/share/man --with-system-bz2 --disable-zipwriter --enable-system-pixman --enable-canvas --enable-default-toolkit=cairo-gtk2 --enable-svg --prefix=/usr --enable-optimize --enable-system-sqlite --enable-system-cairo --enable-system-lcms --enable-startup-notification --with-system-jpeg --with-system-nspr --with-system-nss --with-system-png --with-system-zlib --disable-accessibility --disable-crashreporter --disable-gnomevfs --disable-necko-wifi --disable-installer --disable-javaxpcom --disable-tests --disable-updater --enable-official-branding --enable-safe-browsing --enable-strip --with-system-libxul --with-libxul-sdk=/usr/lib/xulrunner-devel-5.0 --sysconfdir=/etc/firefox-32 --program-suffix=-32 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-elf-hack ---------------------------------------- 64 BITS --enable-application=browser --infodir=/usr/share/info --mandir=/usr/share/man --with-system-bz2 --disable-zipwriter --enable-system-pixman --enable-canvas --enable-default-toolkit=cairo-gtk2 --enable-svg --prefix=/usr --enable-optimize --enable-system-sqlite --enable-system-cairo --enable-system-lcms --enable-startup-notification --with-system-jpeg --with-system-nspr --with-system-nss --with-system-png --with-system-zlib --disable-accessibility --disable-crashreporter --disable-gnomevfs --disable-necko-wifi --disable-installer --disable-javaxpcom --disable-tests --disable-updater --enable-official-branding --enable-safe-browsing --enable-strip --with-system-libxul --with-libxul-sdk=/usr/lib64/xulrunner-devel-5.0 --sysconfdir=/etc/firefox-64 --program-suffix=-64 --libdir=/usr/lib64 ---------------------------------------- Actual results: The two builds failed with the same error : ---------------------------------------- In file included from /usr/lib/xulrunner-devel-5.0/include/nsStringGlue.h:52:0, from /usr/lib/xulrunner-devel-5.0/include/nsNetUtil.h:47, from /usr/src/firefox/32/mozilla-central/browser/components/about/AboutRedirector.cpp:43: /usr/lib/xulrunner-devel-5.0/include/nsStringAPI.h:1104:3: error: size of array ‘arg’ is negative ---------------------------------------- In file included from /usr/lib64/xulrunner-devel-5.0/include/nsStringGlue.h:52:0, from /usr/lib64/xulrunner-devel-5.0/include/nsNetUtil.h:47, from /usr/src/firefox/64/mozilla-central/browser/components/about/AboutRedirector.cpp:43: /usr/lib64/xulrunner-devel-5.0/include/nsStringAPI.h:1104:3: error: size of array ‘arg’ is negative Expected results: It should have compiled fine. No ?
Severity: normal → major
OS: Other → Linux
Hardware: All → x86_64
Version: Trunk → 8 Branch
If you look at that line in the source: http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsStringAPI.h#1104 You can see that you're failing a static assert for "sizeof(wchar_t) == 2". Mozilla needs to be compiled with -fshort-wchar. Are you overriding that somehow?
I took a look at nsStringAPI.h and as a workaround, I added those lines to mozconfig: export CFLAGS="-fshort-wchar" export CXXFLAGS="-fshort-wchar" It seems to work to "solve" this particular bug But the builds fail now with something else: /usr/bin/python2.6 /usr/lib/xulrunner-devel-5.0/sdk/bin/xpt.py link _xpidlgen/browser-feeds.xpt _xpidlgen/nsIFeedResultService.xpt _xpidlgen/nsIWebContentConverterRegistrar.xpt _xpidlgen/nsIFeedWriter.xpt /usr/bin/python2.6: can't open file '/usr/lib/xulrunner-devel-5.0/sdk/bin/xpt.py': [Errno 2] No such file or directory I try: # for f in "config/config.mk" "js/src/config/config.mk" ; do # if ! [ -e $f.orig ] ; then mv -v $f $f.orig ; fi # sed "s@XPIDL_LINK = \$(PYTHON) \$(LIBXUL_DIST)/sdk/bin/xpt.py link@XPIDL_LINK = \$(PYTHON) $PWD/xpcom/typelib/xpt/tools/xpt.py link@" \ $f.orig > $f # done and I get: g++ -m32 -o nsGNOMEShellService.o -c -DOSTYPE=\"Linux2.6\" -DOSARCH=Linux -DMOZ_APP_NAME=\"firefox\" -I/usr/src/firefox/32/mozilla-central/browser/components/shell/src -I. -I../../../../dist/include -I../../../../dist/include/nsprpub -I/usr/lib/xulrunner-devel-5.0/include -I/usr/lib/xulrunner-devel-5.0/include/nsprpub -I/usr/include/nspr -I/usr/include/nss3 -fPIC -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -pedantic -Wno-long-long -fshort-wchar -fno-strict-aliasing -std=gnu++0x -pthread -ffunction-sections -fdata-sections -DNDEBUG -DTRIMMED -g -Os -freorder-blocks -fomit-frame-pointer -pthread -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng15 -I/usr/include/gtk-unix-print-2.0 -I/usr/X11R7/include/pixman-1 -I/usr/X11R7/include -DMOZILLA_CLIENT -include ../../../../mozilla-config.h -MD -MF .deps/nsGNOMEShellService.pp /usr/src/firefox/32/mozilla-central/browser/components/shell/src/nsGNOMEShellService.cpp /usr/src/firefox/32/mozilla-central/browser/components/shell/src/nsGNOMEShellService.cpp:49:33: fatal error: nsIGSettingsService.h: No such file or directory So.. I give up. Is it a problem with firefox or with xulrunner-5.0 ?
Ted Mielczarek wrote: > Mozilla needs to be compiled with -fshort-wchar. Are you overriding that somehow? Thanks for your reply. I tried to look seriously for something that could prevent firefox to set the right flag. Nothing. I test gcc and all is fine # echo -e '#include <stdio.h>\nint main(){ printf("%d\\n",sizeof(wchar_t)); }\n'|gcc -x c++ - && ./a.out 4 # echo -e '#include <stdio.h>\nint main(){ printf("%d\\n",sizeof(wchar_t)); }\n'|gcc -fshort-wchar -x c++ - && ./a.out 2 Xulrunner compiled and had no problem with "-fshort-wchar" as far as I can see : /usr/lib/pkgconfig/libxul.pc: ------------------------------- prefix=/usr sdkdir=/usr/lib/xulrunner-devel-5.0 includedir=/usr/include/xulrunner-5.0 idldir=/usr/share/idl/xulrunner-5.0 Name: libxul Description: The Mozilla Runtime and Embedding Engine Version: 5.0 Requires: nspr >= 4.8.8 Libs: -L${sdkdir}/lib -lxpcomglue_s -lxul -lxpcom Cflags: -I${includedir} -fshort-wchar /usr/lib64/pkgconfig/libxul.pc: ------------------------------- prefix=/usr sdkdir=/usr/lib64/xulrunner-devel-5.0 includedir=/usr/include/xulrunner-5.0 idldir=/usr/share/idl/xulrunner-5.0 Name: libxul Description: The Mozilla Runtime and Embedding Engine Version: 5.0 Requires: nspr >= 4.8.8 Libs: -L${sdkdir}/lib -lxpcomglue_s -lxul -lxpcom Cflags: -I${includedir} -fshort-wchar
Here is a simple test case (no mozconfig), if : with xulrunner from http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/5.0/source/ mozilla-release# make -f client.mk configure 2>&1 | grep usable checking for usable char16_t (2 bytes, unsigned)... (cached) no checking for usable wchar_t (2 bytes, unsigned)... (cached) no with firefox from http://hg.mozilla.org/mozilla-central/ mozilla-central# make -f client.mk configure 2>&1 | grep usable checking for usable char16_t (2 bytes, unsigned)... (cached) yes checking for usable wchar_t (2 bytes, unsigned)... (cached) no It's because of those lines in the firefox configure script: >echo "$ac_t""$ac_cv_cxx0x_headers_bug" 1>&6 > CXXFLAGS="$_SAVE_CXXFLAGS" > if test "$ac_cv_cxx0x_headers_bug" = "no"; then > CXXFLAGS="$CXXFLAGS -std=gnu++0x" > fi > fi >fi The bug is solved by installing an up-to-date xulrunner. I compiled successfully xulrunner-8.0a1, then firefox-8.0a1. (But... it doesn't work for the moment... "Could not read application.ini", "Could not find the Mozilla runtime.")
Triaging, user fixed error with guidance from build team.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Component: Build Config → General
Product: Firefox → Firefox Build System
You need to log in before you can comment on or make changes to this bug.