<div dir="ltr">I watched <a href="https://www.youtube.com/watch?v=StF77Cx7pz8">Chris Bieneman's talk</a> 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.<div><span style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit"><br></span></div><div><span style="color:rgb(36,39,41);font-family:inherit;font-size:15px;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit">I'm getting this failure trying to cross compile LLVM v3.7 (linux x64 -> Aarch64) w/ cmake:</span><div><div class="gmail-votecell gmail-post-layout--left" style="margin:0px;padding:0px 15px 0px 0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:13px;vertical-align:top;box-sizing:inherit;width:auto;color:rgb(36,39,41)"><div class="gmail-js-voting-container gmail-grid gmail-fd-column gmail-ai-stretch gmail-gs4 gmail-fc-black-200" style="padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;display:flex;color:rgb(187,192,196)"><button class="gmail-js-favorite-btn gmail-s-btn gmail-s-btn__unset gmail-c-pointer gmail-py8" title="Click to mark as favorite question (click again to undo)" style="margin:0px;box-sizing:inherit;font:inherit;padding:0px;border-width:initial;border-style:none;border-color:initial;border-radius:3px;background-image:none;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;outline:none"><div class="gmail-js-favorite-count gmail-mt8" style="margin:8px 0px 0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit"></div></button></div></div><div class="gmail-postcell gmail-post-layout--right" style="margin:0px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:13px;vertical-align:top;box-sizing:inherit;width:auto;min-width:0px;color:rgb(36,39,41)"><div class="gmail-post-text" style="margin:0px 0px 5px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:1.3;font-size:15px;vertical-align:baseline;box-sizing:inherit;width:676px"><pre style="margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);border-radius:3px"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit"><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
</code></pre><p style="margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">this is then followed by numerous other "undefined symbol: pthread_blah" errors in the CMakeError.log file.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">I have four questions:</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">(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).</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">(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.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">(3) The cmake command <em style="margin:0px;padding:0px;border:0px;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">seems</em> 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!".</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">(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.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;clear:both">I gratefully thank you for your patience and time reading all of that ^^^.</p></div></div></div></div></div>