Giter Club home page Giter Club logo

Comments (9)

starg2 avatar starg2 commented on June 18, 2024 1

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.

starg2 avatar starg2 commented on June 18, 2024

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.

wassupxP avatar wassupxP commented on June 18, 2024

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.

starg2 avatar starg2 commented on June 18, 2024

Pass -static to the linker, and you should get a self-contained executable.

from mingw-builds.

wassupxP avatar wassupxP commented on June 18, 2024

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.

starg2 avatar starg2 commented on June 18, 2024

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.

petkapou avatar petkapou commented on June 18, 2024

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.

SainoNamkho avatar SainoNamkho commented on June 18, 2024

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.

mati865 avatar mati865 commented on June 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.