Development :  K-Meleon Forum
K-Meleon development related discussions. 
Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: Ken
Date: June 25, 2011 07:13AM

I am trying to build K-Meleon with Gecko 1.9.1 using VS2005 (MSVC8) SP1 on Windows 7 Pro.

I followed the instructions in http://kmeleon.sourceforge.net/wiki/BuildKMeleonDistribution.

I was able to build GRE 1.9.1 using the source downloaded from:
hg clone http://hg.mozilla.org/releases/mozilla-1.9.1/

patched with K-Meleon specific GRE 1.9.1x source files: GRE1.9.1build.7z.

I proceeded by downloading the latest source for K-Meleon using the specified instructions:
cvs -d:pserver:anonymous@kmeleon.cvs.sourceforge.net:/cvsroot/kmeleon login
cvs -z3 -d:pserver:anonymous@kmeleon.cvs.sourceforge.net:/cvsroot/kmeleon checkout .
cvs -d:pserver:anonymous@kmeleon.cvs.sourceforge.net:/cvsroot/kmeleon logout

I converted the KMeleon.sln VS Solution from VS2003 format to VS2005.


Errors Building the "Release Unicode" Configuration
---------------------------------------------------
I added GECKO_VERSION=19 in the C++ Preprocessor Directives of the k-meleon project for this build configuration.

I also had to add a couple of additional directories into the list of Include paths to resolve compile errors:

- ..\mozilla\mozilla\dist\include\profdirserviceprovider
- ..\mozilla\mozilla\dist\include\suitetypeaheadfind

Plus, I copied the embed_base_s.lib file from ..\mozilla\mozilla\dist\sdk\lib path into the ..\mozilla\mozilla\dist\lib path to resolve the linker error.

After doing all above, I still have the following errors:

1>warning C4727: PCH named c:\ccs\webklient\k-meleon\release unicode\k-meleon.pch with same timestamp found in c:\ccs\webklient\k-meleon\Release\StdAfx.obj and c:\ccs\webklient\k-meleon\Release\PrintSetupDialog.obj. Using first PCH.
1>StdAfx.obj : error LNK2005: ___@@_PchSym_@00@UxxhUdvyporvmgUpRnvovlmUivovzhvUhgwzucOlyq@ already defined in PrintSetupDialog.obj
1>BrowserImpl.obj : error LNK2001: unresolved external symbol "public: int __thiscall nsAString::Equals(class nsAString const &,int (__cdecl*)(wchar_t const *,wchar_t const *,unsigned int))const " (?Equals@nsAString@@QBEHABV1@P6AHPB_W1I@Z@Z)
1>BrowserImpl.obj : error LNK2001: unresolved external symbol "public: static int __cdecl nsAString::DefaultComparator(wchar_t const *,wchar_t const *,unsigned int)" (?DefaultComparator@nsAString@@SAHPB_W0I@Z)
1>BrowserImpl.obj : error LNK2001: unresolved external symbol "public: wchar_t const * __thiscall nsAString::BeginReading(void)const " (?BeginReading@nsAString@@QBEPB_WXZ)
1>ProfileMgr.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl NS_NewProfileDirServiceProvider(int,class nsProfileDirServiceProvider * *)" (?NS_NewProfileDirServiceProvider@@YAIHPAPAVnsProfileDirServiceProvider@@@Z)
1>Components.obj : error LNK2001: unresolved external symbol "public: __thiscall ContentDispatchChooser::ContentDispatchChooser(void)" (??0ContentDispatchChooser@@QAE@XZ)
1>..\release\k-meleon.exe : fatal error LNK1120: 5 unresolved externals
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 8.00.50727
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://c:\ccs\webklient\k-meleon\Release Unicode\BuildLog.htm"
1>k-meleon - 7 error(s), 296 warning(s)


Errors Building the "Release" Configuration
---------------------------------------------------
I followed the same steps as in "Release Unicode" section above (added GECKO_VERSION=19 to the project setting and a couple of include directories).

The remaining errors are different from the "Release Unicode" build. They are:

1>.\Plugins.cpp(1514) : error C2065: '_lpa' : undeclared identifier
1>.\Plugins.cpp(1514) : error C2065: '_convert' : undeclared identifier
1>.\Plugins.cpp(1514) : error C2065: '_acp' : undeclared identifier
: : : :
1>.\BrowserFrm.cpp(250) : error C2065: 'WM_XBUTTONUP' : undeclared identifier
1>.\BrowserFrm.cpp(251) : error C2065: 'XBUTTON1' : undeclared identifier
1>.\BrowserFrm.cpp(253) : error C2065: 'XBUTTON2' : undeclared identifier
: : : :
1>Build log was saved at "file://c:\ccs\webklient\k-meleon\Release\BuildLog.htm"
1>k-meleon - 6 error(s), 68 warning(s)


Any help to resolve these errors are greatly appreciated.


I also would like to be able to build the Debug version of GRE 1.9.1 that can be used to build the Debug version of K-Meleon. Is there a .mozconfig file somewhere to generate KMeleon-specific Debug version of GRE 1.9.1? If not, would someone post it?

Options: ReplyQuote
Re: Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: guenter
Date: June 25, 2011 02:13PM

1.) I do not know the answer to Your build question but would also like to know the solution. I did not succeed to build K-Meleon.exe with VC8 SP1 but was only lucky with the 90 days test version of VC9. My K-Meleon.exe build with with VC9 was terribly unstable. :(



2.) This subsequent debug .mozconfig code was sent by mail by Dorian together with the moz1.9.1.patch that You used. I have not tested it yet but I assume that it works.

Create a file called .mozconfig and write into it:

ac_add_options --enable-application=kmeleon
mk_add_options MOZ_CO_PROJECT=standalone
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/RELEASE

ac_add_options --disable-mailnews
ac_add_options --enable-debugger-info-modules=yes
#ac_add_options --disable-optimize
#ac_add_options --enable-debug
#mk_add_options MOZ_MAKE_FLAGS=-j2

ac_add_options --enable-optimize='-O1 -GL'
ac_add_options --enable-jemalloc
LDFLAGS='-LTCG -OPT:REF -OPT:ICF'
AR_FLAGS='-LTCG'


You may need to remove the comment signs before these lines? Like

ac_add_options --disable-optimize
ac_add_options --enable-debug


I have no idea what

#mk_add_options MOZ_MAKE_FLAGS=-j2

is for.



Edited 1 time(s). Last edit at 06/25/2011 02:27PM by guenter.

Options: ReplyQuote
Re: Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: Dorian
Date: June 25, 2011 03:35PM

In the preprocessor directive you should add
WINVER=0x500;_WIN32_IE=0x0500;

Also make sure that "treat wchar_t as built-in type" is set to no in the compiler option.

Options: ReplyQuote
Re: Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: Ken
Date: June 26, 2011 01:08AM

Thank you for the quick response.

After updating the compiler settings with WINVER=0x500, _WIN32_IE=0x0500, and
setting "treat wchar_t as built-in type" to No, the "Release Unicode" build is down to 3 errors.


Errors Building the "Release Unicode" Configuration
---------------------------------------------------
1>Compiling resources...
1>Linking...
1>warning C4727: PCH named c:\ccs\webklient\k-meleon\release unicode\k-meleon.pch with same timestamp found in c:\ccs\webklient\k-meleon\Release\StdAfx.obj and c:\ccs\webklient\k-meleon\Release\PrintSetupDialog.obj. Using first PCH.

1>StdAfx.obj : error LNK2005: ___@@_PchSym_@00@UxxhUdvyporvmgUpRnvovlmUivovzhvUhgwzucOlyq@ already defined in PrintSetupDialog.obj

1>ProfileMgr.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl NS_NewProfileDirServiceProvider(int,class nsProfileDirServiceProvider * *)" (?NS_NewProfileDirServiceProvider@@YAIHPAPAVnsProfileDirServiceProvider@@@Z)

1>Components.obj : error LNK2001: unresolved external symbol "public: __thiscall ContentDispatchChooser::ContentDispatchChooser(void)" (??0ContentDispatchChooser@@QAE@XZ)

1>..\release\k-meleon.exe : fatal error LNK1120: 2 unresolved externals

Options: ReplyQuote
Re: Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: deadlock
Date: June 26, 2011 02:55AM

@Ken
Fix for first error in Solution Explorer:

Use Precompiled Header (/Yu)
- k-meleon

Not Using Precompiled Headers
- utils.cpp
- winEmbedFileLocProvider.cpp

Create Precompiled Header (/Yc)
- stdafx.cpp

(based on settings from KMeleon.dsp from CVS)

You can disable smileys if your pasting code/logs.



Edited 3 time(s). Last edit at 06/27/2011 07:56PM by deadlock.

Options: ReplyQuote
Re: Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: Ken
Date: June 26, 2011 06:26AM

Thanks for the quick response.

I straightened up the Precompiled Header settings.
- utils.cpp is already set "Not Using Precompiled Header"
- winEmbedFileLocProvider.cpp was set to "Using Precompiled Header", so I changed it to "Not Using Precompiled Header".

Walking through each CPP file, I found PrintSetupDialog.cpp was set to "Create Precompiled Header", so I changed it to "Use Precompiled Header".

Now I am down to 2 linker errors:

1>Linking...
1>ProfileMgr.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl NS_NewProfileDirServiceProvider(int,class nsProfileDirServiceProvider * *)" (?NS_NewProfileDirServiceProvider@@YAIHPAPAVnsProfileDirServiceProvider@@@Z)

1>Components.obj : error LNK2001: unresolved external symbol "public: __thiscall ContentDispatchChooser::ContentDispatchChooser(void)" (??0ContentDispatchChooser@@QAE@XZ)
1>..\release\k-meleon.exe : fatal error LNK1120: 2 unresolved externals


Is this because of missing one or more Mozilla libraries? Which libraries?

I used the .mozconfig file that is part of the GRE1.9.1build.7z to generate GRE 1.9.1.


One change I made in the ProfileMgr.cpp file:
I replaced
#pragma comment(lib, "profdirserviceprovidersa_s.lib")
with
#ifndef USE_PROFILES
#pragma comment(lib, "profdirserviceprovidersa_s.lib")
#endif
just like the StdAfx.h


Without the #ifndef USE_PROFILES I get a linker error for "missing input file profdirserviceprovidersa_s.lib" since the library is not generated during GRE 1.9.1 build.


For the K-Meleon binaries that are available for download, which Build Configuration is used to produce the binaries? Is it "Release Unicode" or "Release" or "Release MFC Static" or "Release MFC Static Unicode"?

Options: ReplyQuote
Re: Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: deadlock
Date: June 27, 2011 01:16AM

@Ken
>'Create Precompiled Header', so I changed it to 'Use Precompiled
That's what I did too.
It used the setting i gave the parent 'k-meleon'.

>One change I made in the ProfileMgr.cpp file:
>I replaced
>#pragma comment(lib, 'profdirserviceprovidersa_s.lib')
>with
>#ifndef USE_PROFILES
>#pragma comment(lib, 'profdirserviceprovidersa_s.lib')
>#endif
>just like the StdAfx.h

I didn't change ProfileMgr.cpp.
My GRE compiled profdirserviceprovidersa_s.lib
and KM uses it for ProfileMgr.cpp.
It is disabled in stdafx.h though. Any ideas?
Only Dorianus knows what is correct.

>which Build Configuration is used to produce the binaries?
Guenter and me made some experiments this spring.
We guess, that 1.6b2 is 'Release MFC Static Unicode'.
But there is no big difference in their behaviour.
Only sizes differ.

Options: ReplyQuote
Re: Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: guenter
Date: June 27, 2011 07:26AM

I found this in a handout by Dorian from 2007.

Quote
Dorian
Release MFC Static and Release MFC Static Unicode are used
for the official build but need a custom build of MFC.

For 1.6 Release MFC Static Unicode - the other was IMHO for Windows9x.

When You try to look into import table with Filealyzer it looks like K-Meleon.exe is linked to MFC static but to msvcr80.dll (the C runtime) dynamic.

But the tool says it has an error so only Dorian can answer it exactly.





Edited 1 time(s). Last edit at 06/27/2011 07:32AM by guenter.

Attachments: imports.gif (22.6 KB)  
Options: ReplyQuote
Re: Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: Ken
Date: June 28, 2011 02:45AM

I managed to find the profdirserviceprovidersa_s.lib in the following location:
.testVC9\kmeleon\profile\dirserviceprovider\standalone\profdirserviceprovidersa_s.lib

For some reason it was not generated in the right place.

I copied this library to "mozilla\mozilla\dist\lib"

I followed @deadlock's response and restored ProfileMgr.cpp back to the original
#pragma comment(lib, "profdirserviceprovidersa_s.lib")
(without the #ifndef USE_PROFILES ... #endif)

I also found ContentDispatchChooser.cpp is somehow not included in the k-meleon project, so I added it.

And now the build is successful for "Release Unicode" configuration.

There are still errors for the other Release configurations (Release, Release MFC Static, Release MFC Static Unicode). I also have not tried the Debug build yet.

Thanks everyone for all the help!

Options: ReplyQuote
Re: Errors building K-Meleon with Gecko 1.9.1 using VS2005
Posted by: Dorian
Date: June 28, 2011 02:57AM

Quote
Ken
There are still errors for the other Release configurations (Release, Release MFC Static, Release MFC Static Unicode). I also have not tried the Debug build yet.

MFC Static builds need a custom MFC build and are just used to decrease release size. Release is not to be used with Gecko 1.9

Options: ReplyQuote


K-Meleon forum is powered by Phorum.