Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closure of ldc-built programs is too large #324306

Open
CyberShadow opened this issue Jul 3, 2024 · 1 comment
Open

Closure of ldc-built programs is too large #324306

CyberShadow opened this issue Jul 3, 2024 · 1 comment
Labels
0.kind: bug Something is broken

Comments

@CyberShadow
Copy link
Contributor

CyberShadow commented Jul 3, 2024

Describe the bug

{ lib, writeText, stdenv, ldc }:
stdenv.mkDerivation {
  name = "ldc-test";
  src = writeText "test.d" ''
    module test;
    import std.stdio;
    void main() {
      writeln("Hello, world!");
    }
  '';
  dontUnpack = true;
  buildInputs = [ ldc ];
  buildPhase = ''
    ldc2 -of=test $src
  '';
  installPhase = ''
    mkdir -p $out/bin
    mv test $out/bin
  '';
}

Building and getting the closure size gives us a number around 1.3 GiB:

$ nix --extra-experimental-features nix-command path-info -S $(nix-build --no-out-link -E '(import <nixpkgs> {}).callPackage ./package.nix {}')
/nix/store/fqlm6ailjq09shqrgrbhf4ll391n5mx8-ldc-test	 1395772728

Graph:

out

It looks like there are some things there which might not need to be there, such as:

  • the bootstrap LDC
  • LLVM
  • considering that the test program was compiled with neither debug information nor is dynamically linked to Phobos, LDC itself

Notify maintainers

CC @ThomasMader @lionello @jtbx

Metadata

  • system: "x86_64-linux"
  • host os: Linux 6.6.34, NixOS, 24.11 (Vicuna), 24.11pre641786.d603719ec6e2
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.18.2
  • nixpkgs: /nix/store/ksj02zhy7qc4dmqi8g2ga8p9hj5173dv-nixpkgs-patched

Add a 👍 reaction to issues you find important.

@lionello
Copy link
Contributor

lionello commented Jul 4, 2024

Also see #111475 "dmd keeps references to boostrap compiler" and PR #111525 which had fixes for dmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants