Static linking with libwinpthread

前端 未结 3 2049
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-14 19:42

I try to build program with static linked toolchain libraries. I pass:

LDFLAGS=\"-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic -static-libgcc -static-libstdc++\"
         


        
3条回答
  •  名媛妹妹
    2021-02-14 20:24

    Try this:

    -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
    

    Notice the -lstdc++ before -lpthread. It worked for me.

    Make sure to add this to the very end of your g++ command line.

提交回复
热议问题