Linking library errors during build

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Linking library errors during build

Joshua Zhao
Initially I met the following errors:
.....
LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already
defined in MSVCRT.lib(MSVCR80.dll)
LIBCMT.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already defined in MSVC
RT.lib(MSVCR80.dll)
LIBCMT.lib(isctype.obj) : error LNK2005: __isctype already defined in MSVCRT.lib
(MSVCR80.dll)
LIBCMT.lib(getenv.obj) : error LNK2005: _getenv already defined in MSVCRT.lib(MS
VCR80.dll)
LIBCMT.lib(tolower.obj) : error LNK2005: _tolower already defined in MSVCRT.lib(
MSVCR80.dll)
MSVCRT.lib(MSVCR80.dll) : error LNK2005: __strdup already defined in
LIBCMT.lib(strdup.obj)
  Creating library xpidl.lib and object xpidl.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; us
e /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; us
e /NODEFAULTLIB:library
xpidl.exe : fatal error LNK1169: one or more multiply defined symbols found
make[6]: *** [xpidl.exe] Error 145

After I set NODEFAULTLIB:MSVCRT and/or /NODEFAULTLIB:LIBCMT
 to avoid the conflicts between libraries, the old errors disappear but I
got bunch of new error messages like the following.

xpidl.obj : error LNK2001: unresolved external symbol __imp____iob_func
xpidl_idl.obj : error LNK2001: unresolved external symbol __imp____iob_func
xpidl_util.obj : error LNK2001: unresolved external symbol __imp____iob_func
xpt.lib(xpt_struct.obj) : error LNK2001: unresolved external symbol __imp____iob
_func
xpidl_doc.obj : error LNK2001: unresolved external symbol __imp__fputs
xpidl_java.obj : error LNK2019: unresolved external symbol __imp__fputs referenc
ed in function _interface_declaration
xpt.lib(xpt_struct.obj) : error LNK2001: unresolved external symbol __imp__fputs
xpidl.obj : error LNK2001: unresolved external symbol __imp__fputs
xpidl_idl.obj : error LNK2001: unresolved external symbol __imp__fputs
xpidl_util.obj : error LNK2001: unresolved external symbol __imp__fputs
xpidl_header.obj : error LNK2001: unresolved external symbol __imp__fputs

I googled around and it seems like it's due to mixing the various
flavors of CRT libraries. There is an article that explains the
various CRT options.
Q140584 HOWTO: Link with the Correct C Run-Time (CRT) Library
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q140584

However, who can teach me how/where to adjust these options for firefox build?

Thank you so much!

Joshua
_______________________________________________
dev-builds mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-builds
Reply | Threaded
Open this post in threaded view
|

Re: Linking library errors during build

Benjamin Smedberg
Joshua Zhao wrote:
> Initially I met the following errors:
> .....
> LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already
> defined in MSVCRT.lib(MSVCR80.dll)

I can't think why you would be running into this error in the first place;
it's not a typical problem. Are you passing any odd CFLAGS to the build system?

This is a trunk tree, right?

--BDS

> After I set NODEFAULTLIB:MSVCRT and/or /NODEFAULTLIB:LIBCMT
>  to avoid the conflicts between libraries, the old errors disappear but I
> got bunch of new error messages like the following.

You definitely shouldn't need to do this, and it will break the places in
the tree which use the static CRT on purpose.

> However, who can teach me how/where to adjust these options for firefox build?

You shouldn't need to, the build system sets the correct /MT or /MD flag
internally. You should start over with a clean objdir (and perhaps a clean
srcdir). If you still experience this problem, you will need to use the
"dumpbin /directives" tool to find the offending library/object file.

--BDS
_______________________________________________
dev-builds mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-builds
Reply | Threaded
Open this post in threaded view
|

Re: Linking library errors during build

Joshua Zhao
On 4/21/06, Benjamin Smedberg <[hidden email]> wrote:

> Joshua Zhao wrote:
> > Initially I met the following errors:
> > .....
> > LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already
> > defined in MSVCRT.lib(MSVCR80.dll)
>
> I can't think why you would be running into this error in the first place;
> it's not a typical problem. Are you passing any odd CFLAGS to the build system?
>
> This is a trunk tree, right?
>
> --BDS
>
I just downloaded the source and followed all basic instructions to
build. No odd CFAGS was used.
I just called 'export .mozconfig-firefox', then 'make -f client.mk
build' to build.
All these error messages are displayed on screen. What is a trunk
tree? Sorry I'm a newbie here.


> > After I set NODEFAULTLIB:MSVCRT and/or /NODEFAULTLIB:LIBCMT
> >  to avoid the conflicts between libraries, the old errors disappear but I
> > got bunch of new error messages like the following.
>
> You definitely shouldn't need to do this, and it will break the places in
> the tree which use the static CRT on purpose.
>
> > However, who can teach me how/where to adjust these options for firefox build?
>
> You shouldn't need to, the build system sets the correct /MT or /MD flag
> internally. You should start over with a clean objdir (and perhaps a clean
> srcdir). If you still experience this problem, you will need to use the
> "dumpbin /directives" tool to find the offending library/object file.
>
Can you give me some more hints on the "dumpbin/directives" tool?
Never heard about that before :(

Thank you very much!
Joshua



> --BDS
> _______________________________________________
> dev-builds mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-builds
>
_______________________________________________
dev-builds mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-builds
Reply | Threaded
Open this post in threaded view
|

Re: Linking library errors during build

Joshua Zhao
Maybe it's caused by my configuration settings?

. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-static
ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --enable-static
ac_add_options --disable-shared
ac_add_options --disable-tests
mk_add_options MOZ_CO_PROJECT=browser
_______________________________________________
dev-builds mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-builds
Reply | Threaded
Open this post in threaded view
|

Re: Linking library errors during build

Joshua Zhao
I just figured out the bug, which is because I used wrong lib from
moztools. I mistakely used its static version that use LIBCMT.lib.
However, I started to see other problems again. Then I finally found
somethere it's said that using version 2005 (VC8) is not possible. So
I'll go back to VC2003 :)

Thank you all who helped and tolerated my ignorance :)

Joshua


On 4/24/06, Joshua Zhao <[hidden email]> wrote:

> Maybe it's caused by my configuration settings?
>
> . $topsrcdir/browser/config/mozconfig
> mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-static
> ac_add_options --enable-optimize
> ac_add_options --disable-debug
> ac_add_options --enable-static
> ac_add_options --disable-shared
> ac_add_options --disable-tests
> mk_add_options MOZ_CO_PROJECT=browser
>
_______________________________________________
dev-builds mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-builds