FS#49860 - [mingw-w64-gcc] Any program using std::string causes libstdc++-6.dll runtime error

Attached to Project: Community Packages
Opened by Andrew Gunnerson (chenxiaolong) - Monday, 27 June 2016, 02:05 GMT
Last edited by Jonathan Roemer (pid1) - Monday, 12 September 2016, 21:26 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Ever since the upgrade to mingw-w64-gcc 6.1.1-1, programs using std::string no longer run (potential ABI issue?). They will fail to run with a message, such as:

--------------------------------
wine: Call from 0x7bc53509 to unimplemented function libstdc++-6.dll._ZNSaIcEC1Ev, aborting
wine: Unimplemented function libstdc++-6.dll._ZNSaIcEC1Ev called at address 0x7bc53509 (thread 0009), starting debugger...
--------------------------------

This is a significant regression since many C++ programs use std::string. The previous version (5.3.0-1) did not exhibit this problem.


The following is a reproducible test case. Simply save the following program to main.cpp.

--------------------------------
#include <string>

#include <cstdio>
#include <cstdlib>

int main(int argc, char *argv[])
{
std::string blah("Hello world!");
printf("%s\n", blah.c_str());
return EXIT_SUCCESS;
}
--------------------------------

Then, run the following to compile and test:

--------------------------------
i686-w64-mingw32-g++ main.cpp
cp /usr/i686-w64-mingw32/bin/lib{gcc_s_sjlj-1,stdc++-6,winpthread-1}.dll .
wine a.exe
--------------------------------
This task depends upon

Closed by  Jonathan Roemer (pid1)
Monday, 12 September 2016, 21:26 GMT
Reason for closing:  Not a bug
Comment by Marius (Martchus) - Sunday, 31 July 2016, 18:09 GMT
I can reproduce it. Only i686 is affected.
Might have the same cause as: https://bugs.archlinux.org/task/49334?project=5&string=mingw-w64-binutils

BTW: You can use WINEPATH=/usr/i686-w64-mingw32/bin wine a.exe for testing without the need of copying the DLLs.
Comment by Michel (xantares) - Sunday, 11 September 2016, 15:38 GMT
it shouldnt even compile, this behavior seems to be fixed with 6.2.1 which fails at compilation time without -lstdc++:
/tmp/ccZOQVVq.o:main2.cxx:(.text+0x40): undefined reference to `__gxx_personality_sj0'
/tmp/ccZOQVVq.o:main2.cxx:(.text+0x74): undefined reference to `std::allocator<char>::allocator()'
/tmp/ccZOQVVq.o:main2.cxx:(.text+0x93): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/tmp/ccZOQVVq.o:main2.cxx:(.text+0xa0): undefined reference to `std::allocator<char>::~allocator()'
/tmp/ccZOQVVq.o:main2.cxx:(.text+0xaa): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::c_str() const'
/tmp/ccZOQVVq.o:main2.cxx:(.text+0xcb): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccZOQVVq.o:main2.cxx:(.text+0xe6): undefined reference to `std::allocator<char>::~allocator()'

but fine with:

$ i686-w64-mingw32-gcc ~/main2.cxx -lstdc++
$ i686-w64-mingw32-wine a.exe
Hello world!

Loading...