# Building recent snapshot fails on Arch Linux

**URL:** <https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388>\
**Category:** Using Swift\
**Tags:** linux, foundation, help-needed, arch-linux, buildin-the-compiler\
**Created:** [June 7, 2019, 9:55am UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388 "2019-06-07T09:55:47Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 12, 2019, 7:52pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/21 "2019-06-12T19:52:44Z")

</div>

Gist updated

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [June 12, 2019, 7:59pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/22 "2019-06-12T19:59:42Z")

</div>

Interesting, so it seems that `syscall.h` is not getting included at all. What happens if you add a `#include <syscall.h>` to `ForSwiftFoundationOnly.h` at L68?

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 12, 2019, 8:03pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/23 "2019-06-12T20:03:54Z")

</div>

As I mentioned above I tried to move out syscall.h include right after features.h but I got another error. But let my try that again.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 12, 2019, 8:07pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/24 "2019-06-12T20:07:12Z")

</div>

Line 68 starts with `#define AT_STATX_SYNC_AS_STAT ...` in the following block

```swift
#if __GLIBC_PREREQ(2, 28) == 0
// required for statx() system call, glibc >=2.28 wraps the kernel function
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/stat.h>
#include <linux/fs.h>
#define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */
#endif //__GLIBC_PREREQ(2. 28)

```

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 12, 2019, 8:33pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/25 "2019-06-12T20:33:37Z")

</div>

Ok, I did it. Gist updated with the result.

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [June 12, 2019, 10:36pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/26 "2019-06-12T22:36:10Z")

</div>

Sorry, I was looking at a different version. You should add that outside, right after the `#include <features.h>`.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 13, 2019, 10:12am UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/27 "2019-06-13T10:12:22Z")

</div>

I’ll be away for a couple of days. Once I’m back I’ll run the build and update the gist again.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 17, 2019, 6:48pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/28 "2019-06-17T18:48:50Z")

</div>

I'm back. Here's the result:

[14/103][13%][0.246s] Building C object CoreFoundati...oreFoundation.dir/Collections.subproj/CFBasicHash.c.  
FAILED: CoreFoundation/CMakeFiles/CoreFoundation.dir/Collections.subproj/CFBasicHash.c.o  
/home/segabor/Workspace/swift-dev/build/buildbot\_linux/llvm-linux-x86\_64/bin/clang -DCF\_BUILDING\_CF -DDEPLOYMENT\_RUNTIME\_SWIFT -DHAVE\_SCHED\_GETAFFINITY -DU\_SHOW\_DRAFT\_API -D\_GNU\_SOURCE -I/home/segabor/Workspace/swift-dev/swift-corelibs-foundation/CoreFoundation -I/usr/include/libxml2 -I/home/segabor/Workspace/swift-dev/build/buildbot\_linux/libicu-linux-x86\_64/tmp\_install/include -I/home/segabor/Workspace/swift-dev/swift-corelibs-libdispatch -I/home/segabor/Workspace/swift-dev/build/buildbot\_linux/libdispatch-linux-x86\_64/tests -isystem /home/segabor/Workspace/swift-dev/swift-corelibs-libdispatch/src/BlocksRuntime -O3 -DNDEBUG -fPIC -F /home/segabor/Workspace/swift-dev/build/buildbot\_linux/foundation-linux-x86\_64 -I /home/segabor/Workspace/swift-dev/build/buildbot\_linux/foundation-linux-x86\_64/CoreFoundation.framework/PrivateHeaders -include /home/segabor/Workspace/swift-dev/swift-corelibs-foundation/CoreFoundation/Base.subproj/CoreFoundation\_Prefix.h -fblocks -fconstant-cfstrings -fdollars-in-identifiers -fexceptions -fno-common -fcf-runtime-abi=swift -Wno-shorten-64-to-32 -Wno-deprecated-declarations -Wno-unreachable-code -Wno-conditional-uninitialized -Wno-unused-variable -Wno-int-conversion -Wno-unused-function -Wno-microsoft-enum-forward-reference -pthread -std=gnu99 -MD -MT CoreFoundation/CMakeFiles/CoreFoundation.dir/Collections.subproj/CFBasicHash.c.o -MF CoreFoundation/CMakeFiles/CoreFoundation.dir/Collections.subproj/CFBasicHash.c.o.d -o CoreFoundation/CMakeFiles/CoreFoundation.dir/Collections.subproj/CFBasicHash.c.o -c /home/segabor/Workspace/swift-dev/swift-corelibs-foundation/CoreFoundation/Collections.subproj/CFBasicHash.c  
In file included from /home/segabor/Workspace/swift-dev/swift-corelibs-foundation/CoreFoundation/Collections.subproj/CFBasicHash.c:11:  
In file included from /home/segabor/Workspace/swift-dev/swift-corelibs-foundation/CoreFoundation/Collections.subproj/CFBasicHash.h:12:  
In file included from /home/segabor/Workspace/swift-dev/build/buildbot\_linux/foundation-linux-x86\_64/CoreFoundation.framework/PrivateHeaders/CFInternal.h:156:  
/home/segabor/Workspace/swift-dev/build/buildbot\_linux/foundation-linux-x86\_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:541:85: warning: declaration of 'struct statx' will not be visible outside of this function [-Wvisibility]  
\_statx(int dfd, const char \*filename, unsigned int flags, unsigned int mask, struct statx \*buffer) {  
^  
/home/segabor/Workspace/swift-dev/build/buildbot\_linux/foundation-linux-x86\_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:550:18: error: variable has incomplete type 'struct statx'  
struct statx statx\_buffer = {0};  
^  
/home/segabor/Workspace/swift-dev/build/buildbot\_linux/foundation-linux-x86\_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:550:12: note: forward declaration of 'struct statx'  
struct statx statx\_buffer = {0};  
^  
/home/segabor/Workspace/swift-dev/build/buildbot\_linux/foundation-linux-x86\_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:553:91: error: use of undeclared identifier 'STATX\_ALL'  
ssize\_t ret = \_statx(AT\_FDCWD, filename, AT\_SYMLINK\_NOFOLLOW | AT\_STATX\_SYNC\_AS\_STAT, STATX\_ALL, &statx\_buffer);  
^  
/home/segabor/Workspace/swift-dev/build/buildbot\_linux/foundation-linux-x86\_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:571:37: error: use of undeclared identifier 'STATX\_BTIME'  
if (statx\_buffer.stx\_mask & STATX\_BTIME) {  
^  
1 warning and 3 errors generated.  
ninja: build stopped: subcommand failed.  
./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting  
./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [June 17, 2019, 8:56pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/29 "2019-06-17T20:56:53Z")

</div>

What version of glibc are you using? I think that you need 2.28 or newer.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 18, 2019, 8:45am UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/30 "2019-06-18T08:45:05Z")

</div>

It's 2.29-1.

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [June 18, 2019, 3:28pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/31 "2019-06-18T15:28:46Z")

</div>

Could you verify that `statx.h` was included? `-H` to clang should show the include hierarchy.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 18, 2019, 4:13pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/32 "2019-06-18T16:13:26Z")

</div>

Well if you can point out where to put that flag. With the latest modification build stops here:

```
cd /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64 && /home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/bin/swiftc -emit-library -incremental -j 12 -module-name Foundation -module-link-name Foundation -emit-module-path /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/swift/Foundation.swiftmodule -DDEPLOYMENT_RUNTIME_SWIFT -DDEPLOYMENT_ENABLE_LIBDISPATCH -I /home/segabor/Workspace/swift-dev/build/buildbot_linux/libicu-linux-x86_64/tmp_install/include -I /home/segabor/Workspace/swift-dev/swift-corelibs-libdispatch -I /home/segabor/Workspace/swift-dev/build/buildbot_linux/libdispatch-linux-x86_64/src/swift -Xcc -fblocks -enable-testing -O -Xcc -F/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64 -output-file-map /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/output-file-map.json /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation/libCoreFoundation.a -l/usr/lib/libxml2.so -ldl -lm -ldispatch /home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicuucswift.so /home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicui18nswift.so /usr/lib/libxml2.so -L /home/segabor/Workspace/swift-dev/build/buildbot_linux/libdispatch-linux-x86_64 -L /home/segabor/Workspace/swift-dev/build/buildbot_linux/libdispatch-linux-x86_64/src -ldispatch -lswiftDispatch -Xlinker -rpath -Xlinker /home/segabor/Workspace/swift-dev/build/buildbot_linux/libdispatch-linux-x86_64/src /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/libuuid.a -Xlinker -rpath -Xlinker "\$ORIGIN" -o /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/libFoundation.so @/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/Foundation.rsp
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "Headers/CoreFoundation.h"
         ^
/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/CoreFoundation.h:101:10: note: in file included from /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/CoreFoundation.h:101:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:550:18: error: variable has incomplete type 'struct statx'
    struct statx statx_buffer = {0};
                 ^
/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:550:12: note: forward declaration of 'struct statx'
    struct statx statx_buffer = {0};
           ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "Headers/CoreFoundation.h"
         ^
/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/CoreFoundation.h:101:10: note: in file included from /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/CoreFoundation.h:101:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:553:68: error: use of undeclared identifier 'AT_STATX_SYNC_AS_STAT'
    ssize_t ret = _statx(AT_FDCWD, filename, AT_SYMLINK_NOFOLLOW | AT_STATX_SYNC_AS_STAT, STATX_ALL, &statx_buffer);
                                                                   ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "Headers/CoreFoundation.h"
         ^
/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/CoreFoundation.h:101:10: note: in file included from /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/CoreFoundation.h:101:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:553:91: error: use of undeclared identifier 'STATX_ALL'
    ssize_t ret = _statx(AT_FDCWD, filename, AT_SYMLINK_NOFOLLOW | AT_STATX_SYNC_AS_STAT, STATX_ALL, &statx_buffer);
                                                                                          ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "Headers/CoreFoundation.h"
         ^
/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/CoreFoundation.h:101:10: note: in file included from /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/CoreFoundation.h:101:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CoreFoundation.framework/Headers/ForSwiftFoundationOnly.h:571:37: error: use of undeclared identifier 'STATX_BTIME'
        if (statx_buffer.stx_mask & STATX_BTIME) {
                                    ^
/home/segabor/Workspace/swift-dev/swift-corelibs-foundation/Foundation/Bridging.swift:13:8: error: could not build C module 'CoreFoundation'
import CoreFoundation
       ^
ninja: build stopped: subcommand failed.
./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

```

Let me include the current change what makes trouble now:

```
diff --git a/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h b/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h
index 5dc221de..18d70b51 100644
--- a/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h
+++ b/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h
@@ -60,12 +60,12 @@
 #include <sys/syscall.h>
 #elif TARGET_OS_LINUX
 #include <features.h>
+#include <sys/syscall.h>
+#include <sys/stat.h>
 
 #if __GLIBC_PREREQ(2, 28) == 0
 // required for statx() system call, glibc >=2.28 wraps the kernel function
-#include <sys/syscall.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <linux/stat.h>
 #include <linux/fs.h>
 #define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */

```

Thanks again for your help.

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [June 19, 2019, 1:32am UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/33 "2019-06-19T01:32:19Z")

</div>

The flag would go on the compiler invocation (at the end is fine). I believe that a needed header (`statx.h`) is not being included.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 19, 2019, 1:57pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/34 "2019-06-19T13:57:41Z")

</div>

`swiftc` does not seem to accept `-E` parameter even supplied with `-Xcc`.

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [June 19, 2019, 4:57pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/35 "2019-06-19T16:57:33Z")

</div>

You shouldn't be passing that to `swiftc`. The file being compiled is C code, you should be looking at the `clang` invocation.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 20, 2019, 2:00pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/36 "2019-06-20T14:00:31Z")

</div>

Understood. But at this point swiftc is trying to do something with ForSwiftFoundationOnly.h and I cannot pass the wanted flag downward hoping that clang catches it.  
This is getting me really frustrated. So far I was able to build snapshots but now I'm stuck.  
What I don't get that "official" AUR package can build 5.0.1 release (although it has REPL issues).

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [June 20, 2019, 3:02pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/37 "2019-06-20T15:02:06Z")

</div>

Sorry, without actually being able to look at the details, the best I can do is suggest hints at how to investigate this. I don't run arch and don't have easy access to an environment to reproduce this issue. I think that you are missing a `#include <sys/statx.h>` after the inclusion of `<sys/stat.h>`. But, I do not have a way to verify the header location nor if it fixes anything.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [June 23, 2019, 11:38am UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/38 "2019-06-23T11:38:59Z")

</div>

Good news! Don't ask me what has changed but 5.1-DEVELOPMENT-SNAPSHOT-2019-06-21-a successfully built right away. Also tab completion bug in REPL is resolved in this version.

I can use swift on my Linux desktop again! Happy-happy me 🙂

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [July 30, 2019, 2:59pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/39 "2019-07-30T14:59:27Z")

</div>

Here again with a new issue. Now build system fails to build libFoundation, aborted pthreads test prevents it. It claims it has pthreads support but the test code itself does not compile.

Just noticed that cmake complains about incomplete configuration but no idea why.

Progress log:

```
+ rm -rf /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64
+ mkdir -p /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64
+ mkdir -p /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/.cmake/api/v1/query
+ touch /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/.cmake/api/v1/query/codemodelv2 /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/.cmake/api/v1/query/cache-v2
+ pushd /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64
~/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64 ~/Workspace/swift-dev
+ env /usr/bin/cmake -G Ninja -DCMAKE_C_COMPILER:PATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:PATH=/usr/bin/clang++ -DCMAKE_LIBTOOL:PATH=/usr/bin/libtool -DLLVM_VERSION_MAJOR:STRING=7 -DLLVM_VERSION_MINOR:STRING=0 -DLLVM_VERSION_PATCH:STRING=0 -DCLANG_VERSION_MAJOR:STRING=7 -DCLANG_VERSION_MINOR:STRING=0 -DCLANG_VERSION_PATCH:STRING=0 -DCMAKE_MAKE_PROGRAM=/home/segabor/Workspace/swift-dev/build/buildbot_linux/ninja-build/ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:PATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/bin/clang -DCMAKE_CXX_COMPILER:PATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/bin/clang++ -DCMAKE_SWIFT_COMPILER:PATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/bin/swiftc -DCMAKE_INSTALL_PREFIX:PATH=/usr/ -DICU_ROOT:PATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/libicu-linux-x86_64/tmp_install -DICU_INCLUDE_DIR:PATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/libicu-linux-x86_64/tmp_install/include -DICU_UC_LIBRARIES:FILEPATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicuucswift.so -DICU_UC_LIBRARY:FILEPATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicuucswift.so -DICU_UC_LIBRARY_DEBUG:FILEPATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicuucswift.so -DICU_UC_LIBRARY_RELEASE:FILEPATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicuucswift.so -DICU_I18N_LIBRARIES:FILEPATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicui18nswift.so -DICU_I18N_LIBRARY:FILEPATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicui18nswift.so -DICU_I18N_LIBRARY_DEBUG:FILEPATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicui18nswift.so -DICU_I18N_LIBRARY_RELEASE:FILEPATH=/home/segabor/Workspace/swift-dev/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicui18nswift.so -DFOUNDATION_PATH_TO_LIBDISPATCH_SOURCE=/home/segabor/Workspace/swift-dev/swift-corelibs-libdispatch -DFOUNDATION_PATH_TO_LIBDISPATCH_BUILD=/home/segabor/Workspace/swift-dev/build/buildbot_linux/libdispatch-linux-x86_64 -DENABLE_TESTING:BOOL=NO -DBUILD_SHARED_LIBS=YES /home/segabor/Workspace/swift-dev/swift-corelibs-foundation
CMake Error at CMakeLists.txt:10 (cmake_policy):
  cmake_policy given unknown first argument "CMP0091"

-- The C compiler identification is Clang 7.0.0
-- Check for working C compiler: /home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/bin/clang
-- Check for working C compiler: /home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found CURL: /usr/lib/libcurl.so (found version "7.65.3")  
CMake Warning (dev) at CMakeLists.txt:31 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
  command to set the policy and suppress this warning.

  CMake variable ICU_ROOT is set to:

     /home/segabor/Workspace/swift-dev/build/buildbot_linux/libicu-linux-x86_64/tmp_install

  For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Found ICU: /home/segabor/Workspace/swift-dev/build/buildbot_linux/libicu-linux-x86_64/tmp_install/include (found version "61.1") 
-- Found LibXml2: /usr/lib/libxml2.so (found version "2.9.9") 
-- Looking for sched.h
-- Looking for sched.h - found
-- Looking for sched_getaffinity
-- Looking for sched_getaffinity - found
-- The ASM compiler identification is Clang
-- Found assembler: /home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/bin/clang
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
CMake Warning (dev) at CoreFoundation/CMakeLists.txt:428 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
  command to set the policy and suppress this warning.

  CMake variable ICU_ROOT is set to:

    /home/segabor/Workspace/swift-dev/build/buildbot_linux/libicu-linux-x86_64/tmp_install

  For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Found ICU: /home/segabor/Workspace/swift-dev/build/buildbot_linux/libicu-linux-x86_64/tmp_install/include (found version "61.1") 
-- Configuring incomplete, errors occurred!
See also "/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CMakeFiles/CMakeOutput.log".
See also "/home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CMakeFiles/CMakeError.log".
./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

```

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [July 30, 2019, 3:02pm UTC](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388/40 "2019-07-30T15:02:41Z")

</div>

CMakeError.log content

```
[segabor@csihuhu swift-dev]$ cat /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux-x86_64/CMakeFiles/CMakeError.log
Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)":
clang version 7.0.0 (git@github.com:apple/swift-clang.git a2782120203542fdda3908731b74d00772a83b71) (git@github.com:apple/swift-llvm.git 200186e28b5d8984ea9a012d1571a5fd73b1651f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/bin
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/segabor/Workspace/swift-dev/build/buildbot_linux/foundation-linux- x86_64/CMakeFiles/CMakeTmp

Run Build Command(s):/home/segabor/Workspace/swift-dev/build/buildbot_linux/ninja-build/ninja cmTC_4399e && [1/2][50%][0.030s] Building C object CMakeFiles/cmTC_4399e.dir/src.c.o
[2/2][100%][0.055s] Linking C executable cmTC_4399e
FAILED: cmTC_4399e 
: && /home/segabor/Workspace/swift-dev/build/buildbot_linux/llvm-linux-x86_64/bin/clang -DCMAKE_HAVE_LIBC_PTHREAD CMakeFiles/cmTC_4399e.dir/src.c.o -o cmTC_4399e && :
/usr/bin/ld: CMakeFiles/cmTC_4399e.dir/src.c.o: in function `main':
src.c:(.text+0x32): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x3e): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x50): undefined reference to `pthread_join'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Source file was:
#include <pthread.h>

void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}

```

[Previous page](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388.md?page=1)

[Next page](https://forums.swift.org/t/building-recent-snapshot-fails-on-arch-linux/25388.md?page=3)
