Comments (9)
Sounds like you two have different goals.
Linking everything statically into your programs
If this is what you want, you can use the official binaries and don't have to build a toolchain yourself. Pass -static
option to the linker when you link your programs, and you will get self-contained binaries. (Some people suggest -static-libgcc -static-libstdc++
but it doesn't affect libwinpthread-1.dll
.)
You shouldn't build DLLs this way, or you will end up with multiple instances of the same runtime components in a single process, which will bite you later.
Linking everything statically into gcc itself
If this is what you want, you need to build a toolchain yourself. Pass whatever option you want and also --static-gcc
to the build
script. This should create self-contained gcc.exe
, g++.exe
etc.
Toolchains built this way will still create binaries linking to libwinpthread-1.dll
and so on by default.
Please note that the above two are orthogonal. You can even choose both.
from mingw-builds.
I'd say this is by design.
If you don't want binaries built with gcc to depend on libwinpthread-1.dll, link everything statically or use win32 thread model.
from mingw-builds.
Do you have any example of a build where everything is linked statically? I was not able to make it work. Built tooling was failing during runtime on missing dll.
It required some patches in the scripts though so I might have made some mistake there. (was trying to build x86_64-13.2.0-static-release-posix-seh-msvcrt-rt_v11-rev0 configuration)
from mingw-builds.
Pass -static
to the linker, and you should get a self-contained executable.
from mingw-builds.
It didn't build. https://github.com/ugomancz/mingw-builds-binaries/actions/runs/8599000577/job/23560986589 Here is an example of the job.
from mingw-builds.
Wait, are you trying to link everything statically into gcc itself? That will be hard with little gain. Why do you want that?
from mingw-builds.
When the binaries are not running in an msys shell which would add the dll to PATH, the dll needs to be copied everywhere,
My use case is that I have another bin folder outside of the built mingw and I generate multiple binaries on multiple locations in workspace during runtime. So then there is quite a lot of copies of the dll.
from mingw-builds.
Linking everything statically into your programs
I guess the op needs just link only libwinpthread-1.dll
statically only, keeping others as-is?
from mingw-builds.
Linking shared libstdc++ with static winpthreads is probably not going to work. In that case they both should be linked statically.
from mingw-builds.
Related Issues (20)
- No gdb tui? HOT 4
- Invoking gcc via symlink does not work HOT 19
- Toolchain updates are breaking build versions that were built normally HOT 3
- Could not build sjlj posix ucrt mingw-builds from the develop branch ! HOT 33
- Fetching sources fails HOT 12
- Building with --mode=gcc-12.2.0 fails
- configure: error: cannot find output from flex; giving up HOT 1
- any way to chnage 'msvcrt' to 'ucrt' using script? HOT 3
- `ld` does not work with non-ASCII file path HOT 6
- Please update GNU Make to 4.4.1
- Building a toolchain for Windows 2000? HOT 4
- Do you have any interest in the mcf thread model? HOT 7
- Not found level for patch HOT 1
- localization of GCC HOT 28
- C preprocessor "/lib/cpp" fails sanity check HOT 3
- not all compiling message in native language
- Update expat to 2.6.2 HOT 1
- GitHub took down xz-utils HOT 1
- ar.exe: could not create temporary file whilst writing archive: no more archived files HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mingw-builds.