-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
Description
Building clang against llvm-libc fails with:
In file included from /llvm-project-main/llvm/lib/Support/Program.cpp:104:
/llvm-project-main/llvm/lib/Support/Unix/Program.inc:259:13: error: no matching function for call to 'posix_spawn'
259 | Err = posix_spawn(&PID, Program.str().c_str(), FileActions,
| ^~~~~~~~~~~
/usr/include/spawn.h:21:5: note: candidate function not viable: no known conversion from 'char **' to 'const char *__restrict *' for 5th argument
21 | int posix_spawn(pid_t *__restrict, const char *__restrict, posix_spawn_file_actions_t *, posix_spawnattr_t *__restrict, const char *__restrict *, const char *__restrict *) __NOEXCEPT;
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~
this is because the generated spawn.h has the wrong fn signature for posix_spawn. Specifically, we generate
int posix_spawn(pid_t *__restrict, const char *__restrict, posix_spawn_file_actions_t *, posix_spawnattr_t *__restrict, const char *__restrict *, const char *__restrict *) __NOEXCEPT;
but this is subtly wrong; indeed the last two parameters are currently:
const char *__restrict *but should be:
char * const * __restrictThis can be fixed in libc/include/spawn.yaml a la 6045146 (cc @alexprabhat99)