Help us understand the problem. What is going on with this article?

[MinGW] Link pthread statically [Ubuntu]

More than 5 years have passed since last update.

※MinGWアプリがlibwinpthread-1.dllを要求するのを(-staticせずに)防ぐには以下のスクリプトを実行します。※

In the latest, the very basic programs not-using threads are also linked to pthread. The worse is the library is libpthread.dll.a in default, which requires libwinpthread-1.dll runtime.

Therefore, linking pthread statically is preferred. You can use -static of course, but I still wanted to use msvcrt.dll as C runtime.

I use the Ubuntu package of MinGW. So, to prevent dynamic library, I have done the following:

#!/bin/bash
for dir in i686-w64-mingw32 x86_64-w64-mingw32; do 
mv /usr/${dir}/lib/libpthread.dll.a{,_}
mv /usr/${dir}/lib/libwinpthread.dll.a{,_}
mv /usr/${dir}/lib/libwinpthread-1.dll{,_}
done
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした