Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

fatal error LNK1169: one or more multiply defined symbols found

303 views
Skip to first unread message

Alex

unread,
Dec 20, 2011, 10:20:01 PM12/20/11
to
Picture:
http://i44.tinypic.com/3010vue.png
Config.log (from top level in objectdir):
http://pastebin.com/YS5qLGBB

Benjamin Smedberg

unread,
Dec 21, 2011, 11:48:24 AM12/21/11
to Alex, dev-b...@lists.mozilla.org
What compiler toolchain/version are you using, and are you passing any
special mozconfig flags? The big symptom here appears to be:

ignoring unknown option '/NODEFAULTLIB:library'

We use the nodefaultlib flag to force compiling against the static CRT
instead of the (default) dynamic CRT for certain functions. In this case
you are linking against *both* CRTs, which gives you the multiple-symbol
issue.

--BDS

Alex

unread,
Dec 22, 2011, 12:16:06 AM12/22/11
to
I'm using Intel C++ Compiler 12.1. I didn't have -NODEFAULTLIB:library
as a flag initially, but further up the compilation process I had some
errors, saying to use -NODEFAULTLIB:library so I did, and compilation
continued further on until this point.

Alex

unread,
Jan 5, 2012, 12:37:56 PM1/5/12
to
Okay, with or without /NODEFAULTLIB:library the same errors come up.

Alex

unread,
Jan 6, 2012, 4:43:42 AM1/6/12
to
Picture:
http://www.google.com/url?sa=D&q=http://i44.tinypic.com/3010vue.png&usg=AFQjCNEktFyqsmSHtCRmMZAjA6IHhW6dFA

Flags I've tried:
"-MD -openmp -O3 -Ob2 -arch:SSE3 -nodefaultlib:vcomp"
"-O3 -Ob2 -arch:SSE3 -nodefaultlib:library"
"-O3 -Ob2 -arch:SSE3 -nodefaultlib"
"-O3 -Ob2 -arch:SSE3"

But they ALL retain the same error. How do I fix this?

Benjamin Smedberg

unread,
Jan 6, 2012, 9:01:17 AM1/6/12
to Alex, dev-b...@lists.mozilla.org
As I already noted, these errors are caused by you linking multiple
copies of the C runtime. You are linking both the dynamic version
(msvcrt) and the static version (libcmt). You need to figure out why
both copies of the CRT are being pulled into your project.

"-nodefaultlib:library" doesn't make any sense at all. You use
-nodefaultlib:libname to specify a *specific* library which should not
be linked even though it is normally linked by default. See for example
http://mxr.mozilla.org/mozilla-central/source/configure.in#7226 where we
specify -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt
-NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt

--BDS

Mook

unread,
Jan 6, 2012, 10:06:04 PM1/6/12
to
On 1/5/2012 9:37 AM, Alex wrote:
> On Dec 22 2011, 5:16 am, Alex<alexkonto...@gmail.com> wrote:
>> I'm using Intel C++ Compiler 12.1. I didn't have -NODEFAULTLIB:library
>> as a flag initially, but further up the compilation process I had some
>> errors, saying to use -NODEFAULTLIB:library so I did, and compilation
>> continued further on until this point.

> Okay, with or without /NODEFAULTLIB:library the same errors come up.

It appears that the Intel linker you're using doesn't support a MSVC
feature in use (the -NODEFAULTLIB flag); and you probably manually
hacked something because it probably wanted -NODEFAULTLIB:msvcrt (but
the error message used the word "library" because it was generic, and
you just copied what it said without interpreting it). In this case
it's probably because some of the objects going into mar.exe was built
against msvcrt (mozcrt/jemalloc), but was being linked against the
static CRT because having the updater-bit depend on mozcrt would be a
bad idea.

Your best bet is to attempt to reorganize things and have it build the
relevant object files twice, once against the static CRT (for use in
mar.exe) and once against mozcrt (for linking into libxul or wherever
that goes). Then see if those changes look clean enough to upstream.

This is all going from memory, of course - nothing like actually
debugging the problem on a system exhibiting the (build) problem.

--
HTH,
Mook

Alex

unread,
Jan 8, 2012, 7:30:36 AM1/8/12
to
On Jan 7, 3:06 am, Mook <mook.moz
On Jan 6, 2:01 pm, Benjamin Smedberg <benja...@smedbergs.us> wrote:
> On 1/6/2012 4:43 AM, Alex wrote:> Picture:
> >http://www.google.com/url?sa=D&q=http://i44.tinypic.com/3010vue.png&u...
>
> > Flags I've tried:
> > "-MD -openmp -O3 -Ob2 -arch:SSE3 -nodefaultlib:vcomp"
> > "-O3 -Ob2 -arch:SSE3 -nodefaultlib:library"
> > "-O3 -Ob2 -arch:SSE3 -nodefaultlib"
> > "-O3 -Ob2 -arch:SSE3"
>
> > But they ALL retain the same error. How do I fix this?
>
> As I already noted, these errors are caused by you linking multiple
> copies of the C runtime. You are linking both the dynamic version
> (msvcrt) and the static version (libcmt). You need to figure out why
> both copies of the CRT are being pulled into your project.
>
> "-nodefaultlib:library" doesn't make any sense at all. You use
> -nodefaultlib:libname to specify a *specific* library which should not
> be linked even though it is normally linked by default. See for examplehttp://mxr.mozilla.org/mozilla-central/source/configure.in#7226where we
> specify -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt
> -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt
>
> --BDS

Right okay. Sorry for being ignorant on this matter, I'm used to just
working in an IDE and everything being done automatically for me. I
got a bit confused because I assumed that the -openmp and -
nodefaultlib:vcomp would utilise the OpenMP libraries as described
here:
http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/cpp/win/optaps/common/optaps_par_compat_libs_using.htm

As for the code, I didn't change anything. So I need to build object
files twice? How would I go about doing that, would it be done during
the build process or separately?

Also out of curiosity if I didn't use jemalloc would this error still
have occured?

Best Regards, Alex

Alex

unread,
Jan 9, 2012, 1:50:51 PM1/9/12
to
> here:http://software.intel.com/sites/products/documentation/hpc/composerxe...
>
> As for the code, I didn't change anything. So I need to build object
> files twice? How would I go about doing that, would it be done during
> the build process or separately?
>
> Also out of curiosity if I didn't use jemalloc would this error still
> have occured?
>
> Best Regards, Alex

Okay, well I seemed to have made an error and set AR as xilib istead
of xilink, which is what people who have used ICC have used. But now I
get a different error:
http://i40.tinypic.com/2vtzcwy.png
What does this error mean?
0 new messages