I am following this book to do an hardware-check on a esp32 like mentioned on this page in the book.
When running cargo run
I get a really long error that basically starts with this
error: linking with `cc` failed: exit status: 1
I have gcc installed. If I do which cc
I get this
kronix@nixos:~/esp/std-training/intro/hardware-check/ > which cc
/run/current-system/sw/bin/cc
So I have gcc installed but cargo doesn’t find it?
What should I do to make it work?
Thanks in advance!
bwolf
November 22, 2024, 3:53pm
2
Please provide us the detailed setup how you do what you do and detailed error output of the commands you run. it seems you’re trying to link to some library which is not available in your “setup” which is hopefully a nix-shell.
1 Like
After switching my setup to a nix-shell that looks like that
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
# nativeBuildInputs is usually what you want -- tools you need to run
nativeBuildInputs = with pkgs.buildPackages; [
gcc
espflash
rustup
rustc
rustfmt
cargo
];
}
I still get the same error.
Here is the full error https://pastebin.com/N9jKUikN
Is anyone able to help me?
bwolf
November 24, 2024, 10:08pm
5
Unfortunately not yet. The link you posted with the error details is dead (404). I’m not sure what this error is.
bwolf
November 24, 2024, 10:26pm
6
I quickly tried with mkShell { packages = with pkgs; [ espflash rustup python3 ]; };
, followed by rustup default stable
and failed. Unfortunately I do not know the book, and the required tooling (besides Rust).
Here the error I got: Error: Could not install esp-idf
I haven’t used it myself (I have tried to avoid the framework), but maybe GitHub - mirrexagon/nixpkgs-esp-dev: Nix flake and overlay for ESP8266 and ESP32 development. is what you need here?
1 Like
Here is a shorten version of the error containing the important.
kronix@nixos:~/repos/std-training/intro/hardware-check/ > sudo cargo run
Compiling compiler_builtins v0.1.109
Compiling proc-macro2 v1.0.92
Compiling unicode-ident v1.0.14
Compiling libc v0.2.155
Compiling memchr v2.5.0
Compiling std v0.0.0 (/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
Compiling memchr v2.7.4
Compiling serde v1.0.215
Compiling libc v0.2.164
Compiling bitflags v2.6.0
Compiling crossbeam-utils v0.8.20
Compiling rustix v0.38.41
Compiling syn v1.0.109
Compiling glob v0.3.1
Compiling nix v0.29.0
Compiling anyhow v1.0.86
Compiling rustversion v1.0.18
Compiling prettyplease v0.2.25
Compiling thiserror v1.0.69
Compiling serde_json v1.0.133
Compiling cvt v0.1.2
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/root/.cargo/bin:/nix/store/rsl5pj2xkhbrpfw60w8asz6ln27lv5fc-kitty-0.37.0/bin:/nix/store/ym0d0c1hpxinxvr2qrfg1d1b9wnz6i71-imagemagick-7.1.1-40/bin:/nix/store/inpspwqhgpld2zdk89hra7xjh3nxll2x-ncurses-6.4.20221231-dev/bin:/run/wrappers/bin:/home/kronix/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/kronix/.nix-profile/bin:/nix/profile/bin:/home/kronix/.local/state/nix/profile/bin:/etc/profiles/per-user/kronix/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustclqGHxz/symbols.o" "/home/kronix/repos/std-training/intro/hardware-check/target/debug/build/serde_json-88b0886fbad617b3/build_script_build-88b0886fbad617b3.build_script_build.5dce32d6959309e0-cgu.0.rcgu.o" "/home/kronix/repos/std-training/intro/hardware-check/target/debug/build/serde_json-88b0886fbad617b3/build_script_build-88b0886fbad617b3.375gqbyzdmeoofumj5iwt7lxv.rcgu.o" "-Wl,--as-needed" "-L" "/home/kronix/repos/std-training/intro/hardware-check/target/debug/deps" "-L" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-c6c045f3358c0b22.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-5c2158c1682442e0.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-404d0b40d67de09f.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-e07eeabf48db885c.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-c92423f648579064.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-8dab5299a97564ae.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-65891f932666bb65.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-b2634d236d77b88a.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-38ef4997455a5e72.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-b2e6b39d803e65fe.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-0864893dee726241.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-e599f337a82d59c4.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-acbe32895031f6bc.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-e21e611894cf2844.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-7b90a2705bcf265b.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-1f7e19b44251c73e.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-f72b956e24d1de70.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-632ae0f28c5e55ff.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-4d7d16bbf0636a40.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-B/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-B/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-B/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/self-contained" "-o" "/home/kronix/repos/std-training/intro/hardware-check/target/debug/build/serde_json-88b0886fbad617b3/build_script_build-88b0886fbad617b3" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: /nix/store/d1hc6cf5xdsak1r71af8l0aqvli0d0nc-rustup-1.27.1/nix-support/ld-wrapper.sh: line 19: /nix/store/d1hc6cf5xdsak1r71af8l0aqvli0d0nc-rustup-1.27.1/nix-support/darwin-sdk-setup.bash: No such file or directory
collect2: error: ld returned 1 exit status
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/root/.cargo/bin:/nix/store/rsl5pj2xkhbrpfw60w8asz6ln27lv5fc-kitty-0.37.0/bin:/nix/store/ym0d0c1hpxinxvr2qrfg1d1b9wnz6i71-imagemagick-7.1.1-40/bin:/nix/store/inpspwqhgpld2zdk89hra7xjh3nxll2x-ncurses-6.4.20221231-dev/bin:/run/wrappers/bin:/home/kronix/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/kronix/.nix-profile/bin:/nix/profile/bin:/home/kronix/.local/state/nix/profile/bin:/etc/profiles/per-user/kronix/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcwwbcs4/symbols.o" "/home/kronix/repos/std-training/intro/hardware-check/target/debug/build/prettyplease-b8d8e94d88d194d3/build_script_build-b8d8e94d88d194d3.build_script_build.d67b0f4f5024a3a4-cgu.0.rcgu.o" "/home/kronix/repos/std-training/intro/hardware-check/target/debug/build/prettyplease-b8d8e94d88d194d3/build_script_build-b8d8e94d88d194d3.1bu753qmnqxdpre145a3a9c7i.rcgu.o" "-Wl,--as-needed" "-L" "/home/kronix/repos/std-training/intro/hardware-check/target/debug/deps" "-L" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-c6c045f3358c0b22.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-5c2158c1682442e0.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-404d0b40d67de09f.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-e07eeabf48db885c.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-c92423f648579064.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-8dab5299a97564ae.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-65891f932666bb65.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-b2634d236d77b88a.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-38ef4997455a5e72.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-b2e6b39d803e65fe.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-0864893dee726241.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-e599f337a82d59c4.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-acbe32895031f6bc.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-e21e611894cf2844.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-7b90a2705bcf265b.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-1f7e19b44251c73e.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-f72b956e24d1de70.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-632ae0f28c5e55ff.rlib" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-4d7d16bbf0636a40.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-B/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-B/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-B/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/root/.rustup/toolchains/nightly-2024-06-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/self-contained" "-o" "/home/kronix/repos/std-training/intro/hardware-check/target/debug/build/prettyplease-b8d8e94d88d194d3/build_script_build-b8d8e94d88d194d3" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: /nix/store/d1hc6cf5xdsak1r71af8l0aqvli0d0nc-rustup-1.27.1/nix-support/ld-wrapper.sh: line 19: /nix/store/d1hc6cf5xdsak1r71af8l0aqvli0d0nc-rustup-1.27.1/nix-support/darwin-sdk-setup.bash: No such file or directory
collect2: error: ld returned 1 exit status
Compiling libloading v0.8.5
error: could not compile `serde_json` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
It still does not work … help please
mastoca
November 29, 2024, 6:20pm
10
are you setup to build multiple arch? you may building x86 instead of aarch. You may want to look at Cross compiling - crane for some inspiration.