Running clang on Windows with mingw

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

Running clang on Windows with mingw

Yun Chen-2
Hi

If I compile the following code with command line: clang++ -Xclang
-triple=i686-pc-mingw32 -isystem
C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++\mingw32 t.cpp

#include<iostream>
int main()
{
        std::cout<<"Hello world!\n";
}

The output is:
C:/Windows/TEMP/cc-000001.o:fake:(.text+0x14): undefined reference to
`__dso_handle'
C:/Windows/TEMP/cc-000001.o:fake:(.text+0x3e): undefined reference to
`__cxa_atexit'
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 get rid of the link errors?

Thanks!

Yun
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Running clang on Windows with mingw

Eli Friedman
On Sat, Jul 10, 2010 at 10:45 PM, Yun Chen <[hidden email]> wrote:

> Hi
>
> If I compile the following code with command line: clang++ -Xclang
> -triple=i686-pc-mingw32 -isystem
> C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++\mingw32 t.cpp
>
> #include<iostream>
> int main()
> {
>        std::cout<<"Hello world!\n";
> }
>
> The output is:
> C:/Windows/TEMP/cc-000001.o:fake:(.text+0x14): undefined reference to
> `__dso_handle'
> C:/Windows/TEMP/cc-000001.o:fake:(.text+0x3e): undefined reference to
> `__cxa_atexit'
> 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 get rid of the link errors?

This is essentially the same thing as
http://llvm.org/bugs/show_bug.cgi?id=7276 ; clang shouldn't be
generating references to __cxa_atexit on Windows.

-Eli

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Running clang on Windows with mingw

eric_niebler
In reply to this post by Yun Chen-2
On 7/11/2010 1:45 AM, Yun Chen wrote:

> Hi
>
> If I compile the following code with command line: clang++ -Xclang
> -triple=i686-pc-mingw32 -isystem
> C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++\mingw32 t.cpp
>
> #include<iostream>
> int main()
> {
> std::cout<<"Hello world!\n";
> }
>
> The output is:
> C:/Windows/TEMP/cc-000001.o:fake:(.text+0x14): undefined reference to
> `__dso_handle'
> C:/Windows/TEMP/cc-000001.o:fake:(.text+0x3e): undefined reference to
> `__cxa_atexit'
> 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 get rid of the link errors?

This is a known bug: http://llvm.org/bugs/show_bug.cgi?id=7276

Dear clang team: there are hoards of Windows users out here who want to
help make clang great. Be a sport and throw us a bone. :-)

--
Eric Niebler
BoostPro Computing
http://www.boostpro.com
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev