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

For production, build panacead with the static linking of wasmvm #249

Closed
youngjoon-lee opened this issue Dec 17, 2021 · 0 comments · Fixed by #250
Closed

For production, build panacead with the static linking of wasmvm #249

youngjoon-lee opened this issue Dec 17, 2021 · 0 comments · Fixed by #250
Assignees

Comments

@youngjoon-lee
Copy link
Contributor

youngjoon-lee commented Dec 17, 2021

Background

We have two ways to build the panacead. One is make build. The other is docker build .... Actually, the Dockerfile executes make build in the end.

Whether we run make build or docker build ..., the output binary (panacead) requires the libwasmvm.so (a shared library built by wasmvm).
If the libwasmvm.so is not installed in the LD_LIBRARY_PATH, the panacead cannot be executed:

$ ./panacead version
./panacead: error while loading shared libraries: libwasmvm.so: cannot open shared object file: No such file or directory

That's why all node operators must clone the github repo and run make build to get the panacead binary, instead of just downloading the binary from somewhere like Github release pages.

Instead of the dynamic linking, let's use the static linking. Fortunately, the wasmvm provides the libwasmvm_muslc.a.
But, note that it was built with muslc, not glibc.

What needs to be done

For make build, we don't need to anything. That is, it's okay for make build to generate a binary which requires libwasmvm.so.
In other words, we don't need to change the Makefile.

Instead, let's change the Dockerfile to generate a binary which links libwasmvm_muslc.a statically.
It means that we are going to upload the output binary to the release page on Github as an attachment, whenever we release a new version of panacead. It can make us use the Cosmovisor Auto-download.

As a reference, you can see the Dockerfile of the wasmd which is an example blockchain made by the CosmWasm team.

Also, it's okay to clean up the Dockerfile. Now, it's a bit complicated, but it can be simplified as the reference file that I mentioned above.

All history of this static linking topic can be found from: CosmWasm/wasmvm#45

Acceptance Criteria

  • The panacead built from Dockerfile can be executed on Linux where the libwasmvm.so isn't installed (not only Alpine, but also Ubuntu).
    • Test it on ASW EC2 Ubuntu instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants