[CMake] linker error while executing with clang and llvm binaries for mingw32

akshay ratnaparkhi ackk007 at gmail.com
Tue Mar 27 05:46:25 EDT 2012


Hi all,
   I am new for clang and llvm and this mailing forum. I am trying build
cland on my windows xp 32 bit system using "cland binaries for mingw32
version 2.9" and "llvm binaries for mingw32 version 2.9". I follow
following steps:

1. download mingw in directory (C:/MinGW)
2. download "clang2.9 binaries for mingw32" and "llvm-2.9 binaries for
mingw32"
3. extract both in the same directory of mingw (C:/MinGW)
4. set path C:/MinGW/bin to PATH environment.
Then I write one simple code
 #include<stdio.h>
  int main()
   {
     printf("hello world\n");
    return 0;
   }

then compile code
  clang hello.cpp -o hello.exe
it compiles fine
but when I tried to execute it
   clang hello.exe
it gives following error

*****************************ERROR*****************************
hello.exe:crt1.c:(.text+0x280): multiple definition of `mainCRTStartup'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.text+0x280):
firs
t defined here
hello.exe:crt1.c:(.text+0x2a0): multiple definition of `WinMainCRTStartup'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.text+0x2a0):
firs
t defined here
hello.exe:crt1.c:(.text+0x2c0): multiple definition of `atexit'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.text+0x2c0):
firs
t defined here
hello.exe:crt1.c:(.text+0x2d0): multiple definition of `_onexit'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.text+0x2d0):
firs
t defined here
hello.exe:cygming-crtbegin.c:(.text+0x2e0): multiple definition of
`__gcc_regist
er_frame'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtbegin.o:cygming-crtbegin.c:(.text+0x0):
 first defined here
hello.exe:cygming-crtbegin.c:(.text+0x36c): multiple definition of
`__gcc_deregi
ster_frame'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtbegin.o:cygming-crtbegin.c:(.text+0x8c)
: first defined here
hello.exe:crt1.c:(.bss+0x4): multiple definition of `_argc'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.bss+0x4):
first d
efined here
hello.exe:crt1.c:(.bss+0x0): multiple definition of `_argv'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o:crt1.c:(.bss+0x0):
first d
efined here
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtbegin.o:cygming-crtbegin.c:(.text+0x85)
: undefined reference to `_Jv_RegisterClasses'
collect2: ld returned 1 exit status
clang: error:
      linker
      (via
      gcc)
      command
      failed
      with
      exit
      code
      1
      (use
      -v
      to
      see
      invocation)
*****************************************************]
How can I resolve this problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120327/f73b44b8/attachment.htm>


More information about the CMake mailing list