-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Build libstdc++ as a module #80762
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
base: main
Are you sure you want to change the base?
Build libstdc++ as a module #80762
Conversation
The following west manifest projects have changed revision in this Pull Request:
⛔ DNM label due to: 1 added project Note: This message is automatically posted and updated by the Manifest GitHub Action. |
7946381
to
bb26c26
Compare
bb26c26
to
5d48fd2
Compare
5d48fd2
to
9d96613
Compare
eae52cf
to
7cc5fe1
Compare
Ok, I spent some quality time updating this PR, rebasing and then cleaning it up so that you can configure the version of GCC used to build the module. To finish this off, we'll need a new repo in zephyrproject-rtos to hold the module itself. That doesn't include the gcc source code, that is pulled out of the SDK repository during the build process. Probably 'module-libstdc++' or some such would be fine. I don't have permission to create that, so help is needed here. |
I think this would probably be a better plan than zephyrproject-rtos/sdk-ng#863 as this wouldn't involve building libstd++ in two ways for every possible SDK target. |
8bbc475
to
76a87a3
Compare
I tried this module approach and it worked fine, however it doubled the compile time for our sample (which is long by itself): It may have some use cases, but I think having pre-compiled version without exceptions (which probably would be most of the cases) would be nice. Using module would not work for us, as this would significantly increase build times, slow down CI pipeline and local development. By the way, I compared the binaries (module and noexept from this build) with
and it looks like module version is slightly bigger. Do you know what might be the difference? bloaty output: bloaty.txt |
690ef0b
to
b821051
Compare
I asked about this on Discord.
Will check, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keith-packard given that Zephyr is Apache 2, and this new module is new code, I guess it would need to be also Apache2 licensed, and not BSD3.
(by the way, I do not think you can claim copyright in your name on the license file itself :) )
@keith-packard I'm not opposed to having something akin to this. But when we started discussing building this library from source a few months ago, my hope was we could build it also for the native_simulator based targets (just like we can with picolibc), which with this current solution we can't. Anyhow, a comment on the approach itself: Downloading ~130MB for each image build is probably not something people will be too happy about and feels a bit extreme. |
It should work with the native simulator with picolibc; libstdc++ has libc-specific code, which is why there are limitations in the config bits. I'm not sure why it isn't working with native_sim, but can check.
Yeah, it would be easy to just dump the gcc source into the module repo. However, that's all GPL licensed, which seemed like it would conflict with Zephyr policy. |
I can easily change the license, but BSD3 is apache2 compatible and there is lots of that in other modules? |
That'd be nice |
Yeah, gcc doesn't like this mode at all -- we're using the native compiler to build things, so it doesn't believe we're cross-compiling. I'm not sure that will be easy to fix, gcc's build system is somewhat arcane. |
Provide a mechanism to build libstdc++ as a module, instead of requiring that it be included in the toolchain. Signed-off-by: Keith Packard <[email protected]>
Add a test case verifying that libstdc++ can be used with picolibc with newlib. Signed-off-by: Keith Packard <[email protected]>
b821051
to
4675791
Compare
|
Provide a mechanism to build libstdc++ as a module, instead of requiring that it be included in the toolchain.