diff --git a/CHANGELOG.md b/CHANGELOG.md index 97e0200..4d0b718 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Add feature to disable compiling string.c when it conflicts with other libs. ([#15]()) + ## [0.2.0] - 2024-05-28 ### Added diff --git a/Cargo.toml b/Cargo.toml index a5e07c0..48c6237 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ readme = "README.md" categories = ["embedded", "filesystem", "no-std"] repository = "https://github.com/nickray/littlefs2-sys" + [build-dependencies] bindgen = { version = "0.69.4", default-features = false , features = ["runtime"] } cc = "1" @@ -18,3 +19,15 @@ assertions = [] trace = [] malloc = [] software-intrinsics = [] + +# Enable this feature when you are linking with other libraries that also +# define these functions and you are getting multiple definition errors. +# If you enable this then you need to insure that the following c functions +# are available: +# - strspn +# - strcspn +# - strlen +# - strchr +# one way is to use the `tinyrlibc` crate and enable those features that +# are still missing. +have-string-funcs = [] diff --git a/build.rs b/build.rs index abd80f4..f3acf27 100644 --- a/build.rs +++ b/build.rs @@ -10,8 +10,10 @@ fn main() -> Result<(), Box> { .flag("-DLFS_NO_WARN") .flag("-DLFS_NO_ERROR") .file("littlefs/lfs.c") - .file("littlefs/lfs_util.c") - .file("string.c"); + .file("littlefs/lfs_util.c"); + + #[cfg(not(feature = "have-string-funcs"))] + let builder = builder.file("string.c"); #[cfg(feature = "software-intrinsics")] let builder = builder.flag("-DLFS_NO_INTRINSICS");