Hi,
I found that building LLVM in single-threaded mode with CMake is failing because some object files still have references to pthread routines. There are two instances of the build failure happening.
$ cmake …/llvm/ -DLLVM_ENABLE_THREADS=0
$ make -j8 check-all
% Linking CXX executable IRTests
…/…/lib/libgtest.a(gtest.cc.o): In function testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::~ThreadLocal()': gtest.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x15): undefined reference to
pthread_getspecific’
% Linking CXX executable SupportTests
CMakeFiles/SupportTests.dir/ManagedStatic.cpp.o: In function (anonymous namespace)::Initialize_MultipleThreads_Test::TestBody()': ManagedStatic.cpp:(.text+0x9a): undefined reference to
pthread_create’
ManagedStatic.cpp:(.text+0xb7): undefined reference to pthread_create' ManagedStatic.cpp:(.text+0xc8): undefined reference to
pthread_join’
ManagedStatic.cpp:(.text+0xd9): undefined reference to `pthread_join’
I am attaching a patch which fixes the above mentioned failures. Could you please review the patch?
Thanks,
Manish
0001-Added-conditionalization-code-to-prevent-pulling-pth.patch (1.6 KB)