Mingw build error in nsCycleCollector.cpp

RESOLVED FIXED

Status

defect
RESOLVED FIXED
13 years ago
5 months ago

People

(Reporter: bengt.erik.soderstrom, Assigned: martijn.martijn)

Tracking

Trunk
x86
Windows XP

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

13 years ago
Mingw build error:

nsCycleCollector.cpp
Building deps for /cygdrive/d/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp
/cygdrive/d/mozilla/mozilla/build/cygwin-wrapper g++ -mno-cygwin -o nsCycleColle
ctor.o -c  -DMOZILLA_INTERNAL_API -DOSTYPE=\"WINNT5.1\" -DOSARCH=\"WINNT\" -DBUI
LD_ID=2007010608 -D_IMPL_NS_COM  -I../../dist/include/string -I../../dist/includ
e   -I../../dist/include/xpcom -I../../dist/include/nspr  -DMOZ_PNG_READ -DPNG_N
O_MMX_CODE -DMOZ_PNG_WRITE        -fno-rtti -fno-exceptions -Wall -Wconversion -
Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy
-Wno-non-virtual-dtor -Wno-long-long -pedantic -mms-bitfields -pipe  -DNDEBUG -D
TRIMMED -O   -DWINVER=0x501 -D_WIN32_WINNT=0x501 -D_WIN32_IE=0x0400 -DX_DISPLAY_
MISSING=1 -DMOZILLA_VERSION=\"1.9a2pre\" -DMOZILLA_VERSION_U=1.9a2pre -DHAVE_SNP
RINTF=1 -D_WINDOWS=1 -D_WIN32=1 -DWIN32=1 -DXP_WIN=1 -DXP_WIN32=1 -DHW_THREADS=1
 -DSTDC_HEADERS=1 -DWIN32_LEAN_AND_MEAN=1 -DNO_X11=1 -D_X86_=1 -DD_INO=d_ino -DS
TDC_HEADERS=1 -DHAVE_DIRENT_H=1 -DHAVE_GETOPT_H=1 -DHAVE_MEMORY_H=1 -DHAVE_UNIST
D_H=1 -DHAVE_MALLOC_H=1 -DHAVE_LIBM=1 -DNO_X11=1 -DMMAP_MISSES_WRITES=1 -DHAVE_S
TRERROR=1 -DHAVE_SNPRINTF=1 -DHAVE_MEMMOVE=1 -DHAVE_RINT=1 -DVA_COPY=va_copy -DH
AVE_VA_COPY=1 -DMOZ_EMBEDDING_LEVEL_DEFAULT=1 -DMOZ_EMBEDDING_LEVEL_BASIC=1 -DMO
Z_EMBEDDING_LEVEL_MINIMAL=1 -DMOZ_PHOENIX=1 -DMOZ_BUILD_APP=browser -DMOZ_XUL_AP
P=1 -DMOZ_DEFAULT_TOOLKIT=\"cairo-windows\" -DMOZ_THEBES=1 -DMOZ_CAIRO_GFX=1 -DM
OZ_DISTRIBUTION_ID=\"org.mozilla\" -DOJI=1 -DIBMBIDI=1 -DMOZ_VIEW_SOURCE=1 -DMOZ
_XPINSTALL=1 -DMOZ_JSLOADER=1 -DNS_PRINTING=1 -DNS_PRINT_PREVIEW=1 -DMOZ_NO_XPCO
M_OBSOLETE=1 -DMOZ_XTF=1 -DMOZ_MATHML=1 -DMOZ_ENABLE_CANVAS=1 -DMOZ_SVG=1 -DMOZ_
SVG_FOREIGNOBJECT=1 -DMOZ_UPDATE_CHANNEL=default -DMOZ_PLACES=1 -DMOZ_FEEDS=1 -D
MOZ_STORAGE=1 -DMOZ_SAFE_BROWSING=1 -DMOZ_URL_CLASSIFIER=1 -DMOZ_LOGGING=1 -DHAV
E___CXA_DEMANGLE=1 -DMOZ_USER_DIR=\"Mozilla\" -DHAVE_STDINT_H=1 -DHAVE_INTTYPES_
H=1 -DHAVE_UINT64_T=1 -DMOZ_XUL=1 -DMOZ_PROFILELOCKING=1 -DMOZ_RDF=1 -DMOZ_MORKR
EADER=1 -DMOZ_DLL_SUFFIX=\".dll\" -DJS_THREADSAFE=1 -DMOZILLA_LOCALE_VERSION=\"1
.9a1\" -DMOZILLA_REGION_VERSION=\"1.9a1\" -DMOZILLA_SKIN_VERSION=\"1.8\"  -D_MOZ
ILLA_CONFIG_H_ -DMOZILLA_CLIENT /cygdrive/d/mozilla/mozilla/xpcom/base/nsCycleCo
llector.cpp
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp:115:20: crtdbg.h: No such fil
e or directory
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp: In member function `void nsC
ycleCollector::CollectWhite()':
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp:874: error: aggregate `_CrtMe
mState ms1' has incomplete type and cannot be defined
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp:874: error: aggregate `_CrtMe
mState ms2' has incomplete type and cannot be defined
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp:875: error: `_CrtMemCheckpoin
t' was not declared in this scope
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp: In function `int AllocHook(i
nt, void*, size_t, int, long int, const unsigned char*, int)':
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp:1267: error: `_HOOK_FREE' was
 not declared in this scope
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp:1267: warning: unused variabl
e '_HOOK_FREE'
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp: In function `void InitMemHoo
k()':
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp:1276: error: `_CrtSetAllocHoo
k' was not declared in this scope
d:/mozilla/mozilla/xpcom/base/nsCycleCollector.cpp:1276: warning: unused variabl
e '_CrtSetAllocHook'
make[5]: *** [nsCycleCollector.o] Error 1
make[5]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw/xpcom/base'

make[4]: *** [libs] Error 2
make[4]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw/xpcom'
make[3]: *** [libs_tier_xpcom] Error 2
make[3]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw'
make[2]: *** [tier_xpcom] Error 2
make[2]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw'
make[1]: *** [alldep] Error 2
make[1]: Leaving directory `/cygdrive/d/mozilla/mozilla/object-mingw'
make: *** [alldep] Error 2

About a week ago, or less, Mingw was building just fine

Comment 1

13 years ago
This is related to the check-in for Bug #333078. I got the problem about 2 days ago.
Depends on: cycle-collector
(Assignee)

Comment 2

13 years ago
Email conversation from me and Graydon:

Martijn wrote:
> Hi Graydon,
>
> I'm getting this build error when trying to build with your xpcom
> cycle collector patch:
> http://wargers.org/mozilla/bug333078_xpcom_cycle/builderror.txt
> I'm building in mingw, that's probably the reason.
> This is just for your information.

Ah yes, probably because WIN32 is defined but some of the win32 debug
machinery is missing; this stuff is all inessential debugging aids
though, and doesn't need to actually exist. We just need to detect that
we're in a situation that lacks the win32 debug machinery and disable
our attempted interaction with it.

Can you determine the appropriate modification to the
conditional-compilation guards in nsCycleCollector.cpp to exclude mingw?
It probably just involves something like

#if defined(WIN32) && !defined(MINGW)

or such. I'll update the patch if you can figure that out.
No longer depends on: cycle-collector
(Assignee)

Comment 3

13 years ago
Posted patch This is what I came up with (obsolete) — Splinter Review
(Reporter)

Comment 4

13 years ago
I have tested Martijn's patch in Mingw and in VC8 Express SP1, and it works fine.

However, it seems that we have different versions of nsCycleCollector.cpp:

Mine, which I thought was properly updated with cvs, looks like this, with the patch applied, from line 1600:

-------
void
nsCycleCollector::Collect()
{
    // This triggers a JS GC. Our caller assumes we always trigger at
    // least one JS GC -- they rely on this fact to avoid redundant JS
    // GC calls -- so it's essential that we actually execute this
    // step!
    
    for (PRUint32 i = 0; i <= nsIProgrammingLanguage::MAX; ++i) {
        if (mRuntimes[i])
            mRuntimes[i]->BeginCycleCollection();
    }

    if (! mParams.mDoNothing) {
#ifndef __MINGW32__
        if (mParams.mHookMalloc)
            InitMemHook();
 #endif       
        CollectPurple();

        if (mBufs[0]->GetSize() == 0) {
            mPurpleBuf.BumpGeneration();
            mStats.mCollection++;
            if (mParams.mReportStats)
                mStats.Dump();

        } else {
            
            if (mCollectionInProgress)
                Fault("re-entered collection");
            
            mCollectionInProgress = PR_TRUE;
            mScanInProgress = PR_TRUE;
            
            mGraph.Clear();
            
            // The main Bacon & Rajan collection algorithm.
            
            MarkRoots();  
            ScanRoots();
            
            mScanInProgress = PR_FALSE;
            MaybeDrawGraphs();
            CollectWhite();
            ForgetAll();
            
            // Some additional book-keeping.
            
            mGraph.Clear();
            mPurpleBuf.BumpGeneration();
            mStats.mCollection++;
            if (mParams.mReportStats)
                mStats.Dump();
            mCollectionInProgress = PR_FALSE;
        }
    }

    for (PRUint32 i = 0; i <= nsIProgrammingLanguage::MAX; ++i) {
        if (mRuntimes[i])
            mRuntimes[i]->FinishCycleCollection();
    }    
}


////////////////////////////////////////////////////////////////////////
// Module public API (exported in nsCycleCollector.h)
// Just functions that redirect into the singleton, once it's built.
////////////////////////////////////////////////////////////////////////

void 
nsCycleCollector_registerRuntime(PRUint32 langID, 
                                 nsCycleCollectionLanguageRuntime *rt)
{
    if (sCollectorConstructed == 0)
        return;

    sCollector.RegisterRuntime(langID, rt);
}


void 
nsCycleCollector_forgetRuntime(PRUint32 langID)
{
    if (sCollectorConstructed == 0)
        return;

    sCollector.ForgetRuntime(langID);
}


void 
nsCycleCollector_suspect(nsISupports *n)
{
    if (sCollectorConstructed == 0)
        return;
    
    sCollector.Suspect(n);
}


void 
nsCycleCollector_forget(nsISupports *n)
{
    if (sCollectorConstructed == 0)
        return;

    sCollector.Forget(n);
}


void 
nsCycleCollector_collect()
{
    if (sCollectorConstructed == 0)
        return;

    sCollector.Collect();
}


PRBool
nsCycleCollector_isScanSafe(nsISupports *s)
{
    nsresult rv;

    if (!s)
        return PR_FALSE;

    nsCOMPtr<nsCycleCollectionParticipant> cp = do_QueryInterface(s, &rv);
    if (NS_FAILED(rv)) {
        sCollector.mStats.mFailedQI++;
        return PR_FALSE;
    }

    return PR_TRUE;
}

Comment 5

13 years ago
(In reply to comment #3)
> Created an attachment (id=250684) [details]
> This is what I came up with

As with the last comment, I also noticed that the patch didn't apply cleanly. After some manual patching, I got around that, and the code compiled cleanly under MinGW/cygwin. I don't know if it will run as I'm doing a clobber build which has yet to finish.

Assignee: nobody → graydon
(Assignee)

Comment 6

12 years ago
Posted patch Updated patch (obsolete) — Splinter Review
Patch updated to yesterday's tree. Graydon, is this patch acceptable to stop the mingw build error?
Attachment #250684 - Attachment is obsolete: true
Comment on attachment 251972 [details] [diff] [review]
Updated patch

This patch accidentally backs out the patch from bug 366063.
Attachment #251972 - Attachment is obsolete: true
(Assignee)

Comment 8

12 years ago
Posted patch patchSplinter Review
Sorry, I meant this.
(Reporter)

Comment 9

12 years ago
(In reply to comment #8)
> Created an attachment (id=252039) [details]
> patch
> 
> Sorry, I meant this.
> 

I have tested this, Martijn's latest patch. It works. And the resulting build with Mingw also works fine. So what are we waiting for?
It looks perfectly sensible to me. Do you want me to r+ it or something? I'm not sure whether it's my role to do so.
(Assignee)

Comment 11

12 years ago
Comment on attachment 252039 [details] [diff] [review]
patch

Yes, if you could review it, that would be great.
Attachment #252039 - Flags: superreview?(jst)
Attachment #252039 - Flags: review?(graydon)
Attachment #252039 - Flags: review?(graydon) → review+
Attachment #252039 - Flags: superreview?(jst) → superreview+
(Assignee)

Updated

12 years ago
Assignee: graydon → martijn.martijn
(Assignee)

Comment 12

12 years ago
Checking in nsCycleCollector.cpp;
/cvsroot/mozilla/xpcom/base/nsCycleCollector.cpp,v  <--  nsCycleCollector.cpp
new revision: 1.9; previous revision: 1.8
done

Checked in on trunk.
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
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.