Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

fatal error LNK1169: one or more multiply defined symbols found

瀏覽次數:303 次
跳到第一則未讀訊息

Alex

未讀,
2011年12月20日 晚上10:20:012011/12/20
收件者:
Picture:
http://i44.tinypic.com/3010vue.png
Config.log (from top level in objectdir):
http://pastebin.com/YS5qLGBB

Benjamin Smedberg

未讀,
2011年12月21日 上午11:48:242011/12/21
收件者: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

未讀,
2011年12月22日 凌晨12:16:062011/12/22
收件者:
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

未讀,
2012年1月5日 中午12:37:562012/1/5
收件者:
Okay, with or without /NODEFAULTLIB:library the same errors come up.

Alex

未讀,
2012年1月6日 凌晨4:43:422012/1/6
收件者:
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

未讀,
2012年1月6日 上午9:01:172012/1/6
收件者: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

未讀,
2012年1月6日 晚上10:06:042012/1/6
收件者:
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

未讀,
2012年1月8日 清晨7:30:362012/1/8
收件者:
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

未讀,
2012年1月9日 下午1:50:512012/1/9
收件者:
> 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 則新訊息