diff options
| author | TheGoldMonkey <41217164+TheGoldMonkey@users.noreply.github.com> | 2025-08-22 10:57:19 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-22 10:57:19 -0700 |
| commit | 3ca2e47514e3fce133a6ac7d1aca88a3b679c551 (patch) | |
| tree | c851d9d00b87333fba00f7feb7b91800671a6262 /source/core | |
| parent | a5e6ddd006ecf72ad9a41961811e93e1e2f72e64 (diff) | |
Fix readlink missing include (#8260)
On Linux, `slang-platform.cpp` compiles with libstdc++ only because
`unistd.h` is being transitively included. It fails to compile with
standard libraries that don't include `unistd.h` like libc++.
This is the how it's being transitively included with libstdc++:
```
/home/mcvm/dev/slang/source/core/slang-platform.h
/home/mcvm/dev/slang/source/core/../core/slang-string.h
/home/mcvm/dev/slang/source/core/../core/slang-hash.h
/home/mcvm/dev/slang/external/unordered_dense/include/ankerl/unordered_dense.h
/usr/lib64/gcc/x86_64-unknown-linux-gnu/15.1.0/../../../../include/c++/15.1.0/memory
/usr/lib64/gcc/x86_64-unknown-linux-gnu/15.1.0/../../../../include/c++/15.1.0/bits/shared_ptr_atomic.h
/usr/lib64/gcc/x86_64-unknown-linux-gnu/15.1.0/../../../../include/c++/15.1.0/bits/atomic_base.h
/usr/lib64/gcc/x86_64-unknown-linux-gnu/15.1.0/../../../../include/c++/15.1.0/bits/atomic_wait.h
/usr/include/unistd.h
```
Tested building with `-stdlib=libc++` and `-stdlib=libstdc++`.
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-platform.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/core/slang-platform.cpp b/source/core/slang-platform.cpp index f7e82fdf0..c61677673 100644 --- a/source/core/slang-platform.cpp +++ b/source/core/slang-platform.cpp @@ -18,6 +18,7 @@ #if SLANG_LINUX_FAMILY #include <execinfo.h> +#include <unistd.h> #endif namespace Slang |
