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

feat(c-api) Reduce the number of dependencies by statically compiling CRT #2140

Merged
merged 1 commit into from
Feb 26, 2021

Conversation

Hywan
Copy link
Contributor

@Hywan Hywan commented Feb 25, 2021

Description

This patch adds the -Ctarget-feature=+crt-static flag when compiling
libwasmer on Windows. The goal is twofold: Reducing the number of
dependencies, and improving the portability of libwasmer.dll on more
Windows instances.

Before:

$ objdump --all-headers wasmer.dll | rg 'DLL Name'
    DLL Name: bcrypt.dll
    DLL Name: ADVAPI32.dll
    DLL Name: KERNEL32.dll
    DLL Name: VCRUNTIME140.dll
    DLL Name: api-ms-win-crt-heap-l1-1-0.dll
    DLL Name: api-ms-win-crt-runtime-l1-1-0.dll
    DLL Name: api-ms-win-crt-math-l1-1-0.dll
    DLL Name: api-ms-win-crt-string-l1-1-0.dll

After:

$ objdump --all-headers wasmer.dll | rg 'DLL Name'
    DLL Name: bcrypt.dll
    DLL Name: ADVAPI32.dll
    DLL Name: KERNEL32.dll

Review

  • Add a short description of the the change to the CHANGELOG.md file

@Hywan
Copy link
Contributor Author

Hywan commented Feb 25, 2021

bors try

bors bot added a commit that referenced this pull request Feb 25, 2021
@Hywan Hywan self-assigned this Feb 25, 2021
@Hywan Hywan added 🎉 enhancement New feature! 📦 lib-c-api About wasmer-c-api 🖼️ platform-windows This issue happens on Windows labels Feb 25, 2021
@bors
Copy link
Contributor

bors bot commented Feb 25, 2021

… CRT.

This patch adds the `-Ctarget-feature=+crt-static` flag when compiling
`libwasmer` on Windows. The goal is twofold: Reducing the number of
dependencies, and improving the portability of `libwasmer.dll` on more
Windows instances.

Before:

```sh
$ objdump --all-headers wasmer.dll | rg 'DLL Name'
    DLL Name: bcrypt.dll
    DLL Name: ADVAPI32.dll
    DLL Name: KERNEL32.dll
    DLL Name: VCRUNTIME140.dll
    DLL Name: api-ms-win-crt-heap-l1-1-0.dll
    DLL Name: api-ms-win-crt-runtime-l1-1-0.dll
    DLL Name: api-ms-win-crt-math-l1-1-0.dll
    DLL Name: api-ms-win-crt-string-l1-1-0.dll
```

After:

```sh
$ objdump --all-headers wasmer.dll | rg 'DLL Name'
    DLL Name: bcrypt.dll
    DLL Name: ADVAPI32.dll
    DLL Name: KERNEL32.dll
```
@Hywan Hywan force-pushed the feat-c-api-windows-crt-static branch from bafab27 to 965aa53 Compare February 25, 2021 13:15
Hywan added a commit to wasmerio/wasmer-go that referenced this pull request Feb 25, 2021
@syrusakbary
Copy link
Member

How big are the sizes before vs after?

@Hywan
Copy link
Contributor Author

Hywan commented Feb 26, 2021

It adds <0.1Mb.

@Hywan
Copy link
Contributor Author

Hywan commented Feb 26, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Feb 26, 2021

@bors bors bot merged commit 3dc537c into wasmerio:master Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature! 📦 lib-c-api About wasmer-c-api 🖼️ platform-windows This issue happens on Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants