-
Notifications
You must be signed in to change notification settings - Fork 295
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
Option to build without the standard library #4561
Comments
Tried to link an executable without the std lib, here is the linker error:
|
Uses of clocks and |
Hopefully this gives you what you need. If not, please re-open the issue. |
@dbort I can avoid using these structs and functions, but they still require linking to std as the code is still there. "operator delete(void*)", referenced from:
torch::executor::MemoryAllocator::~MemoryAllocator() in libexecutorch_sys-e52bf4e4c0c4d75e.rlib[4](842ff64ee6e2bf22-api_utils.o)
torch::executor::util::FileDataLoader::~FileDataLoader() in libexecutorch_sys-e52bf4e4c0c4d75e.rlib[24](file_data_loader.cpp.o) I would like to use |
@dbort any thoughts? |
I'm surprised that Similarly,
@barakugav do you have any idea where the |
I inspected assembly for file_data_loader.cpp, and sure enough,
So, I think you have to include at least part of the standard library (specifically, Google says this is a known problem for embedding systems and C++; see P1105r1. |
🚀 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
The text was updated successfully, but these errors were encountered: