llvm-...@lists.llvm.org<mailto:llvm-...@lists.llvm.org> would also be a good 
place to ask questions about the LLVM build system :)


  1.  I believe it’s just called the configure phase. (There’s also the 
generation phase, where CMake actually generates the build system.)
  2.  How have you set up your cross-compilation? LLVM’s build system has logic 
to link pthread if needed, so I’m wondering why that’s failing.
  3.  LLVM’s cross-compilation runs a sub-configure for some native build 
components (e.g. TableGen) – perhaps one of those sub-configures is succeeding 
but the main configure is failing? I’ve never seen the “Build files have been 
written to” and “Configuring incomplete, errors occurred” messages from the 
same configure.
  4.  You can use a CMake cache file – see “-C <initial-cache>” in 
https://cmake.org/cmake/help/latest/manual/cmake.1.html#options

How come you’re working with LLVM 3.7, btw? That’s pretty old at this point, 
and newer versions will have improved the build system (and it’s also a lot 
easier to provide assistance for them).

From: CMake <cmake-boun...@cmake.org> on behalf of SC Warrior <bhh...@gmail.com>
Date: Wednesday, April 10, 2019 at 5:09 PM
To: "cmake@cmake.org" <cmake@cmake.org>
Subject: [CMake] cmake build of LLVM: HAVE_CXX_ATOMICS_WITHOUT_LIB test failure

I watched Chris Bieneman's talk<https://www.youtube.com/watch?v=StF77Cx7pz8> 
about the transition of LLVM from autoconf to cmake and he raved about how 
friendly / vibrant the cmake community is so I thought I'd ask this here.  I 
posted it to stack overflow but it's fairly involved so I hope it's cool that I 
post (my first) in this forum.


I'm getting this failure trying to cross compile LLVM v3.7 (linux x64 -> 
Aarch64) w/ cmake:

<path to clang>/clang++  -DHAVE_CXX_ATOMICS_WITHOUT_LIB -std=c++11  -rdynamic 
CMakeFiles/cmTC_82a21.dir/src.cxx.o  -o cmTC_82a21  -lm -ldl && :

ld.lld: error: undefined symbol: pthread_once

referenced by cxa_exception_storage.cpp

this is then followed by numerous other "undefined symbol: pthread_blah" errors 
in the CMakeError.log file.

I have four questions:

(1) What is this phase of operation that cmake is performing to determine the 
capabilities of the build environment / platform called ? (i.e. the 
configure-like phase that performs numerous small compilation tests to see if 
they succeed, looks to see if it can find header files in expected paths, etc).

(2) It looks to me that including -lpthread as part of the test compilation 
line would fix this problem. (a) Is there a way to tell cmake to do that and 
(b) is that a smart approach to solving this problem ? Seems like if I could 
tell cmake to do this it would pass these tests.

(3) The cmake command seems to succeed as it finishes with "Build files have 
been written to ...". What should I make of that when one of these pre-tests 
has a failure condition as cited above and reports "Configuring incomplete, 
errors occurred!".

(4) I'm trying to get this cmake cross compile build to work with the stock 
LLVM v3.7 cmake files so I'm trying to control cmake using command line options 
only. This gets a little ugly and I'm wondering if there's a simple way to put 
all of these settings in a cmake file instead. One problem with that approach 
is that I'm not familiar with all of the targets in LLVM so if I were, to say, 
attempt to add libraries to targets to fix a linking problem, I wouldn't know 
offhand what targets to add them to. I'm hoping that in this case I can hit it 
with a bigger hammer and have them added everywhere with hopes of them being 
ignored if not used.

I gratefully thank you for your patience and time reading all of that ^^^.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to