Skip to content
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

Don't modify the host compiler's sysroot #445

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

alexcrichton
Copy link
Collaborator

This commit updates the building of the wasi-sdk sysroot to leverage the -resource-dir argument from Clang to avoid modifying the host compiler's sysroot with compiler-rt things. This should help improve the experience of building a standalone sysroot with whatever host Clang is on the system.

Closes #444

This commit updates the building of the wasi-sdk sysroot to leverage the
`-resource-dir` argument from Clang to avoid modifying the host
compiler's sysroot with compiler-rt things. This should help improve the
experience of building a standalone sysroot with whatever host Clang is
on the system.

Closes WebAssembly#444
@abrown
Copy link
Collaborator

abrown commented Jul 16, 2024

cc: @whitequark, does this help towards resolving the discussion you were having over in #443 (comment)? I'm thinking of merging this but wanted to hear whether you had any additional feedback here.

Copy link
Contributor

@whitequark whitequark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abrown abrown merged commit 08be2d4 into WebAssembly:main Jul 17, 2024
6 checks passed
@yamt
Copy link
Contributor

yamt commented Jul 24, 2024

have you ever tested if this change actually "avoid modifying the host compiler's sysroot with compiler-rt things"?
i don't think it works w/o WebAssembly/wasi-libc#517.
i suspect we need a bit more CI coverage.

@alexcrichton alexcrichton deleted the fix-only-sysroot-build branch July 24, 2024 14:25
@alexcrichton
Copy link
Collaborator Author

Yes I tested this doesn't modify the host compiler's sysroot. No there is no test of using the host toolchain in CI. Yes it would be great to add tests.

@yamt
Copy link
Contributor

yamt commented Jul 24, 2024

Yes I tested this doesn't modify the host compiler's sysroot.

did your "host compiler" already happen to have wasi compiler-rt?
otherwise, i don't understand why you didn't need WebAssembly/wasi-libc#517.
for me, gmake tried to create the directory for wasi compiler-rt in the host compiler's resource dir.

@alexcrichton
Copy link
Collaborator Author

On Ubuntu 24.04 I ran:

$ cmake -G Ninja -B build -S . -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_NM=llvm-nm-18
$ ninja -C build dist

and everything compiled ok. No the host compiler does not have a compiler-rt for wasm.

@yamt
Copy link
Contributor

yamt commented Jul 24, 2024

On Ubuntu 24.04 I ran:

$ cmake -G Ninja -B build -S . -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_NM=llvm-nm-18
$ ninja -C build dist

and everything compiled ok. No the host compiler does not have a compiler-rt for wasm.

where did clang/clang++/llvm-nm-18 come from? ubuntu package?

which compiler-rt does it link for wasi-libc without WebAssembly/wasi-libc#517?

@alexcrichton
Copy link
Collaborator Author

The clang package owns clang/clang++ and llvm-18 owns llvm-nm. Yes, they're from ubuntu packages.

As to what links compiler-rt is linked, I'm not sure.

yamt added a commit to yamt/wasi-sdk that referenced this pull request Jul 25, 2024
To include WebAssembly/wasi-libc#517,
which is necessary to avoid modifying host compiler's resource
directory.

At least on my environment (macOS if it matters), without the above
mentioned fix, gmake tries to create the directory for wasi compiler-rt
during wasi-libc build. I'm not sure why it didn't happen for others.
cf. WebAssembly#445
@yamt yamt mentioned this pull request Jul 25, 2024
alexcrichton pushed a commit that referenced this pull request Jul 25, 2024
To include WebAssembly/wasi-libc#517,
which is necessary to avoid modifying host compiler's resource
directory.

At least on my environment (macOS if it matters), without the above
mentioned fix, gmake tries to create the directory for wasi compiler-rt
during wasi-libc build. I'm not sure why it didn't happen for others.
cf. #445
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.

Support building just a sysroot, not a toolchain
4 participants