'libwinpthread-1.dll'에 해당되는 글 1건

  1. 2016.04.28 libwinpthread 가 계속 동적 빌드만 될 때

환경: QtCreator3.4.2 / mingw4.9.2 / Qt 4.8.6 static


QThread 를 사용하고 정적 빌드를 하려니 libwinpthread 에 대한 의존성이 생겼나보다.


구글링을 해보니


http://stackoverflow.com/questions/13768515/how-to-do-static-linking-of-libwinpthread-1-dll-in-mingw


요약) -static -lpthread 붙여라


이 답변을 확인하게 되었는데,

막상 위 옵션을 QtCreator의 빌드 옵션에서 컴파일러 옵션에 넣어봤는데 도무지 동작하지가 않았다.

위 링크가 또 다른 여러 곳에서 링크되어 있는 것으로 봐서는 아마도 맞는 답변이지 싶은데 말이다.


컴파일 로그를 살펴보니 다음과 같았다.


...

g++ -static-libgcc -static-libstdc++ -Wl,-s -Wl,-subsystem,windows -o release\sample.exe object_script.trainer.Release  -L"c:\Qt\4.8.6_static\lib" -lmingw32 -lqtmain -lQtXml -lQtGui -lQtNetwork -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32


어라..? 내가 추가 한 -static -lpthread가 보이지 않았다.


여러가지 찾아 보다 알아낸 결과는 아래와 같다.


*.pro 파일 내에 사용할 라이브러리를 추가 한다.

LIBS += -static -lwinpthread


나같은 경우 위와 같이 추가하고 빌드한 결과 컴파일 로그에 다음과 같이 추가된 것을 확인할 수 있었다.


g++ -static-libgcc -static-libstdc++ -Wl,-s -Wl,-subsystem,windows -o release\sample.exe object_script.trainer.Release -L"c:\Qt\4.8.6_static\lib" -lmingw32 -lqtmain -static -lwinpthread -lQtXml -lQtGui -lQtNetwork -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32


release 시에만 추가하고 싶다면

release {

LIBS += -static -lwinpthread

}

요렇게 해주면 release 시에만 정적으로 추가하게 된다.

'QT' 카테고리의 다른 글

undefined reference to 'vtable for...'  (0) 2016.05.19
반투명 그릴 때 배경 잔상 문제  (0) 2016.05.11
디버깅 매크로  (0) 2016.04.19
QByteArray 의 reserve() vs resize()  (0) 2016.03.18
QT static build with mingw32  (0) 2015.09.17
Posted by 독뽀
,