Add build script to compile bash dynamically#93
Conversation
|
I am adding this PR to get started with compiling apps for dynamic loading. I have mentioned the steps followed to use the new 'dynamic loading' branch within lind-wasm. Also the steps to build bash dynamically was followed looking at the python build scripts from 'build_python' branch of lind-wasm-apps/. I am hitting an issue when I run both bash and python which is built for dynamic loading. @qianxichen233 |
| fi | ||
|
|
||
| BASE_SYSROOT="${BASE_SYSROOT:-$LIND_WASM_ROOT/build/sysroot}" | ||
| MERGED_SYSROOT="${APPS_MERGED:-$APPS_ROOT/build/sysroot_merged}" |
There was a problem hiding this comment.
this is a static build thing. is libc not dynamic now?
| fi | ||
|
|
||
| ############################################################################### | ||
| # 10. Install to Lind Filesystem |
There was a problem hiding this comment.
probably want to remove this since we'll have our own make install
|
As of now, the earlier error while running bash and python has been resolved. This was mainly because of the way in which paths was passed as argument to Lind-boot. For example, Now I hit a different error |
Description
This PR introduces a dynamic (shared) WebAssembly build script for Bash.
Key Changes
-fPICtoCFLAGSso all core objects and builtins are compiled for dynamic linking.-Wl,-pie,-Wl,--import-table,-Wl,--export-dynamic,-Wl,--experimental-pic).libdlSupport: Re-introduced-ldlin the final linker command to support loading shared objects at runtime.bashbinary (and.cwasmif available) directly into$LINDFS_ROOT/bin.Integration with
lind-wasmbranchdylink_impl_integrationThe latest
dylink_impl_integrationof lind-wasm is used. Steps followed are detailed below.Updated
lind-wasm/scripts/append_tls_relocs_export.shto use standardwasm2watandwat2wasmcommands instead of absolute paths.Tested
Test script
Tested with a simple test script
lind-wasm/lindfs/bash_tests/test.shCommand to run the test
sudo /home/lind/lind-wasm/src/lind-boot/target/debug/lind-boot --preload env=lib/libc.so bin/bash.wasm tests/bash/test.shThis causes the following error:
Previous run
Error
How it was resolved
This error got resolved when the first '/' was removed from the paths within lindfs. So
/lib/libc.sowas changed tolib/libc.so