coz
coz copied to clipboard
`dwarf::format_error` when running rust program
I'm trying to add tracing-coz
to a program I'm working on. As specified in the docs, I'm building with CARGO_PROFILE_RELEASE_DEBUG=true
, but that causes the following error:
[libcoz.cpp:100] bootstrapping coz
[libcoz.cpp:128] Including MAIN, which is /mnt/Archive/Git/iroha/target/release/examples/million_accounts_genesis
terminate called after throwing an instance of 'dwarf::format_error'
what(): unknown compilation unit version 5
Probably a duplicate of https://github.com/plasma-umass/coz/issues/107. According to https://github.com/plasma-umass/coz/issues/107#issuecomment-1007702715 passing -C link-arg=-gdwarf-3
to rustc may work.
I added partial support for Dwarfv5 in my libelfin fork and that seems to fix this issue.
link-arg did not work for me, but using the libelfin fork
coz_async git:(master) ✗ RUSTFLAGS='-C link-arg=-gdwarf-3' cargo build --release
Finished release [optimized + debuginfo] target(s) in 0.01s
➜ coz_async git:(master) ✗ coz run --- ./target/release/coz_async
[libcoz.cpp:100] bootstrapping coz
[libcoz.cpp:128] Including MAIN, which is /home/pascal/LinuxData/Development/coz_async/target/release/coz_async
terminate called after throwing an instance of 'dwarf::format_error'
what(): unknown compilation unit version 5
after running make
in /path_to_libelfin/
LD_LIBRARY_PATH=/path_to_libelfin/dwarf coz run --- ./target/release/coz_async
[libcoz.cpp:100] bootstrapping coz
[libcoz.cpp:128] Including MAIN, which is /home/pascal/LinuxData/Development/coz_async/target/release/coz_async
[inspect.cpp:513] Ignoring DWARF format error when reading line table: unknown line number table version 5
[inspect.cpp:513] Ignoring DWARF format error when reading line table: unknown attribute form (DW_FORM)0x21
[inspect.cpp:513] Ignoring DWARF format error when reading line table: unknown attribute form (DW_FORM)0x1f
[inspect.cpp:513] Ignoring DWARF format error when reading line table: unknown line number table version 5
[inspect.cpp:509] Included source file /home/pascal/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/park/either.rs
I'm also having the same problem. The output of my program is
[libcoz.cpp:100] bootstrapping coz
[libcoz.cpp:128] Including MAIN, which is /home/benh/projects/pillar/target/release/pillar
terminate called after throwing an instance of 'dwarf::format_error'
what(): unknown compilation unit version 5
I've tried adding the compiler flags suggested by @bjorn3 to my .cargo/config.toml
file like so
[build]
rustflags = ["-C", "link-args=-gdwarf-3"]
which fails to fix the issue (and doesn't change the output).
I'm a little bit unsure about how I would use the other suggestions (libelfin?), so any clarification would be great!
Hi, I just stepped into this problem!
Just to add to the future readers, you have to tell rustc
to generate the specific dwarf version coz is trying to read, so in my case (and everyone in this thread, I guess), I had to pass dwarf-5
:
RUSTFLAGS="-C link-arg=gdwarf-5" coz run --- ./target/release/something
Is there something that can be done within coz about this? I'm running into similar issues and my setup is not rust specific.
Hi, @Alizter I'm running into the same error and my setup is not specific to rust either. Were you able to find a solution?
@ysfess22 No unfortunately not.
Hi @ysfess22 @Alizter do you happen to have a small test case that reproduces this error? Or could you provide more information about your setup?