[Bug lto/47241] lto not work on mingw32, reporting 'ld.exe: could not unlink output file'

dongsheng.song at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 15 02:46:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47241

--- Comment #16 from Dongsheng Song <dongsheng.song at gmail dot com> 2011-02-15 02:42:31 UTC ---
(In reply to comment #13)
> So, necessary patch is now committed to binutils. Could you please retest this
> issue with a recent binutils/HEAD version?
> 
> Thanks in advance,
> Kai

I don't known if this is a binutils issue, I use gcc trunk and binutils trunk:

$ svn info vcs/svn/gcc/trunk/
Path: vcs/svn/gcc/trunk
URL: svn://gcc.gnu.org/svn/gcc/trunk
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 170159
Node Kind: directory
Schedule: normal
Last Changed Author: redi
Last Changed Rev: 170159
Last Changed Date: 2011-02-15 07:51:07 +0800 (Tue, 15 Feb 2011)

$ git log -1
commit 47fcd70b56abc1d5f158ac488362337a8b26f577
Author: Alan Modra <amodra@bigpond.net.au>
Date:   Mon Feb 14 23:00:05 2011 +0000

    daily update


$ i686-w64-mingw32-g++ Hello.cpp
/tmp/ccbwXfkL.o:Hello.cpp:(.text+0x19): undefined reference to `std::cout'
/tmp/ccbwXfkL.o:Hello.cpp:(.text+0x1e): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&,
char const*)'
/tmp/ccbwXfkL.o:Hello.cpp:(.text+0x26): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/tmp/ccbwXfkL.o:Hello.cpp:(.text+0x2e): undefined reference to
`std::basic_ostream<char, std::char_traits<char>
>::operator<<(std::basic_ostream<char, std::char_traits<char> >&
(*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccbwXfkL.o:Hello.cpp:(.text+0x47): undefined reference to
`std::ios_base::Init::~Init()'
/tmp/ccbwXfkL.o:Hello.cpp:(.text+0x6a): undefined reference to
`std::ios_base::Init::Init()'
collect2: ld returned 1 exit status

But when I use static link, no errors:

$ i686-w64-mingw32-g++ -static Hello.cpp



More information about the Gcc-bugs mailing list