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

cargo kcov fails to compile project due to undefined references to Rust standard library #45

Open
Charles-Johnson opened this issue Feb 2, 2020 · 2 comments

Comments

@Charles-Johnson
Copy link

I had to run cargo kcov --target x86_64-unknown-linux-gnu to get my project to compile.

Just running cargo kcov lead to this error message:

In function `<alloc::vec::Vec<T> as core::iter::traits::collect::IntoIterator>::into_iter':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/liballoc/vec.rs:1940: undefined reference to `alloc::vec::Vec<T>::len'
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/liballoc/vec.rs:1938: undefined reference to `alloc::vec::Vec<T>::len'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.1nkl5tp0583g7sw6.rcgu.o: In function `<rand_xorshift::XorShiftRng as core::clone::Clone>::clone':
          /home/charles/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_xorshift-0.1.1/src/lib.rs:41: undefined reference to `<core::num::Wrapping<T> as core::clone::Clone>::clone'
          /home/charles/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_xorshift-0.1.1/src/lib.rs:42: undefined reference to `<core::num::Wrapping<T> as core::clone::Clone>::clone'
          /home/charles/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_xorshift-0.1.1/src/lib.rs:43: undefined reference to `<core::num::Wrapping<T> as core::clone::Clone>::clone'
          /home/charles/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_xorshift-0.1.1/src/lib.rs:44: undefined reference to `<core::num::Wrapping<T> as core::clone::Clone>::clone'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.2m9xanqapviggm8t.rcgu.o: In function `std::io::impls::<impl std::io::Read for &mut R>::initializer':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/io/impls.rs:25: undefined reference to `std::io::impls::<impl std::io::Read for &mut R>::initializer'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.2m9xanqapviggm8t.rcgu.o: In function `std::io::impls::<impl std::io::Write for &mut W>::write_all':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/io/impls.rs:62: undefined reference to `std::io::Write::write_all'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.2m9xanqapviggm8t.rcgu.o: In function `std::io::impls::<impl std::io::Write for &mut W>::write_fmt':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/io/impls.rs:67: undefined reference to `std::io::Write::write_fmt'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.4ej0vdkpbx0l4d8u.rcgu.o: In function `<zia::context_delta::ContextDelta as core::clone::Clone>::clone':
          /projects/zia_programming/zia/src/context_delta.rs:26: undefined reference to `<std::collections::hash::map::HashMap<K,V,S> as core::clone::Clone>::clone'
          /projects/zia_programming/zia/src/context_delta.rs:27: undefined reference to `<std::collections::hash::map::HashMap<K,V,S> as core::clone::Clone>::clone'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.4venyvz8qo51k4nr.rcgu.o: In function `<zia::context::Context as core::clone::Clone>::clone':
          /projects/zia_programming/zia/src/context.rs:35: undefined reference to `<slog::Logger<D> as core::clone::Clone>::clone'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.55hpn25rcjemvuiq.rcgu.o: In function `core::hash::impls::<impl core::hash::Hash for u64>::hash':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/hash/mod.rs:569: undefined reference to `core::hash::Hasher::write_u64'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.55jeerjxl6jnt9j6.rcgu.o: In function `core::sync::atomic::AtomicUsize::fetch_add':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/sync/atomic.rs:1595: undefined reference to `core::sync::atomic::atomic_add'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.5681govlce01diow.rcgu.o: In function `<rand_chacha::chacha::ChaChaRng as core::clone::Clone>::clone':
          /home/charles/.cargo/registry/src/github.com-1ecc6299db9ec823/rand_chacha-0.1.1/src/chacha.rs:70: undefined reference to `<rand_core::block::BlockRng<R> as core::clone::Clone>::clone'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.5bz8faxtferauokx.rcgu.o: In function `<zia::snap_shot::SnapShot as core::clone::Clone>::clone':
          /projects/zia_programming/zia/src/snap_shot.rs:36: undefined reference to `<std::collections::hash::map::HashMap<K,V,S> as core::clone::Clone>::clone'
          /projects/zia_programming/zia/src/snap_shot.rs:39: undefined reference to `<alloc::vec::Vec<T> as core::clone::Clone>::clone'
          /projects/zia_programming/zia/src/snap_shot.rs:41: undefined reference to `<alloc::vec::Vec<T> as core::clone::Clone>::clone'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.8enr4mvn86mljsk.rcgu.o: In function `std::io::append_to_string::{{closure}}':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/io/mod.rs:342: undefined reference to `std::io::error::Error::new'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.svlt29kd59ljmut.rcgu.o: In function `core::ptr::real_drop_in_place':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/ptr/mod.rs:182: undefined reference to `<alloc::sync::Arc<T> as core::ops::drop::Drop>::drop'
          /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3.ul37y8bes9frdud.rcgu.o: In function `proptest::test_runner::replay::Replay::parse_from':
          /home/charles/.cargo/registry/src/github.com-1ecc6299db9ec823/proptest-0.9.1/src/test_runner/replay.rs:150: undefined reference to `core::cmp::impls::<impl core::cmp::PartialEq<&B> for &A>::ne'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.16uajl7h30lyu5gd.rcgu.o): In function `core::ptr::real_drop_in_place':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/ptr/mod.rs:182: undefined reference to `<alloc::sync::Arc<T> as core::ops::drop::Drop>::drop'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.1qc11n1q2d0vnr7q.rcgu.o): In function `core::cell::Cell<T>::replace':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/cell.rs:392: undefined reference to `core::mem::replace'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.588zs75b4s4y6av4.rcgu.o): In function `zia::snap_shot::parse_line':
          /projects/zia_programming/zia/src/snap_shot.rs:927: undefined reference to `alloc::slice::<impl [T]>::to_vec'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.5cinhbg4xbjk98pv.rcgu.o): In function `<zia::delta::Change<T> as core::clone::Clone>::clone':
          /projects/zia_programming/zia/src/delta.rs:60: undefined reference to `<core::option::Option<T> as core::clone::Clone>::clone'
          /projects/zia_programming/zia/src/delta.rs:61: undefined reference to `<core::option::Option<T> as core::clone::Clone>::clone'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.esd11qlnzvo9v2i.rcgu.o): In function `<zia::concepts::abstract_part::AbstractPart as core::clone::Clone>::clone':
          /projects/zia_programming/zia/src/concepts/abstract_part.rs:26: undefined reference to `<core::option::Option<T> as core::clone::Clone>::clone'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.pucobp77zp316jy.rcgu.o): In function `<slog_term::PlainSyncRecordDecorator<W> as std::io::Write>::flush':
          /home/charles/.cargo/registry/src/github.com-1ecc6299db9ec823/slog-term-2.4.2/src/lib.rs:1133: undefined reference to `std::io::Write::write_all'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.pucobp77zp316jy.rcgu.o):(.data.rel.ro..Lanon.40a75397caec4a07118235d1562ec543.6+0x88): undefined reference to `slog::Serializer::emit_u128'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.pucobp77zp316jy.rcgu.o):(.data.rel.ro..Lanon.40a75397caec4a07118235d1562ec543.6+0x90): undefined reference to `slog::Serializer::emit_i128'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:993: undefined reference to `core::ptr::<impl *mut T>::copy_to_nonoverlapping'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:993: undefined reference to `core::ptr::<impl *mut T>::copy_to_nonoverlapping'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:993: undefined reference to `core::ptr::<impl *mut T>::copy_to_nonoverlapping'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:993: undefined reference to `core::ptr::<impl *mut T>::copy_to_nonoverlapping'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:993: undefined reference to `core::ptr::<impl *mut T>::copy_to_nonoverlapping'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone::{{closure}}':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::ops::range::RangeInclusive<Idx>::new'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::RangeInclusive<A>>::next'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone::{{closure}}':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::ops::range::RangeInclusive<Idx>::new'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::RangeInclusive<A>>::next'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone::{{closure}}':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::ops::range::RangeInclusive<Idx>::new'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::RangeInclusive<A>>::next'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone::{{closure}}':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::ops::range::RangeInclusive<Idx>::new'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::RangeInclusive<A>>::next'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.w98m9myuc3eko35.rcgu.o): In function `<hashbrown::raw::RawTable<T> as core::clone::Clone>::clone::{{closure}}':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::ops::range::RangeInclusive<Idx>::new'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/raw/mod.rs:1002: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::RangeInclusive<A>>::next'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.10wi6yhr47z2xn78.rcgu.o): In function `<zia::ast::SyntaxTree as core::clone::Clone>::clone':
          /projects/zia_programming/zia/src/ast/mod.rs:25: undefined reference to `<core::option::Option<T> as core::clone::Clone>::clone'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.32ad0cgihfq7fsku.rcgu.o): In function `hashbrown::map::HashMap<K,V,S>::insert':
          /cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.6.2/src/map.rs:852: undefined reference to `core::mem::replace'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.3mhv86gjj1fmffq1.rcgu.o): In function `core::sync::atomic::AtomicUsize::compare_exchange':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/sync/atomic.rs:1509: undefined reference to `core::sync::atomic::atomic_compare_exchange'
          /projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib(zia-53e6b67f6384d884.3mhv86gjj1fmffq1.rcgu.o): In function `core::sync::atomic::AtomicUsize::fetch_add':
          /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/sync/atomic.rs:1595: undefined reference to `core::sync::atomic::atomic_add'
          /usr/bin/ld: /projects/zia_programming/target/debug/deps/reductions-909e2105e0466dd3: hidden symbol `_ZN4core4hash6Hasher9write_u6417hf50f0528bbb33db9E' isn't defined
          /usr/bin/ld: final link failed: Bad value
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: could not compile `zia`.

Caused by:
  process didn't exit successfully: `rustc --crate-name reductions zia/tests/reductions.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C debuginfo=2 --test -C metadata=909e2105e0466dd3 -C extra-filename=-909e2105e0466dd3 --out-dir /projects/zia_programming/target/debug/deps -C incremental=/projects/zia_programming/target/debug/incremental -L dependency=/projects/zia_programming/target/debug/deps --extern criterion=/projects/zia_programming/target/debug/deps/libcriterion-fb1767a9be2d3c02.rlib --extern lazy_static=/projects/zia_programming/target/debug/deps/liblazy_static-6f8674eb0baecf4f.rlib --extern maplit=/projects/zia_programming/target/debug/deps/libmaplit-1ab5541dce053f90.rlib --extern proptest=/projects/zia_programming/target/debug/deps/libproptest-9f997a7125af16a2.rlib --extern slog=/projects/zia_programming/target/debug/deps/libslog-4ad80cbc7b81ca55.rlib --extern slog_term=/projects/zia_programming/target/debug/deps/libslog_term-edd40c432ece3723.rlib --extern snafu=/projects/zia_programming/target/debug/deps/libsnafu-e2835932ca06767a.rlib --extern test_zia=/projects/zia_programming/target/debug/deps/libtest_zia-50eb05ef8034793d.rlib --extern zia=/projects/zia_programming/target/debug/deps/libzia-53e6b67f6384d884.rlib -C link-dead-code -L native=/projects/zia_programming/target/debug/build/backtrace-sys-ae112dc44184492a/out` (exit code: 1)

I noticed that there wasn't a target specified for rustc.

@quarthex
Copy link

I had the same issue.
I ran cargo install cargo-kcov to update it from 0.5.1 to 0.5.2, cargo clean then cargo kcov.
Maybe it will work for you too.

@quarthex
Copy link

quarthex commented Nov 4, 2023

Without any feedback since more than 3 years, I think that this issue can be considered as closed.

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

2 participants