On 3/5/23 9:09 PM, ryuukk_ wrote:
On Monday, 6 March 2023 at 02:00:16 UTC, Mike Parker wrote:

This is not dub's fault. When building a shared library, there's a link step, so any external dependencies are linked into the shared library just as they are with an executable. There is no link step with a static library. That means when you build your executable, you need to also link the static library's dependencies along with it.

Most of the symbols in your list appear to come from the packages listed in the dependencies section of DCD's dub.json:

https://github.com/dlang-community/DCD/blob/master/dub.json

So if you want to do this manually, with DCD as a static library, then you also need to build all of those dependencies and link them with your executable.


Well, you can create a library that contains all the static libraries, you just can't use dub to do it for you automatically, or even manually (dub ignores `.a` files when specified as source files).

dub should build a static library for the project i build, that includes each library it uses that are referenced as "library" since the default is "staticLibrary" according to rikki


Dub expects to have dub-built artifacts available to link. This problem only occurs if you are building outside of dub, without proper dependency management.

Dub indeed does not play nice with exporting artifacts for other build systems. It's something that should be addressed.

Keep in mind though, that you still need to specify any shared library dependencies, since static libs cannot contain shared libraries or automatic references to them.

-Steve
  • How to build a s... ryuukk_ via Digitalmars-d-learn
    • Re: How to ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: How... ryuukk_ via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... ryuukk_ via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
        • Re:... Mike Parker via Digitalmars-d-learn
          • ... ryuukk_ via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
            • ... Steven Schveighoffer via Digitalmars-d-learn
            • ... Mike Parker via Digitalmars-d-learn
              • ... Hipreme via Digitalmars-d-learn
      • Re: How... ryuukk_ via Digitalmars-d-learn
    • Re: How to ... Ruby The Roobster via Digitalmars-d-learn

Reply via email to