Skip to content

Option to build without the standard library #4561

@barakugav

Description

@barakugav

🚀 The feature, motivation and pitch

ExecuTorch is intended for use in edge devices, even embedded systems. In these use cases it is required to reduce the size of the executable, and ExecuTorch are proud of the core library to be only few dozes of Kb. I think it will be very useful to be able compile without the standard CPP library.

The library already give a great flexibility for custom allocators, and I don't think there is some critical code that must have std.
From my attempt of compiling the lib without std I saw some use of std errors, clocks (which maybe I can override by providing another implementation for the platform/ headers), allocations in MemoryAllocator (maybe we can solve it with a cmake flag), and exceptions (rarely used, saw in some backends loading code).

I wrote Rust bindings for the library, and one of the features I would like to offer is exactly that, to compile without the std lib. In Rust you just add #![no_std] to the crate, in CPP you should do -nostdlib.

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

cc @JacobSzwejbka @dbort @GregoryComer

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: build/installIssues related to the cmake and buck2 builds, and to installing ExecuTorchmodule: runtimeIssues related to the core runtime and code under runtime/triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions