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

dwarf::format_error when running rust program #193

Open
appetrosyan opened this issue Jan 19, 2022 · 9 comments
Open

dwarf::format_error when running rust program #193

appetrosyan opened this issue Jan 19, 2022 · 9 comments

Comments

@appetrosyan
Copy link

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
@bjorn3
Copy link

bjorn3 commented Jan 19, 2022

Probably a duplicate of #107. According to #107 (comment) passing -C link-arg=-gdwarf-3 to rustc may work.

@antoyo
Copy link

antoyo commented Mar 9, 2022

I added partial support for Dwarfv5 in my libelfin fork and that seems to fix this issue.

@PSeitz
Copy link

PSeitz commented Jun 1, 2022

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

@flber
Copy link

flber commented Jan 29, 2023

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!

@matheus-consoli
Copy link

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

@Alizter
Copy link

Alizter commented Nov 16, 2023

Is there something that can be done within coz about this? I'm running into similar issues and my setup is not rust specific.

@ysfess22
Copy link

ysfess22 commented Mar 5, 2024

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?

@Alizter
Copy link

Alizter commented Mar 5, 2024

@ysfess22 No unfortunately not.

@camelid
Copy link
Contributor

camelid commented Mar 13, 2024

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?

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

No branches or pull requests

9 participants