I try to build program with static linked toolchain libraries. I pass:
LDFLAGS=\"-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic -static-libgcc -static-libstdc++\"
Try this:
-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
Notice the -lstdc++ before -lpthread. It worked for me.
-lstdc++
-lpthread
Make sure to add this to the very end of your g++ command line.
g++