Building recent snapshot fails on Arch Linux

Gist updated

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?

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.

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

#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)

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

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

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

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

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

It's 2.29-1.

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

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.

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.

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

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

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).

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.

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 :slightly_smiling_face:

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

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;
}
Terms of Service

Privacy Policy

Cookie Policy