On Wed, Jan 19, 2011 at 3:27 AM, Eric Noulard <span dir="ltr">&lt;<a href="mailto:eric.noulard@gmail.com">eric.noulard@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2011/1/19 Jack Poulson &lt;<a href="mailto:jack.poulson@gmail.com">jack.poulson@gmail.com</a>&gt;:<br>
<div><div></div><div class="h5">&gt; I have no idea why this would occur, but with CMake 2.8.2 on x86_64 I&#39;m<br>
&gt; getting strange behavior with check_function_exists. Namely, if I perform<br>
&gt; the sequence<br>
&gt; set(CMAKE_REQUIRED_LIBRARIES ${MATH_LIBS})<br>
&gt; check_function_exists(daxpy HAVE_DAXPY)<br>
&gt; whether or not /usr/lib/libpthread.a or /usr/lib/libpthread.so is in the<br>
&gt; list changes the answer, even though daxpy is defined in a completely<br>
&gt; different library!<br>
&gt; Output with libpthread.so:<br>
&gt; --<br>
&gt; MATH_LIBS=/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_scalapack_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_blacs_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_thread.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_core.a;/opt/intel/Compiler/11.1/072/lib/intel64/libguide.a;/opt/intel/Compiler/11.1/072/lib/intel64/libiomp5.a;/usr/lib/libpthread.so<br>

&gt; -- Looking for daxpy<br>
&gt; -- Looking for daxpy - found<br>
&gt; Output with libpthread.a:<br>
&gt; --<br>
&gt; MATH_LIBS=/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_scalapack_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_blacs_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_lp64.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_thread.a;/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_core.a;/opt/intel/Compiler/11.1/072/lib/intel64/libguide.a;/opt/intel/Compiler/11.1/072/lib/intel64/libiomp5.a;/usr/lib/libpthread.a<br>

&gt; -- Looking for daxpy<br>
&gt; -- Looking for daxpy - not found<br>
&gt;<br>
&gt; Any ideas what would be causing this strange behavior? And while I&#39;m on the<br>
&gt; subject, should check_function_exist work with dynamic libraries? I had to<br>
&gt; give up some portability and force find_library to search for the static MKL<br>
&gt; libraries just to get the libpthread.so case to work.<br>
&gt; I apologize in advance if I&#39;ve missed something obvious...<br>
<br>
</div></div>May be you have an implicit dependency on dynamic pthread somewhere.<br>
Are you using icc or gcc ?<br>
<br></blockquote><div><br></div><div>I was using icc for C++ for the project, but it appears check_function_exists was defaulting to gcc for the C compilation.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

As far as I remember check_function_exists is using try_compile.<br>
May be you can try to run CMake with<br>
<br>
--debug-trycompile and look into files<br>
<br>
I don&#39;t remember where they are... but I&#39;m sure someone will tell you that.<br>
<font color="#888888"><br></font></blockquote><div><br></div><div>I used your suggestion of --debug-trycompile and found that there was an undefined reference for _dl_stack_flags in libpthread.a. The output of check_function_exists was fairly misleading in this case...perhaps it should output just &#39;found&#39; or &#39;not found&#39;.</div>
<div><br></div><div>Thank you for the help!</div><div><br></div><div>Jack</div></div><br>