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

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

Open
asottile opened this issue Jan 31, 2023 · 15 comments
Open

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

asottile opened this issue Jan 31, 2023 · 15 comments
Labels
openssl Issues and PRs related to the OpenSSL dependency. question Issues that look for answers.

Comments

@asottile
Copy link

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
@UlisesGascon UlisesGascon added the question Issues that look for answers. label Jan 31, 2023
@UlisesGascon
Copy link
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 :)

@mhdawson mhdawson transferred this issue from nodejs/build Jan 31, 2023
@mhdawson
Copy link
Member

@UlisesGascon transferred

@mhdawson
Copy link
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.

@asottile
Copy link
Author

asottile commented Jan 31, 2023

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

@mhdawson
Copy link
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.

@richardlau
Copy link
Member

richardlau commented Jan 31, 2023

@richardlau richardlau added the openssl Issues and PRs related to the OpenSSL dependency. label Jan 31, 2023
@mhdawson
Copy link
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

@bnoordhuis
Copy link
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.

@andymac4182
Copy link

andymac4182 commented May 16, 2023

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?

@bnoordhuis
Copy link
Member

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

@andymac4182
Copy link

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 :)

@jbergstroem
Copy link
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)

@andymac4182
Copy link

Thanks. I will give it a read over 👍

@SimenB
Copy link
Member

SimenB commented Nov 14, 2023

FWIW, nodejs/docker-node#1923 has landed

@LaurentGoderre
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openssl Issues and PRs related to the OpenSSL dependency. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

9 participants