Code coverage in Rust - "failed to run `rustc` to learn about target-specific information" - rust

I am trying to get code coverage for my project in Rust. I am following the instructions provided here: https://marco-c.github.io/2020/11/24/rust-source-based-code-coverage.html
Based on that (and from https://doc.rust-lang.org/book/ch01-03-hello-cargo.html), I followed the steps:
cd projects // this could be really anything. Just meant to say I am in a clean directory.
cargo new hello_world --bin // creates a new module with hello world
export RUSTFLAGS="-Zinstrument-coverage"
cargo build
Results in following error:
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Zinstrument-coverage --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
--- stderr
error: the option `Z` is only accepted on the nightly compiler
I followed the post: "Error loading target specification" when building a WebAssembly module with Cargo which has a similar error. But I did not run any rustc command before. So I am not sure if the suggestion there is valid.
My end goal is to not debug this specific error but just try to find a workable way to get code coverage for the project from the command line. So, if I can debug this issue, that's great or if there is something else which I should follow, please point me to it.
Also, I use Intellij - on which I can get code coverage. But I would like to learn that using a command-line approach.
Thanks!

Related

error: could not compile `time` when using cargo to compile

Today when I run cargo build with my project in Fedora 32, shows compile error like this:
Compiling devise v0.3.1
thread 'rustc' panicked at 'assertion failed: sentinel == STR_SENTINEL', /rustc/0b42deaccc2cbe17a68067aa5fdb76104369e1fd/compiler/rustc_serialize/src/opaque.rs:669:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.59.0-nightly (0b42deacc 2021-12-09) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
Compiling async-stream v0.3.2
error: could not compile `time`
warning: build failed, waiting for other jobs to finish...
error: build failed
my cargo version is:
[dolphin#MiWiFi-R4CM-srv]~/Documents/GitHub/rust_wheel% cargo version
cargo 1.58.0-nightly (40dc28175 2021-12-06)
anybody facing the same problem? any fix suggestion? I searching from Google seem no one facing this same issue.
Looks like this internal compiler error is tracked by this issue:
Try cleaning your build artifacts: cargo clean, in most cases the crash should go away after a rebuild.
should be fixed with nightly 2021-12-11

How to fix `failed to increase jobserver pipe capacity from 4096 to 8192; jobserver otherwise might deadlock` error from cargo/rustc

When performing some rust compilation tasks such as running cargo build or cargo xtask install, occasionally the compiler will crash with an error message:
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -C link-arg=-fuse-ld=lld --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 101)
--- stderr
thread 'rustc' panicked at 'failed to create jobserver: Custom { kind: PermissionDenied, error: "failed to increase jobserver pipe capacity from 4096 to 8192; jobserver otherwise might deadlock" }', compiler/rustc_data_structures/src/jobserver.rs:23:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.56.0-nightly (0035d9dce 2021-08-16) running on x86_64-unknown-linux-gnu
note: compiler flags: -C link-arg=-fuse-ld=lld --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro
query stack during panic:
end of query stack
This is occurring on the latest Rust nightly toolchain that includes a working RLS as of the time of posting, rustc 1.56.0-nightly (0035d9dce 2021-08-16)
OS is Debian Linux
This bug is likely caused by a PR merged into jobserver-rs that aims to increase the jobserver pipe buffer capacity on Linux: https://github.com/alexcrichton/jobserver-rs/pull/34
This seems to have created a regression and so was reverted here: https://github.com/alexcrichton/jobserver-rs/pull/35
However, since no new rust nightlies have been minted in a couple of weeks due to rls failing to build, the bug persists in the latest nightly.
The fix is to revert to an older rust nightly and wait for a new working nightly to be released with rls support which will include the revert for the breaking commit to jobserver-rs.

/usr/bin/link: missing operand after ‘\377\376"’ when compiling bitflags

Following Phillip Opperman's Blog OS, I have been trying to use the bitflags and x86_64 rust crates. The latest x86_64 crate release has bitflags 1.0.4 as a dependency which makes sense. However, I have been completely unable to compile bitflags 1.2.1 on any target with several compilers (tried nightly for every release since June 2019, stable)
Every time I try, Cargo throws this error:
error: linking with `link.exe` failed: exit code: 1
|
= note: "link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.10igbbtzvlu2gjzc.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.178969nxbu3nxuky.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.17xe0ilsif9upn0h.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.18t5fqmvmcakbqcu.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.1tks4n3zsagbiucs.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.1x00x4dovi546kkl.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.20khrbf3w08gf7gw.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.2300zqtgv1madedz.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.242aa09d34jshbc9.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.24klb7r0emqymm3t.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.27en69ffbhnktrj7.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.2bws5627knv64y1n.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.2e1o13g4bta7mxfq.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.2msccpkq1gofr2iq.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.2so84tb4ib2abjhy.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.2wrpuwxc6a2lpmw3.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.34jaofsecblmluop.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.3h9hs48cyaiaawqq.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.3i7788k802tubyhd.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.3jxyc8towsdfxyad.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.3ofhy3w7e48bfc7j.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.3qnhz4aum3qd07zo.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.3y43d86jozz1eymi.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.3ycwew3k0fan7v08.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.40hi0t5daivy49tp.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.447ecvqx3zomb1b8.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.455qjh596c0k58u.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.4755rsha0yaachh.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.4c1izw4dwgrqtuxe.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.4ckqzzupgkkb0m3s.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.4e31qbizzcl2oip1.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.4l4pis8wno6tow0u.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.4p1k3k8ws4isf3lw.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.4tdt9b2iyabiwph8.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.519b3wup2l151966.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.54m1xq349ayksbun.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.57ectnnsg543kzfn.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.58dovvuhpiqcojaw.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.5a7xswmgibmgqieq.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.5du0pnnn1wob2l02.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.5gmrtuynfugoyo5w.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.dy9ewngypkxb53u.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.g92a319cgc2j7m4.rcgu.o"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.o22syf9m375w02v.rcgu.o" "
OUT:C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.exe"
"C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\build\\bitflags-10ba28bcd480cb56\\build_script_build-10ba28bcd480cb56.yhwnnfvr19au4rm.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "
NATVIS:C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "
NATVIS:C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "
NATVIS:C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "
NATVIS:C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" "/LIBPATH:C:\\Users\\jlsat\\Desktop\\projects\\bitflags\\target\\debug\\deps" "
LIBPATH:C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-18c6858731fa3bc3.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-a66e087848bc7936.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-338ca20351402107.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-4f84af8e7d3388ab.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libbacktrace-a1aab3ed9b27c85d.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-7ec4d8ba283cadef.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-95d48056521518ae.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-0da050bb8301bdcc.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-4fecd5ded0f89344.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-6c3a580df1907230.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-a7e28ad09d5bceb4.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-d611b18b12aad85e.rlib"
"C:\\Users\\jlsat\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-72682309e5e16886.rlib" "advapi32.lib" "ws2_32.lib"
"userenv.lib" "msvcrt.lib"
= note: /usr/bin/link: missing operand after ‘\377\376"’
Try '/usr/bin/link --help' for more information.
(More outputs at bottom)
This, to me, is gibberish. Clearly, the linker is failing, but as far as I understand it, the bitflags crate has a custom build script (build.rs) that really only checks for compiler compatibility. Since the crate only works on rustc 1.2+ (something of the sort) it makes sense that it checks this. However, this also leaves me with no leads. What is the source of this issue? I can't see any point where the linker is being directly modified in a way that would cause such a mess.
cargo build --verbose output (same as before with this section appended):
Caused by:
process didn't exit successfully:
`rustc --crate-name build_script_build build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' -C metadata=10ba28bcd480cb56 -C extra-filename=-10ba28bcd480cb56 --out-dir 'C:\Users\jlsat\Desktop\projects\bitflags\target\debug\build\bitflags-10ba28bcd480cb56' -C 'incremental=C:\Users\jlsat\Desktop\projects\bitflags\target\debug\incremental' -L 'dependency=C:\Users\jlsat\Desktop\projects\bitflags\target\debug\deps'` (exit code: 1)
Running this process separately output almost exactly the same thing, with no new information.
Edit:
I was trying this on bash for windows, and my MSVC linker along with the rest of the suite was broken (windows doesn't like me). I believe this massive printout was caused because the terminal defaulted to the gnu linker, which didn't like that. After reinstalling the build tools and updating my toolchain and xbuild, everything worked fine. Thanks for those who tried to help!
I also meet this error.
I fix it by installing Windows 10 SDK.
Rustc need Windows 10 SDK. I found this in here:
For Visual Studio, make sure to check the "C++ tools" and "Windows 10 SDK" option.

Is there way to use xbuild instead of build when calling cargo-binutils commands?

I try to use binutils commands for binary of custom build target with cargo xbuild command.
However, I get an error like below message.
$ cargo nm --target i586-rust_dos.json --bin rust_dos --verbose
"cargo" "build" "--target" "i586-rust_dos.json" "--bin" "rust_dos" "--message-format=json"
Compiling rust_dos v0.1.0 (/home/soya/Documents/src/rust/prac/rust_dos)
error[E0463]: can't find crate for `core` ] 0/2
|
= note: the `i586-rust_dos-8410465322435951119` target may not be installed
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: could not compile `rust_dos`.
To learn more, run the command again with --verbose.
error: Failed to parse crate metadata
I realized that cargo nm uses cargo build command,
so I think this error should be solved if I make cargo nm to use cargo xbuild instead of cargo build.
However, I cannot find how to do that.
Please teach me if there is a way.
To detect core crate built with cargo xbuild, I need to add sysroot flag in rustflags in .cargo/config.
example is below.
rustflags = ["--sysroot", "/full/path/to/sysroot/directory"]
There is sysroot directory in project's target directory.
If adding these flags, cargo-bintuils commands are enabled to use as far as in my environment.

failure to build rust-libc using cargo when rustc is musl-enabled

I successfully created a musl configured rustc by following this link
My attempt to build a project (which builds fine using non-musl configured rust) failed when I used cargo rustc -- --target=x86_64-unknown-linux-musl
'error: could not find crate `libc` with expected target triple x86_64-unknown-linux-musl'
Then, I tried to create rust-libc library using the code from crate. To be more accurate, I used the command provided by cargo to build rust-libc, I've only added --target=x86_64-unknown-linux-musl to the command. This time it failed reporting:
'error: could not find native static library `c`, perhaps an -L flag is missing?`'
I have two questions:
Is it mandatory to build musl configured cargo to be able to use cargo build --target=x86_64-unknown-linux-musl?
How can I address this:
'error: could not find native static library `c`, perhaps an -L flag is missing?'
This worked for me to build libc:
rustc --target=x86_64-unknown-linux-musl /address-of-libc/lib.rs --crate-name libc --crate-type lib -L /address-of-musldist/musldist/lib/ --out-dir=/your-chosen-address/target --cfg feature=\"default\" --cfg feature=\"cargo-build\" --emit=dep-info,link

Resources