On Wed, Jan 19, 2011 at 3:27 AM, Eric Noulard <[email protected]>wrote:
> 2011/1/19 Jack Poulson <[email protected]>: > > I have no idea why this would occur, but with CMake 2.8.2 on x86_64 I'm > > getting strange behavior with check_function_exists. Namely, if I perform > > the sequence > > set(CMAKE_REQUIRED_LIBRARIES ${MATH_LIBS}) > > check_function_exists(daxpy HAVE_DAXPY) > > whether or not /usr/lib/libpthread.a or /usr/lib/libpthread.so is in the > > list changes the answer, even though daxpy is defined in a completely > > different library! > > Output with libpthread.so: > > -- > > > 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 > > -- Looking for daxpy > > -- Looking for daxpy - found > > Output with libpthread.a: > > -- > > > 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 > > -- Looking for daxpy > > -- Looking for daxpy - not found > > > > Any ideas what would be causing this strange behavior? And while I'm on > the > > subject, should check_function_exist work with dynamic libraries? I had > to > > give up some portability and force find_library to search for the static > MKL > > libraries just to get the libpthread.so case to work. > > I apologize in advance if I've missed something obvious... > > May be you have an implicit dependency on dynamic pthread somewhere. > Are you using icc or gcc ? > > I was using icc for C++ for the project, but it appears check_function_exists was defaulting to gcc for the C compilation. As far as I remember check_function_exists is using try_compile. > May be you can try to run CMake with > > --debug-trycompile and look into files > > I don't remember where they are... but I'm sure someone will tell you that. > > 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 'found' or 'not found'. Thank you for the help! Jack
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
