mingw64-*-gcc-g++-4.9.2-1: Missing libatomic.a ?

Christian Franke Christian.Franke@t-online.de
Wed Jan 13 17:48:00 GMT 2016


The MinGW w64 g++ packages lack runtime support for std::atomic.

Testcase:

$ cat testatomic.cc
#include <atomic>

struct S { char a[10]; };

std::atomic<S> x;

int main()
{
   S y = {""};
   x = y;
   return 0;
}

$ cygcheck -f /usr/bin/x86_64-w64-mingw32-g++
mingw64-x86_64-gcc-g++-4.9.2-1

$ x86_64-w64-mingw32-g++ -std=c++11 -c testatomic.cc

$ x86_64-w64-mingw32-g++ -std=c++11 testatomic.o
testatomic.o:testatomic.cc:....: undefined reference to `__atomic_store'
collect2: error: ld returned 1 exit status

$ x86_64-w64-mingw32-g++ -std=c++11 testatomic.o -latomic
/usr/lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld: 
cannot find -latomic
collect2: error: ld returned 1 exit status

$ x86_64-w64-mingw32-nm /usr/lib/gcc/x86_64-w64-mingw32/4.9.2/*.a | grep 
atomic_store
[not found]

The above works with Cygwin g++.

Christian



More information about the Cygwin-apps mailing list