Stream: wasi

Topic: wasi libc accursed CPP


view this post on Zulip John Ericson (Mar 21 2022 at 21:35):

Anyone have a moment to take a look at the CI failure for https://github.com/WebAssembly/wasi-libc/pull/270 ? I was getting there is with my (admitting highly nonstandard) toolchain before my change. So I am a confused what's up.

Fixes #269 The "don't move the variables independently if you want to make install" part is a gross, but as neither wasi-sdk or Nixpkgs actually needs make install (we both can just build right int...

view this post on Zulip John Ericson (Mar 21 2022 at 21:36):

I think I am using -isysroot wrong, but I do not understand how the --sysroot prior worked either the more I read the sparse GCC and Clang documentation on this. I would like to replace both with a plain old -I, but then I get another spooky error.

view this post on Zulip John Ericson (Mar 21 2022 at 21:37):

In particular __strong_reference is only used in _Exit.c and nanosleep.c, and those files don't seem to (before or after) get the include needed for __strong_reference's CPP definition, and yet it worked before.

view this post on Zulip Dan Gohman (Mar 21 2022 at 21:38):

"-isysroot "/home/runner/work/wasi-libc/wasi-libc/sysroot/include"

view this post on Zulip Dan Gohman (Mar 21 2022 at 21:39):

should this be " -isysroot "/home/runner/work/wasi-libc/wasi-libc/sysroot", without the trailing include? the docs for -isysroot say it works like -sysroot, which suggests it inteprrets the path as the root of the sysroot

view this post on Zulip John Ericson (Mar 21 2022 at 21:39):

So I think "-isysroot "/home/runner/work/wasi-libc/wasi-libc/sysroot" would work for CI.

view this post on Zulip John Ericson (Mar 21 2022 at 21:40):

but the docs also talk about things like $sysroot/usr/include. And neither works in my local build! I think sysroot is very magic in that the paths that it looks for within the sysroot are somehow configurable.

view this post on Zulip Dan Gohman (Mar 21 2022 at 21:41):

hrm, I've not encountered things looking for "usr" inside sysroot. That's... unfortunate.

view this post on Zulip John Ericson (Mar 21 2022 at 21:42):

So yeah in conclusion it would be nice to just use plain old -I

view this post on Zulip John Ericson (Mar 21 2022 at 21:42):

an avoid all that spooky ambient configuration that effects what exactly "sysroot" things do.

view this post on Zulip Dan Gohman (Mar 21 2022 at 21:43):

Yeah, or -isystem so that it does the right thing wrt <....h> includes

view this post on Zulip John Ericson (Mar 21 2022 at 21:43):

But then, I get the __strong_reference error. In fact, -I ... -isysroot together also causes the __strong_reference error! madness!

view this post on Zulip Dan Gohman (Mar 21 2022 at 21:43):

what is the __strong_reference error?

view this post on Zulip John Ericson (Mar 21 2022 at 21:43):

Dan Gohman said:

Yeah, or -isystem so that it does the right thing wrt <....h> includes

What exactly do you mean? <...> vs ".."?

view this post on Zulip Dan Gohman (Mar 21 2022 at 21:44):

Yeah. -isystem is like -I but marks the directory as a "system" include directory.

view this post on Zulip John Ericson (Mar 21 2022 at 21:44):

John Ericson said:

In particular __strong_reference is only used in _Exit.c and nanosleep.c, and those files don't seem to (before or after) get the include needed for __strong_reference's CPP definition, and yet it worked before.

It doesn't get the macro def and at least one of those two files fail to build.

view this post on Zulip John Ericson (Mar 21 2022 at 21:44):

Dan Gohman said:

Yeah. -isystem is like -I but marks the directory as a "system" include directory.

there is also -Iquote and -isystem.

view this post on Zulip John Ericson (Mar 21 2022 at 21:45):

I will try some of those

view this post on Zulip Dan Gohman (Mar 21 2022 at 21:45):

Include directories provided by wasi-libc should be treated as "system" directories.

view this post on Zulip John Ericson (Mar 21 2022 at 21:46):

OK -isystem + -isysroot worked!

view this post on Zulip John Ericson (Mar 21 2022 at 21:46):

Now trying just -isystem.

view this post on Zulip John Ericson (Mar 21 2022 at 21:46):

-I does affect <...> lookup too. I think Postel's law muddled the distinctions long ago :) but I will check the docs.

view this post on Zulip Dan Gohman (Mar 21 2022 at 21:47):

Yeah I forget the exact rules because srsly

view this post on Zulip John Ericson (Mar 21 2022 at 21:49):

OK! -isystem alone works, and -idirafter also works.

view this post on Zulip John Ericson (Mar 21 2022 at 21:50):

So the issue wasn't "systemness" but order --- that the other -I must override this. Yuck!!!

view this post on Zulip John Ericson (Mar 21 2022 at 22:03):

Wrote a big fat comment and pushed :).


Last updated: Nov 22 2024 at 16:03 UTC