FS#61487 - [emscripten] Five (!!!) copies of the same clang binary in package

Attached to Project: Community Packages
Opened by Sergey (versusvoid) - Monday, 21 January 2019, 09:44 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Wednesday, 17 April 2019, 14:59 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
> sha256sum /usr/lib/emscripten-fastcomp/clang{,++,-6.0,-cl,-cpp}
bd6258ae98afd395c5c53f004f03ec4d00c44228635f71875045a61231117241 /usr/lib/emscripten-fastcomp/clang
bd6258ae98afd395c5c53f004f03ec4d00c44228635f71875045a61231117241 /usr/lib/emscripten-fastcomp/clang++
bd6258ae98afd395c5c53f004f03ec4d00c44228635f71875045a61231117241 /usr/lib/emscripten-fastcomp/clang-6.0
bd6258ae98afd395c5c53f004f03ec4d00c44228635f71875045a61231117241 /usr/lib/emscripten-fastcomp/clang-cl
bd6258ae98afd395c5c53f004f03ec4d00c44228635f71875045a61231117241 /usr/lib/emscripten-fastcomp/clang-cpp
> ls -i /usr/lib/emscripten-fastcomp/clang{,++,-6.0,-cl,-cpp}
1981291 /usr/lib/emscripten-fastcomp/clang*
1981292 /usr/lib/emscripten-fastcomp/clang++*
1981293 /usr/lib/emscripten-fastcomp/clang-6.0*
1981295 /usr/lib/emscripten-fastcomp/clang-cl*
1981296 /usr/lib/emscripten-fastcomp/clang-cpp*

Additional info:
* package version: 1.38.24-1
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Wednesday, 17 April 2019, 14:59 GMT
Reason for closing:  Implemented
Additional comments about closing:  Can't improve it further now without spending more time on it than I have. I improved the situation considerably using symlinks. Would be even better using shared libraries but those don't want to work somehow. I took inspiration from the clang/llvm packages while trying to use shared libraries.
Comment by Eli Schwartz (eschwartz) - Monday, 21 January 2019, 14:31 GMT
This package is dreadful (what is upstream doing here???). Even if they had a good reason to totally not make token attempts to link to a system runtime, since it seems they've done extensive patches and basically forked both llvm and clang... it now builds a boatload of gigantic binaries with statically included libclang and libLLVM and we should really try to get it to use shared libraries.

Nearly the entire 900MB size of the package is in /usr/lib/emscripten-fastcomp/, which is 885M, and in context, the whole of extra/clang and extra/llvm6{,-libs} (minus static copies of libraries) is only 200MB. The actual binaries in /usr/bin are 4KB to 500KB stubs which load into the shared libLLVM-7.so and the clang libraries they use...
Comment by Eli Schwartz (eschwartz) - Monday, 21 January 2019, 15:08 GMT
Given the patching going on, it doesn't seem reasonable to even try building with system libclang/libLLVM, and I cannot find upstream bug reports asking for that either.

I'd investigate how the clang/llvm packages are built, and try to get emscripten to build private copies of patched libclang/libLLVM, which the tools in /usr/lib/emscripten-fastcomp/ would then find via RPATH. Hopefully you won't need a degree in clang/llvm in order to properly build what is ultimately actually a full fork of both. ;)

If not, at least symlinking the identical binaries would result in dropping 256MB from the package. But there are still over 15 binaries (*not* counting the four 64MB copies of the clang binary) that are anywhere from 20MB to 40MB and likely loading most of the same content statically compiled in.
Comment by Sven-Hendrik Haase (Svenstaro) - Monday, 21 January 2019, 21:00 GMT
Using symlinks now. Will leave this open and investigate a bit more later.

Loading...