On Friday, 9 August 2024 at 02:34:03 UTC, Denis Feklushkin wrote:
Are there simple way to make a static library that also includes necessary standard D libraries (i.e., phobos2 and druntime)?

Nope, you'd have to specify the path to the libs explicitly in the cmdline to merge them into the created static lib/archive, e.g., `ldc2 -lib bla.d $(dirname $(dirname $(which ldc2)))/lib/lib{druntime,phobos2}-ldc.a`.

Compiler already knows (?) paths to default static libs because it have --static option which produces static executable with all necessary libs inside. (Although I'm not sure that it works by this way)

Not really; the `-defaultlib` libraries need to be in one of the `lib-dirs` in ldc2.conf, it's the linker that resolves them.

Point is that D can be not a main language of the project and it is unconvient to extract by somehow paths to phobos and druntime at last stages of project build.

Would using the D compiler as linker driver be an option? Similar to how people can avoid explicitly linking GNU's libstdc++ / LLVM's libc++ by using `c++` instead of `cc` as linker driver, thereby not having to know which implementation of the C++ std library to choose for the particular platform.
  • Build fully stat... Denis Feklushkin via Digitalmars-d-learn
    • Re: Build f... Alex Bryan via Digitalmars-d-learn
      • Re: Bui... ryuukk_ via Digitalmars-d-learn
      • Re: Bui... Denis Feklushkin via Digitalmars-d-learn
        • Re:... ryuukk_ via Digitalmars-d-learn
          • ... Denis Feklushkin via Digitalmars-d-learn
    • Re: Build f... kinke via Digitalmars-d-learn
      • Re: Bui... Denis Feklushkin via Digitalmars-d-learn
        • Re:... kinke via Digitalmars-d-learn
          • ... Denis Feklushkin via Digitalmars-d-learn
            • ... kinke via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
                • ... Denis Feklushkin via Digitalmars-d-learn
                • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn

Reply via email to