Skip to content

Commit 52a3622

Browse files
committed
Attempt to fix Linux build - a clang/ubuntu bug means we can't find stddef.h
1 parent a651520 commit 52a3622

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

stdlib/public/SwiftShims/SwiftStddef.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
// result, using stddef.h here would pull in Darwin module (which includes
1818
// libc). This creates a dependency cycle, so we can't use stddef.h in
1919
// SwiftShims.
20-
#if !defined(__APPLE__)
20+
// On Linux, the story is different. We get the error message
21+
// "/usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not
22+
// found"
23+
// This is a known Clang/Ubuntu bug.
24+
#if !defined(__APPLE__) && !defined(__linux__)
2125
#include <stddef.h>
2226
typedef size_t __swift_size_t;
2327
#else

stdlib/public/SwiftShims/SwiftStdint.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515

1616
// stdint.h is provided by Clang, but it dispatches to libc's stdint.h. As a
1717
// result, using stdint.h here would pull in Darwin module (which includes
18-
// libc). This creates a dependency cycle, so we can't use stdint.h in
18+
// libc). This creates a dependency cycle, so we can't use stdint.h in
1919
// SwiftShims.
20+
// On Linux, the story is different. We get the error message
21+
// "/usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not
22+
// found"
23+
// This is a known Clang/Ubuntu bug.
2024

2125
// Clang has been defining __INTxx_TYPE__ macros for a long time.
2226
// __UINTxx_TYPE__ are defined only since Clang 3.5.
23-
#if !defined(__APPLE__)
27+
#if !defined(__APPLE__) && !defined(__linux__)
2428
#include <stdint.h>
2529
typedef int64_t __swift_int64_t;
2630
typedef uint64_t __swift_uint64_t;

0 commit comments

Comments
 (0)