trussed-dev/littlefs2

c-stubs feature not working

Sven65 opened this issue · 1 comments

Trying to build in a no_std environment, I've got littlefs2 = { version = "0.4.0", features = ["c-stubs"] } in my cargo.toml, yet I get the error on cargo run

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

warning: littlefs2-sys@0.1.7: In file included from littlefs/lfs.c:8:
warning: littlefs2-sys@0.1.7: littlefs/lfs_util.h:25:10: fatal error: 'string.h' file not found
warning: littlefs2-sys@0.1.7: #include <string.h>
warning: littlefs2-sys@0.1.7:          ^~~~~~~~~~
warning: littlefs2-sys@0.1.7: 1 error generated.

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

Caused by:
  process didn't exit successfully: `/Users/mackan/Documents/GitHub/Personal/project/target/debug/build/littlefs2-sys-0d6d9b45da4bb1d1/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/Users/mackan/Documents/GitHub/Personal/project/target/x86_64-test_os/debug/build/littlefs2-sys-401ef0e1edce4889/out)
  TARGET = Some(x86_64-test_os)
  OPT_LEVEL = Some(0)
  HOST = Some(aarch64-apple-darwin)
  cargo:rerun-if-env-changed=CC_x86_64-test_os
  CC_x86_64-test_os = None
  cargo:rerun-if-env-changed=CC_x86_64_test_os
  CC_x86_64_test_os = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CROSS_COMPILE
  CROSS_COMPILE = None
  RUSTC_LINKER = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(true)
  cargo:rerun-if-env-changed=CFLAGS_x86_64-test_os
  CFLAGS_x86_64-test_os = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_test_os
  CFLAGS_x86_64_test_os = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=In file included from littlefs/lfs.c:8:
  cargo:warning=littlefs/lfs_util.h:25:10: fatal error: 'string.h' file not found
  cargo:warning=#include <string.h>
  cargo:warning=         ^~~~~~~~~~
  cargo:warning=1 error generated.

  --- stderr


  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "--target=x86_64-test_os" "-Wall" "-Wextra" "-std=c11" "-DLFS_NO_MALLOC" "-DLFS_NO_DEBUG" "-DLFS_NO_WARN" "-DLFS_NO_ERROR" "-DLFS_NO_ASSERT" "-o" "/Users/mackan/Documents/GitHub/Personal/project/target/x86_64-test_os/debug/build/littlefs2-sys-401ef0e1edce4889/out/0d3dc7275cda748e-lfs.o" "-c" "littlefs/lfs.c" with args cc did not execute successfully (status code exit status: 1).

The c-stubs feature allows you not to link against libc but you still need the string.h header because it is included by littlefs.