-
Notifications
You must be signed in to change notification settings - Fork 0
update build script for lmbench #11
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align with the proposed build contract style from issue 10 here are my suggestions:
- Create a makefile that performs the make actions you need (
all
andclean
) - Set up the folder structure similar to this:
lmbench/
├── Makefile
├── compile_lmbench.sh
├── out/
│ ├── lat_syscall.cwasm
│ └── syscall.cwasm
└── sysroot_overlay/
├── include/
│ └── wasm32-wasi/
│ ├── netconfig.h
│ └── rpc/
│ ├── svc.h
│ └── clnt.h
└── lib/
└── wasm32-wasi/
└── libc.a
- Change the scripts to not modify the sysroot or files therein directly, but instead place them into the
sysroot_overlay
folder and allow the tooling script to manage merging. It will call themake all
and then handle merging the files into the appropriate places following the folder structure relative tosysroot
that you put in that folder (example above)
./autogen.sh | ||
fi | ||
|
||
export AR=/home/lind/lind-wasm/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin/llvm-ar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the script depends on several specific tools (clang, wasm-opt, wasmtime, and a specific SYSROOT), it might be a good idea to move all the path exports and environment variable setups to the top of the script using fallbacks like this:
export CLANG="${CLANG:-/home/lind/lind-wasm/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin/clang}"
export CXX="${CXX:-/home/lind/lind-wasm/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin/clang++}"
export AR="${AR:-/home/lind/lind-wasm/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin/llvm-ar}"
export LD="${LD:-/home/lind/lind-wasm/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin/wasm-ld}"
export RANLIB="${RANLIB:-/home/lind/lind-wasm/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin/llvm-ranlib}"
export WASM_OPT="${WASM_OPT:-/home/lind/lind-wasm/tools/binaryen/bin/wasm-opt}"
export WASMTIME="${WASMTIME:-/home/lind/lind-wasm/src/wasmtime/target/debug/wasmtime}"
export SYSROOT="${SYSROOT:-/home/lind/lind-wasm/src/glibc/sysroot}"
export CFLAGS="${CFLAGS:---sysroot=$SYSROOT -g -O2}"
export CXXFLAGS="${CXXFLAGS:---sysroot=$SYSROOT -g -O2}"
export LDFLAGS="${LDFLAGS:---sysroot=$SYSROOT -Wl,--import-memory,--export-memory,--max-memory=67108864,--export=__stack_pointer,--export=__stack_low}"
This way you could modify them at the time you call the compile without having to edit the script, like this:
WASMTIME=$HOME/.cargo/bin/wasmtime ./compile_lmbench.sh
And if you later want to move it to the Makefile to adhere to the build contract style we talked about in Issue 10
@m-hemmings so basically we have to build libtirpc.a with wasm-clang, then combine that lib with the sysroot into a new sysroot and then build lmbench. lmbench should build somewhat properly on it's own once that sysroot is created and has its own Makefile/output folder for binaries once that step is completed. |
|
||
echo "[INFO] Moving .o files to sysroot merge_tmp..." | ||
|
||
mkdir -p /home/lind/lind-wasm/src/glibc/sysroot/lib/wasm32-wasi/merge_tmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m-hemmings this is where the sysroot stuff comes into play, I like your overlay idea but i'm not sure runbin and I completely understand it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rennergade The idea should be that the app does all it needs to in its own context and then the tooling script moves what needs to be moved. So I wonder, could this merge be done in the app's own folders and then have the merged file be placed in the sysroot_overlay folder with the same folder structure it would need if it went to sysroot? or is it required that it be done in situ in the actual sysroot?
The original idea was that the app would not modify the actual sysroot at all, but we can revisit that if it doesn't fit
#!/bin/bash | ||
set +e | ||
|
||
CLANG="/home/lind/lind-wasm/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin/clang" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robinyuan1002 can we not call the lmbench Makefile to build it? not the toplevel one but the one in src?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we can, but I think I can create a new Makefile just for compiling tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the one provided works why would we want to add a different one?
If we want to create a new Makefile should we delete the old one in the lmbench directory? |
There are mainly three scripts. One bootstrap for libtirpc, one bootstrap for lmbench and a shell script for compiling lmbench tests.