Skip to content

Conversation

@jungleraptor
Copy link
Contributor

@jungleraptor jungleraptor commented Jun 21, 2023

I noticed that in #92 we inadvertently made it so that the standard library that is selected will always be libstdc++

Here we detect if a builtin sysroot exists to decide whether to choose libstdc++ or libc++:

use_libstdcpp = builtin_sysroot != None and not is_darwin

The problem with this is that we pass a select type at the call-site:

select statements are not expanded in macros, so builtin_sysroot != None is always true.

Design Notes

To fix I refactored the toolchain config so that the standard library compiler and linker options are set via select statements.

I also made it so that regardless of the config setting - if we're cross compiling, then libstdc++ will be selected.

I also added an extra config setting _use_libstdc++ so that libstdc++ can be used independently of a sysroot.

Testing

  • linux x86_64 using libc++ (default)
  • linux x86_64 using libstdc++
  • linux x86_64 using sysroot (libstdc++)
  • linux x86_64 -> linux aarch64 using libstdc++
  • darwin x86_64

@jungleraptor jungleraptor requested a review from krisukox June 21, 2023 00:41
@jungleraptor jungleraptor marked this pull request as ready for review June 21, 2023 00:41
@jungleraptor jungleraptor changed the title fix standard library selection in toolchain fix: standard library selection in toolchain Jun 21, 2023
@jungleraptor jungleraptor requested a review from silverjam June 22, 2023 00:55
@jungleraptor jungleraptor merged commit c5c53dd into main Jun 22, 2023
@jungleraptor jungleraptor deleted the isaac/fix-toolchain branch June 22, 2023 01:11
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

Successfully merging this pull request may close these issues.

3 participants