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

Unable to build littflefs under esp-rs #18

Open
leelists opened this issue May 22, 2022 · 2 comments
Open

Unable to build littflefs under esp-rs #18

leelists opened this issue May 22, 2022 · 2 comments

Comments

@leelists
Copy link

Hi,

I'm trying to setup littlefs2-sys crate but got this weird error on compile (
cargo:rustc-link-lib=static=lfs-sys
cargo:rustc-link-search=native=/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-bfcc464d6158cf54/out

--- stderr
thread 'main' panicked at 'a libclang shared library is not loaded on this thread', /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-1.3.1/src/lib.rs:1692:1
stack backtrace:
0: 0x559cb7a3491c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf3852a2e8c0ed474

Any clues ?

Thanks

Reproducer

use littlefs2::fs::Filesystem;

fn main() {
    esp_idf_sys::link_patches();
}

**ESP32-C3 Build **
cargo build --target riscv32imc-esp-espidf
==>

Compiling littlefs2-sys v0.1.6
The following warnings were emitted during compilation:

warning: cc: error: unrecognized argument in option ‘-mabi=ilp32’
warning: cc: note: valid arguments to ‘-mabi=’ are: ms sysv
warning: cc: error: unrecognized argument in option ‘-mcmodel=medany’
warning: cc: note: valid arguments to ‘-mcmodel=’ are: 32 kernel large medium small

error: failed to run custom build command for `littlefs2-sys v0.1.6`

Caused by:
  process didn't exit successfully: `/home/rust/rust-esp32-std-demo/target/release/build/littlefs2-sys-1d6dbaa83e9b0ae9/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("riscv32imc-esp-espidf")
  OPT_LEVEL = Some("s")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_riscv32imc-esp-espidf = None
  CC_riscv32imc_esp_espidf = None
  TARGET_CC = None
  CC = None
  CROSS_COMPILE = None
  CFLAGS_riscv32imc-esp-espidf = None
  CFLAGS_riscv32imc_esp_espidf = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("c,llvm14-builtins-abi,m")
  running: "cc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=rv32imc" "-mabi=ilp32" "-mcmodel=medany" "-Wall" "-Wextra" "-std=c11" "-DLFS_NO_MALLOC" "-DLFS_NO_DEBUG" "-DLFS_NO_WARN" "-DLFS_NO_ERROR" "-DLFS_NO_ASSERT" "-o" "/home/rust/rust-esp32-std-demo/target/riscv32imc-esp-espidf/release/build/littlefs2-sys-e759feb3b1f171d7/out/littlefs/lfs.o" "-c" "littlefs/lfs.c"
  cargo:warning=cc: error: unrecognized argument in option ‘-mabi=ilp32’
  cargo:warning=cc: note: valid arguments to ‘-mabi=’ are: ms sysv
  cargo:warning=cc: error: unrecognized argument in option ‘-mcmodel=medany’
  cargo:warning=cc: note: valid arguments to ‘-mcmodel=’ are: 32 kernel large medium small
  exit status: 1

ESP32 Build ==>

Caused by:
  process didn't exit successfully: `/home/rust/rust-esp32-std-demo/target/debug/build/littlefs2-sys-c58b6439135e84ff/build-script-build` (exit status: 101)
  --- stdout
  TARGET = Some("xtensa-esp32-espidf")
  OPT_LEVEL = Some("z")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_xtensa-esp32-espidf = None
  CC_xtensa_esp32_espidf = None
  TARGET_CC = None
  CC = None
  CROSS_COMPILE = None
  CFLAGS_xtensa-esp32-espidf = None
  CFLAGS_xtensa_esp32_espidf = None
  TARGET_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("atomctl,bool,coprocessor,debug,dfpaccel,div32,exception,fp,highpriinterrupts,interrupt,llvm14-builtins-abi,loop,mac16,memctl,miscsr,mul32,mul32high,nsa,prid,regprotect,rvector,s32c1i,sext,threadptr,timerint,windowed")
  running: "cc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-Wall" "-Wextra" "-std=c11" "-DLFS_NO_MALLOC" "-DLFS_NO_DEBUG" "-DLFS_NO_WARN" "-DLFS_NO_ERROR" "-DLFS_NO_ASSERT" "-o" "/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-6a1b6e15fa15c0ed/out/littlefs/lfs.o" "-c" "littlefs/lfs.c"
  exit status: 0
  running: "cc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-Wall" "-Wextra" "-std=c11" "-DLFS_NO_MALLOC" "-DLFS_NO_DEBUG" "-DLFS_NO_WARN" "-DLFS_NO_ERROR" "-DLFS_NO_ASSERT" "-o" "/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-6a1b6e15fa15c0ed/out/littlefs/lfs_util.o" "-c" "littlefs/lfs_util.c"
  exit status: 0
  running: "cc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-Wall" "-Wextra" "-std=c11" "-DLFS_NO_MALLOC" "-DLFS_NO_DEBUG" "-DLFS_NO_WARN" "-DLFS_NO_ERROR" "-DLFS_NO_ASSERT" "-o" "/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-6a1b6e15fa15c0ed/out/string.o" "-c" "string.c"
  exit status: 0
  AR_xtensa-esp32-espidf = None
  AR_xtensa_esp32_espidf = None
  TARGET_AR = None
  AR = None
  running: "ar" "cq" "/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-6a1b6e15fa15c0ed/out/liblfs-sys.a" "/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-6a1b6e15fa15c0ed/out/littlefs/lfs.o" "/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-6a1b6e15fa15c0ed/out/littlefs/lfs_util.o" "/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-6a1b6e15fa15c0ed/out/string.o"
  exit status: 0
  running: "ar" "s" "/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-6a1b6e15fa15c0ed/out/liblfs-sys.a"
  exit status: 0
  cargo:rustc-link-lib=static=lfs-sys
  cargo:rustc-link-search=native=/home/rust/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/littlefs2-sys-6a1b6e15fa15c0ed/out

  --- stderr
  thread 'main' panicked at 'a `libclang` shared library is not loaded on this thread', /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-1.3.2/src/lib.rs:1692:1

@nickray
Copy link
Member

nickray commented Jun 24, 2022

I have no idea unfortunately - zero experience with this platform.

@domtac
Copy link

domtac commented Nov 11, 2022

Hey @leelists,

my answer might be a little late, but maybe it still helps you, or others encountering this ;)

Assuming you are on linux, you could just install libclang to build your littles:

$ sudo apt install libclang-dev

This fixed part of my problems.

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

3 participants