[PATCH] D61452: [WebAssembly] Always include <sysroot>/lib in library path

Sam Clegg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 15:05:42 PDT 2019


sbc100 added a comment.

In D61452#1488789 <https://reviews.llvm.org/D61452#1488789>, @sunfish wrote:

> If "$sysroot/lib" ends up coming to mean "wasm32" because people come to depend on that, then wasm64 may end up needing to be different in a gratuitous way, which I'd like to avoid.
>
> I'd like to keep our sysroots tidy when we can. If some libraries are installed in `lib/wasm32-wasi` and others `lib` for no reason other than build script inertia, that's untidy.
>
> It's not an absolute for me, but I am inclined to see if we can understand the need better first. Single-arch sysroots are possible either way, for example.


I think are you wrong here for a couple of reasons.

Firstly, we already look in both the multi-arch directory for include files:

  sysroot/include/wasm32-wasi
  sysroot/include

Amd for C++ includes:

  sysroot/include/wasm32-wasi/c++/v1
  sysroot/include/c++/v1

This allows for us to fall back from arch-specific to generic headers as needed.  The same can be true of libraries.   Not all libraries contains compiled code.  `.so` files can also be linker scripts that reference other libraries in which case they can be arch-neutral.

Secondly, not everyone is going to want to use a multi-arch sysroot.  For example I would argue that the wasi SDK would make more sense being single arch since it has exactly one purpose.  Its only when installing wasi into an existing system that one really needs to be multi-arch.  In any case we should not dictate this.  We've already have one person trying to build a wasi-sdk without using multi-arch paths.  I'm not sure what you mean by "single arch sysroots are possible either way".  The point of a single arch sysroot would be avoid the unnecessary extra path components and I thats exactly what this change is allowing for.

Thirdly, its what the linux driver does, which is the example we are following of how to build a multi-arch toolchain.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61452/new/

https://reviews.llvm.org/D61452





More information about the cfe-commits mailing list