The solution, which helped me was to add flags
-static-libstdc++ -static-libgcc
to compiler. That is to link libstdc++ statically, and it works for me