Closed Bug 596645 Opened 14 years ago Closed 14 years ago

Clang fails configure script with "configure: error: no size found for void *"

Categories

(Firefox Build System :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 579689

People

(Reporter: liblit, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100713 Firefox/3.6.7
Build Identifier: 

Compiling Firefox 3.6.9 from source (ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/source/firefox-3.6.9.source.tar.bz2) fails when using Clang instead of gcc.  The top-level configure script succeeds in its own tests, but when it runs "js/src/configure", things fall apart.

Reproducible: Always

Steps to Reproduce:
1. Download and unpack <http://hg.mozilla.org/releases/comm-1.9.2/>.
2. Obtain clang-2.9 (trunk 113379) from LLVM.
3. Create a top-level "mozconfig" file per the standard mozilla build instructions.
3. Run "make -f client.mk build CC=clang CXX=clang++"
Actual Results:  
checking for the size of void*... configure: error: No size found for void*
configure: error: /scratch/mozilla-1.9.2/js/src/configure failed for js/src
*** Fix above errors and then restart with               "make -f client.mk build"
make[1]: *** [configure] Error 1
make[1]: Leaving directory `/scratch/mozilla-1.9.2'
make: *** [/scratch/mozilla-1.9.2/ff-obj/Makefile] Error 2


Expected Results:  
Configure scripts should have completed successfully.

Inspection of "ff-obj/js/src/config.log" reveals that clang is reporting an error when compiling the configure script's code for checking sizes of types.  In particular, clang is asked to compile code that includes "return;" within a main() function:

    #line 7933 "configure"
    #include "confdefs.h"

    int main() {

                         int a[sizeof (void*) == 4 ? 1 : -1];
                         return;
                   
    ; return 0; }


Gcc allows this by default, but clang does not, reporting instead:

    error: non-void function 'main' should return a value [-Wreturn-type]

The C language specification allows for main() to reach its closing "}" without a return, but it does not allow for an explicit "return;" of no value from an int-returning main().  So clang is correct here; the test is malformed.
The one-line change in this patch fixes the problem by removing the explicit "return;" from the generated main() used in type size tests.  With this fix applied, the configure scripts no longer fail at this point with clang.  (They do fail later, unfortunately, but that is an unrelated matter we are still investigating.)
This was fixed in mozilla-central in bug 579689. The changes haven't landed on the 1.9.2 branch, since we don't automatically take fixes on the stable branches without getting them approved.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Thanks for the speedy reply, Ted.  I salute your dupe-squashing prowess!
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: