-
Notifications
You must be signed in to change notification settings - Fork 3
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
Transition to pre-built binaries for common platforms #1
base: main
Are you sure you want to change the base?
Conversation
ed00647
to
15bdfad
Compare
Dropping some useful resources on how rust builds static libraries in here: |
Before: -rwxrwxr-x 2 lima lima 195M Dec 1 23:43 libvrl_bridge.so $ bloaty target/release/libvrl_bridge.so FILE SIZE VM SIZE -------------- -------------- 24.5% 47.7Mi 0.0% 0 .debug_info 21.6% 42.0Mi 0.0% 0 .debug_loc 12.2% 23.7Mi 0.0% 0 .debug_ranges 10.4% 20.2Mi 0.0% 0 .debug_str 9.9% 19.2Mi 0.0% 0 .debug_pubtypes 9.0% 17.4Mi 0.0% 0 .debug_pubnames 4.8% 9.27Mi 0.0% 0 .debug_line 2.2% 4.35Mi 44.9% 4.35Mi .text 0.9% 1.83Mi 0.0% 0 .strtab 0.9% 1.67Mi 0.0% 0 .symtab 0.8% 1.52Mi 15.7% 1.52Mi .data.rel.ro 0.7% 1.44Mi 14.9% 1.44Mi .rodata 0.7% 1.39Mi 14.3% 1.39Mi .rela.dyn 0.4% 800Ki 0.0% 0 .debug_aranges 0.4% 747Ki 0.0% 0 .debug_abbrev 0.3% 616Ki 6.2% 616Ki .eh_frame 0.1% 258Ki 2.6% 258Ki .gcc_except_table 0.1% 107Ki 1.1% 107Ki .eh_frame_hdr 0.0% 20.6Ki 0.2% 20.6Ki .data 0.0% 10.8Ki 0.1% 12.3Ki [23 Others] 0.0% 2.50Ki 0.0% 0 [ELF Section Headers] 100.0% 194Mi 100.0% 9.69Mi TOTAL After: -rwxrwxr-x 2 lima lima 47M Dec 1 23:57 libvrl_bridge.so $ bloaty target/release/libvrl_bridge.so FILE SIZE VM SIZE -------------- -------------- 37.9% 17.7Mi 0.0% 0 .debug_info 9.3% 4.35Mi 44.9% 4.35Mi .text 8.8% 4.12Mi 0.0% 0 .debug_loc 6.0% 2.80Mi 0.0% 0 .debug_str 5.9% 2.77Mi 0.0% 0 .debug_pubnames 5.3% 2.49Mi 0.0% 0 .debug_pubtypes 5.0% 2.34Mi 0.0% 0 .debug_line 3.9% 1.83Mi 0.0% 0 .strtab 3.6% 1.67Mi 0.0% 0 .symtab 3.2% 1.52Mi 15.7% 1.52Mi .data.rel.ro 3.1% 1.44Mi 14.9% 1.44Mi .rodata 3.0% 1.39Mi 14.3% 1.39Mi .rela.dyn 2.4% 1.10Mi 0.0% 0 .debug_ranges 1.3% 616Ki 6.2% 616Ki .eh_frame 0.5% 258Ki 2.6% 258Ki .gcc_except_table 0.3% 127Ki 0.0% 0 .debug_abbrev 0.2% 119Ki 0.0% 0 .debug_aranges 0.2% 107Ki 1.1% 107Ki .eh_frame_hdr 0.0% 20.6Ki 0.2% 20.6Ki .data 0.0% 10.6Ki 0.1% 12.3Ki [23 Others] 0.0% 2.50Ki 0.0% 0 [ELF Section Headers] 100.0% 46.8Mi 100.0% 9.69Mi TOTAL Source/Inspiration: benesch/materialize@a618135 `bloaty` refers to this tool https://github.com/google/bloaty
Before: $ bloaty target/release/libvrl_bridge.so FILE SIZE VM SIZE -------------- -------------- 37.9% 17.7Mi 0.0% 0 .debug_info 9.3% 4.35Mi 44.9% 4.35Mi .text 8.8% 4.12Mi 0.0% 0 .debug_loc 6.0% 2.80Mi 0.0% 0 .debug_str 5.9% 2.77Mi 0.0% 0 .debug_pubnames 5.3% 2.49Mi 0.0% 0 .debug_pubtypes 5.0% 2.34Mi 0.0% 0 .debug_line 3.9% 1.83Mi 0.0% 0 .strtab 3.6% 1.67Mi 0.0% 0 .symtab 3.2% 1.52Mi 15.7% 1.52Mi .data.rel.ro 3.1% 1.44Mi 14.9% 1.44Mi .rodata 3.0% 1.39Mi 14.3% 1.39Mi .rela.dyn 2.4% 1.10Mi 0.0% 0 .debug_ranges 1.3% 616Ki 6.2% 616Ki .eh_frame 0.5% 258Ki 2.6% 258Ki .gcc_except_table 0.3% 127Ki 0.0% 0 .debug_abbrev 0.2% 119Ki 0.0% 0 .debug_aranges 0.2% 107Ki 1.1% 107Ki .eh_frame_hdr 0.0% 20.6Ki 0.2% 20.6Ki .data 0.0% 10.6Ki 0.1% 12.3Ki [23 Others] 0.0% 2.50Ki 0.0% 0 [ELF Section Headers] 100.0% 46.8Mi 100.0% 9.69Mi TOTAL After: $ bloaty ./target/release/libvrl_bridge.so FILE SIZE VM SIZE -------------- -------------- 20.7% 5.51Mi 0.0% 0 .debug_info 16.3% 4.33Mi 44.8% 4.33Mi .text 9.4% 2.50Mi 0.0% 0 .debug_str 8.5% 2.27Mi 0.0% 0 .debug_line 7.7% 2.06Mi 0.0% 0 .debug_pubnames 6.9% 1.84Mi 0.0% 0 .strtab 6.2% 1.64Mi 0.0% 0 .symtab 5.7% 1.52Mi 15.7% 1.52Mi .data.rel.ro 5.4% 1.44Mi 15.0% 1.44Mi .rodata 5.2% 1.38Mi 14.3% 1.38Mi .rela.dyn 3.3% 911Ki 0.0% 0 .debug_ranges 2.2% 609Ki 6.2% 609Ki .eh_frame 0.9% 256Ki 2.6% 256Ki .gcc_except_table 0.4% 111Ki 0.0% 0 .debug_aranges 0.4% 105Ki 1.1% 105Ki .eh_frame_hdr 0.4% 98.4Ki 0.0% 0 .debug_loc 0.1% 28.0Ki 0.0% 0 .debug_abbrev 0.1% 20.6Ki 0.2% 20.6Ki .data 0.0% 12.4Ki 0.1% 12.3Ki [23 Others] 0.0% 6.12Ki 0.0% 0 .debug_pubtypes 0.0% 2.50Ki 0.0% 0 [ELF Section Headers] 100.0% 26.6Mi 100.0% 9.66Mi TOTAL Sources: https://doc.rust-lang.org/cargo/reference/profiles.html#debug benesch/materialize@a618135
Going to leave this in draft as I don't want to merge this and pollute the main git repo with these blobs. I'd like to take a similar approach to wasmtime-go and generate orphan commits for each "release" which will allow users to |
8d5ede7
to
5d7124b
Compare
This project has a usability problem currently where anyone
go get
ing this module will fetch only the code and the requisitecargo build
step will be missed.This PR takes inspiration from https://github.com/rogchap/v8go/ and adds pre-built shared libraries (currently) for arm64 darwin and linux platforms.
Out-of-the-box, cargo builds on linux were hilariously huge (see 2d46f2b and f1dc406) for more details, so some tricks from MaterializeInc/materialize#2691 were used to get this down to a reasonable size.
TODO:
go get
works as expected