Open ghuls opened 3 years ago
Hi! You're right about jemalloc being an issue here. You can build without it by disabling the use_jemalloc
feature, e.g.
cargo +nightly build --release --target=x86_64-unknown-linux-musl --no-default-features --features llvm_backend,allow_avx2,unstable
But then I still get an error:
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-nostartfiles" "/progs/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crt1.o" "/progs/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "-L" "/progs/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/progs/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "/progs/CS/frawk/target/x86_64-unknown-linux-musl/release/deps/frawk-66d2e7b426f4103a.frawk.cco9e2id-cgu.9.rcgu.o" "-o" "/progs/CS/frawk/target/x86_64-unknown-linux-musl/release/deps/frawk-66d2e7b426f4103a" "-Wl,--gc-sections" "-static" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/progs/CS/frawk/target/x86_64-unknown-linux-musl/release/deps" "-L" "/progs/CS/frawk/target/release/deps" "-L" "/progs/CS/frawk/target/x86_64-unknown-linux-musl/release/build/llvm-sys-f31ce61b9e2cd240/out" "-L" "/usr/lib/llvm-10/lib" "-L" "/progs/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/tmp/rustcNgNZyn/libllvm_sys-32164792252f4b95.rlib" "-Wl,--start-group" "/tmp/rustcNgNZyn/libunwind-94c746280016be9c.rlib" "/tmp/rustcNgNZyn/liblibc-a6df7fa84d406b53.rlib" "-Wl,--end-group" "/progs/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-a256d4446bd09d00.rlib" "-Wl,-Bdynamic" "-lz" "-lrt" "-ldl" "-ltinfo" "-lpthread" "-lm" "-lstdc++" "-rdynamic" "/progs/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: /usr/bin/ld: /tmp/rustcNgNZyn/libllvm_sys-32164792252f4b95.rlib(Process.cpp.o): undefined reference to symbol mallinfo@@GLIBC_2.2.5
//lib/x86_64-linux-gnu/libc.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
It's hard for me to interpret exactly what's going on, but it sounds to me that llvm-sys
is pulling in a dependency on glibc even when using the musl target. Looking around online and it sounds like llvm might build with a glibc dependency by default (though it might be possible to build it yourself against musl).
Anyways, I wonder if disabling jemalloc moves the needle for you at all re: libc on the other cluster. If not, I can try building LLVM from source (!) and see if that fixes the issue; though that's not something I'd like to force users to do.
In the medium term, I am looking at adding an easier-to-deploy JIT backend to frawk in the next few weeks with performance between the bytecode interpreter (which I haven't optimized much at all, and I suspect isn't going to do as well as mawk or gawk on many tasks) and LLVM.
Just a quick update. I was able to build without LLVM but with the new Cranelift backend using musl.
cargo +nightly build --release --target=x86_64-unknown-linux-musl --no-default-features --features allow_avx2,unstable
You can check out the updated benchmarks document for a feel of frawk's relative performance with cranelift and llvm that I've seen on different workloads.
With Cranelift I was able to build frawk on the server (did it without musl for now).
The mallinfo
dependency seems to come from LLVM's Process::GetMallocUsage()
API, with perhaps buggy cross-build detection for HAVE_MALLINFO
. Musl doesn't have mallinfo
, but your system glibc (apparently) did.
Is it possilbe to build frawk with musl?
cargo +nightly build --release --target x86_64-unknown-linux-musl
I always run in to problems with jemalloc.
I just want to have a static version so I can run
frawk
on a cluster on which I can't install LLVM. It has an older version of glibc than my laptop, so the default build won't work.