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

c-stubs feature not working #71

Open
Sven65 opened this issue Jul 25, 2024 · 1 comment
Open

c-stubs feature not working #71

Sven65 opened this issue Jul 25, 2024 · 1 comment

Comments

@Sven65
Copy link

Sven65 commented Jul 25, 2024

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: [email protected]: In file included from littlefs/lfs.c:8:
warning: [email protected]: littlefs/lfs_util.h:25:10: fatal error: 'string.h' file not found
warning: [email protected]: #include <string.h>
warning: [email protected]:          ^~~~~~~~~~
warning: [email protected]: 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).
@robin-nitrokey
Copy link
Member

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.

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