Skip to content

include/node/openssl/archs/ has ~50MB of (I hope?) unused headers #46451

Description

@asottile

it looks like the prebuilt builds contain openssl headers for each architecture, even though they are only built for one -- potentially saving ~50MB ish:

$ du -hs node-v18.13.0-linux-x64/include/node/openssl/archs/*
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/aix64-gcc-as
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/BSD-x86
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/BSD-x86_64
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/darwin64-arm64-cc
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/darwin64-x86_64-cc
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/darwin-i386-cc
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/linux32-s390x
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/linux64-mips64
936K	node-v18.13.0-linux-x64/include/node/openssl/archs/linux64-riscv64
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/linux64-s390x
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/linux-aarch64
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/linux-armv4
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/linux-elf
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/linux-ppc64le
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/linux-x86_64
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/solaris64-x86_64-gcc
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/solaris-x86-gcc
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/VC-WIN32
2.8M	node-v18.13.0-linux-x64/include/node/openssl/archs/VC-WIN64A
936K	node-v18.13.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM

Activity

  1. UlisesGascon commented on Jan 31, 2023

    @UlisesGascon
    Member

    Thanks for the suggestion @asottile. I believe this issue will be more relevant in nodejs/node. I don't have the capabilities to transfer it, but I hope other colleagues in the @nodejs/build can do it :)

  2. transferred this issue fromnodejs/buildon Jan 31, 2023
  3. mhdawson commented on Jan 31, 2023

    @mhdawson
    Member

    @UlisesGascon transferred

  4. mhdawson commented on Jan 31, 2023

    @mhdawson
    Member

    @asottile is that the same case for 14.x builds as well? Just wondering if you know if this is new since our OpenSSL 3 integration or its always been that way.

  5. asottile commented on Jan 31, 2023

    @asottile
    Author

    looks like 14.x has the same issue -- but it is much less pronounced there:

    $ ls -d node-v14.19.3-linux-x64/include/node/openssl/archs/*
    node-v14.19.3-linux-x64/include/node/openssl/archs/aix64-gcc
    node-v14.19.3-linux-x64/include/node/openssl/archs/aix-gcc
    node-v14.19.3-linux-x64/include/node/openssl/archs/BSD-x86
    node-v14.19.3-linux-x64/include/node/openssl/archs/BSD-x86_64
    node-v14.19.3-linux-x64/include/node/openssl/archs/darwin64-arm64-cc
    node-v14.19.3-linux-x64/include/node/openssl/archs/darwin64-x86_64-cc
    node-v14.19.3-linux-x64/include/node/openssl/archs/darwin-i386-cc
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux32-s390x
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux64-mips64
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux64-s390x
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux-aarch64
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux-armv4
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux-elf
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux-ppc
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux-ppc64
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux-ppc64le
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux-x32
    node-v14.19.3-linux-x64/include/node/openssl/archs/linux-x86_64
    node-v14.19.3-linux-x64/include/node/openssl/archs/solaris64-x86_64-gcc
    node-v14.19.3-linux-x64/include/node/openssl/archs/solaris-x86-gcc
    node-v14.19.3-linux-x64/include/node/openssl/archs/VC-WIN32
    node-v14.19.3-linux-x64/include/node/openssl/archs/VC-WIN64A
    node-v14.19.3-linux-x64/include/node/openssl/archs/VC-WIN64-ARM
  6. mhdawson commented on Jan 31, 2023

    @mhdawson
    Member

    @asottile thanks for the quick response, the headers are larger in OpenSSL 3 so it might make more sense to prune now than before.

  7. richardlau commented on Jan 31, 2023

    @richardlau
    Member
  8. added
    opensslIssues and PRs related to the OpenSSL dependency.
    on Jan 31, 2023
  9. mhdawson commented on Jan 31, 2023

    @mhdawson
    Member

    @richardlau I think the deduplication attempted before might be a bit different. In the headers tarball I think we need headers for all supported platforms but in the tar for a specific architecture/os it may be ok to just have the one for that architecture/os

  10. bnoordhuis commented on Feb 1, 2023

    @bnoordhuis
    Member

    In the headers tarball I think we need headers for all supported platforms

    I touched on it earlier this week in #46401 but many files in deps/openssl/config/archs/*/no-asm are duplicates. I count 1018 files but only 183 unique files.

    My shell-fu says we can shave off 16,068,792 bytes just by deduping those, more if the linked PR lands.

  11. andymac4182 commented on May 16, 2023

    @andymac4182

    Is there any reason these files can't be deleted completely for a slimmed down runtime only production image?

    Is there anything that can be done to help move this work along?

  12. bnoordhuis commented on May 17, 2023

    @bnoordhuis
    Member

    Yes: send pull requests. This is basically waiting for someone to do the work.

  13. andymac4182 commented on May 17, 2023

    @andymac4182

    I will be honest I am not 100% over what needs to happen. If you can give me a 2 second summary I will go through the code and write up what I think I need to do then do it :)

  14. jbergstroem commented on May 17, 2023

    @jbergstroem
    Member

    @andymac4182 the prior work, related issue and revert is a bit higher up in this thread. You probabaly want to stand on top of that should you work towards a new PR! #46451 (comment)

  15. andymac4182 commented on May 17, 2023

    @andymac4182

    Thanks. I will give it a read over 👍

  16. SimenB commented on Nov 14, 2023

    @SimenB
    Member

    FWIW, nodejs/docker-node#1923 has landed

  17. LaurentGoderre commented on Nov 14, 2023

    @LaurentGoderre
    Member

    We might need to do it for slim and alpine as well

  18. github-actions commented on Jun 22, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 210 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  19. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jun 22, 2026
  20. github-actions commented on Jul 23, 2026

    @github-actions
    Contributor

    This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
    If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    opensslIssues and PRs related to the OpenSSL dependency.questionIssues asking questions about Node.js.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions