[CMake] FindBlas and header file blas.h
Hello, On Ubuntu 12.04, I am compiling some third-party program code that #includes the BLAS header file blas.h. Although Cmake does find the BLAS and LAPACK libraries, I receive the following gcc compiler error: fatal error: blas.h: No such file or directory I've tried to change this include to other files such as lapacke.h but the include file is still not found. What I am doing wrong here? My Cmake file is reproduced below. Nicholas # cmake_minimum_required (VERSION 2.6) project (stretch-test) find_package( BLAS REQUIRED ) find_package( LAPACK REQUIRED ) set(CMAKE_C_FLAGS -std=c99) include_directories(${BLAS_INCLUDE_DIR} ${LAPACK_INCLUDE_DIR}) add_executable( stest main.c) # also link with C math library TARGET_LINK_LIBRARIES(stest m blas ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) -- 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
Re: [CMake] FindBlas and header file blas.h
On 01/03/2013 11:43 AM, Tim Gallagher wrote: Have you installed the development package for blas and lapack? Typically distributions have a library-only package and then a development package that includes the headers. Check for libblas-dev in Ubuntu. Tim Thanks, Tim; yes, I can verify that I have installed the developer packages. Here is my bash output when I try to use sudo to install libblas-dev. nkinar@Betty:~$ sudo apt-get install libblas-dev [sudo] password for nkinar: Reading package lists... Done Building dependency tree Reading state information... Done libblas-dev is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Moreover, running Cmake (via make compilation) tells me that the files are found; however, the blas.h header file is not found. nkinar@Betty:/media/RESEARCH/DEVELOP-SEISMIC/dip$ make -- A library with BLAS API found. -- A library with BLAS API found. -- A library with LAPACK API found. -- Configuring done -- Generating done -- Build files have been written to: /media/RESEARCH/DEVELOP-SEISMIC/dip [ 9%] Building C object CMakeFiles/stest.dir/conjgrad.c.o /media/RESEARCH/DEVELOP-SEISMIC/dip/conjgrad.c:26:18: fatal error: blas.h: No such file or directory compilation terminated. make[2]: *** [CMakeFiles/stest.dir/conjgrad.c.o] Error 1 make[1]: *** [CMakeFiles/stest.dir/all] Error 2 make: *** [all] Error 2 What am I still doing wrong here? Here is a full Cmake file that was used to create the output above: cmake_minimum_required (VERSION 2.6) project (stretch-test) # Blas library find_package( BLAS REQUIRED ) find_package( LAPACK REQUIRED ) # Required C99 compiler set(CMAKE_C_FLAGS -std=c99) include_directories(${BLAS_INCLUDE_DIR} ${LAPACK_INCLUDE_DIR}) add_executable( stest main.c allp3.c apfilt.c conjgrad.c dip3.c divn.c helper.c trianglen.c komplex.c adjnull.c c99.c ) # end # link with math library on Linux # link with blas on Linux TARGET_LINK_LIBRARIES(stest m blas ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) -- 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
Re: [CMake] FindBlas and header file blas.h
Have you installed the development package for blas and lapack? Typically distributions have a library-only package and then a development package that includes the headers. Check for libblas-dev in Ubuntu. Tim - Original Message - From: Nicholas Kinar n.ki...@usask.ca To: cmake@cmake.org Sent: Friday, March 1, 2013 11:50:06 AM Subject: [CMake] FindBlas and header file blas.h Hello, On Ubuntu 12.04, I am compiling some third-party program code that #includes the BLAS header file blas.h. Although Cmake does find the BLAS and LAPACK libraries, I receive the following gcc compiler error: fatal error: blas.h: No such file or directory I've tried to change this include to other files such as lapacke.h but the include file is still not found. What I am doing wrong here? My Cmake file is reproduced below. Nicholas # cmake_minimum_required (VERSION 2.6) project (stretch-test) find_package( BLAS REQUIRED ) find_package( LAPACK REQUIRED ) set(CMAKE_C_FLAGS -std=c99) include_directories(${BLAS_INCLUDE_DIR} ${LAPACK_INCLUDE_DIR}) add_executable( stest main.c) # also link with C math library TARGET_LINK_LIBRARIES(stest m blas ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) -- 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 -- 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
Re: [CMake] FindBlas and header file blas.h
And have you tried printing out the value of BLAS_INCLUDE_DIR? I'm not sure that actually exists, I don't see it set in my FindBLAS.cmake module. What is the path to blas.h? Have you verified it exists and is in one of the standard include locations such as /usr/include, /usr/local/include etc? It's possible it is in something like /usr/include/blas/blas.h and so it isn't found by default. Tim - Original Message - From: Nicholas Kinar n.ki...@usask.ca To: tim gallagher tim.gallag...@gatech.edu Cc: cmake@cmake.org Sent: Friday, March 1, 2013 12:57:33 PM Subject: Re: [CMake] FindBlas and header file blas.h On 01/03/2013 11:43 AM, Tim Gallagher wrote: Have you installed the development package for blas and lapack? Typically distributions have a library-only package and then a development package that includes the headers. Check for libblas-dev in Ubuntu. Tim Thanks, Tim; yes, I can verify that I have installed the developer packages. Here is my bash output when I try to use sudo to install libblas-dev. nkinar@Betty:~$ sudo apt-get install libblas-dev [sudo] password for nkinar: Reading package lists... Done Building dependency tree Reading state information... Done libblas-dev is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Moreover, running Cmake (via make compilation) tells me that the files are found; however, the blas.h header file is not found. nkinar@Betty:/media/RESEARCH/DEVELOP-SEISMIC/dip$ make -- A library with BLAS API found. -- A library with BLAS API found. -- A library with LAPACK API found. -- Configuring done -- Generating done -- Build files have been written to: /media/RESEARCH/DEVELOP-SEISMIC/dip [ 9%] Building C object CMakeFiles/stest.dir/conjgrad.c.o /media/RESEARCH/DEVELOP-SEISMIC/dip/conjgrad.c:26:18: fatal error: blas.h: No such file or directory compilation terminated. make[2]: *** [CMakeFiles/stest.dir/conjgrad.c.o] Error 1 make[1]: *** [CMakeFiles/stest.dir/all] Error 2 make: *** [all] Error 2 What am I still doing wrong here? Here is a full Cmake file that was used to create the output above: cmake_minimum_required (VERSION 2.6) project (stretch-test) # Blas library find_package( BLAS REQUIRED ) find_package( LAPACK REQUIRED ) # Required C99 compiler set(CMAKE_C_FLAGS -std=c99) include_directories(${BLAS_INCLUDE_DIR} ${LAPACK_INCLUDE_DIR}) add_executable( stest main.c allp3.c apfilt.c conjgrad.c dip3.c divn.c helper.c trianglen.c komplex.c adjnull.c c99.c ) # end # link with math library on Linux # link with blas on Linux TARGET_LINK_LIBRARIES(stest m blas ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) -- 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
Re: [CMake] FindBlas and header file blas.h
Also worth noting: I just checked on an Ubuntu machine and the header file is called cblas.h, not blas.h. If none of that helps, then I'm out of suggestions. I don't use Ubuntu and most of my code is in Fortran :) Tim - Original Message - From: Tim Gallagher tim.gallag...@gatech.edu To: Nicholas Kinar n.ki...@usask.ca Cc: cmake@cmake.org Sent: Friday, March 1, 2013 1:06:34 PM Subject: Re: [CMake] FindBlas and header file blas.h And have you tried printing out the value of BLAS_INCLUDE_DIR? I'm not sure that actually exists, I don't see it set in my FindBLAS.cmake module. What is the path to blas.h? Have you verified it exists and is in one of the standard include locations such as /usr/include, /usr/local/include etc? It's possible it is in something like /usr/include/blas/blas.h and so it isn't found by default. Tim - Original Message - From: Nicholas Kinar n.ki...@usask.ca To: tim gallagher tim.gallag...@gatech.edu Cc: cmake@cmake.org Sent: Friday, March 1, 2013 12:57:33 PM Subject: Re: [CMake] FindBlas and header file blas.h On 01/03/2013 11:43 AM, Tim Gallagher wrote: Have you installed the development package for blas and lapack? Typically distributions have a library-only package and then a development package that includes the headers. Check for libblas-dev in Ubuntu. Tim Thanks, Tim; yes, I can verify that I have installed the developer packages. Here is my bash output when I try to use sudo to install libblas-dev. nkinar@Betty:~$ sudo apt-get install libblas-dev [sudo] password for nkinar: Reading package lists... Done Building dependency tree Reading state information... Done libblas-dev is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Moreover, running Cmake (via make compilation) tells me that the files are found; however, the blas.h header file is not found. nkinar@Betty:/media/RESEARCH/DEVELOP-SEISMIC/dip$ make -- A library with BLAS API found. -- A library with BLAS API found. -- A library with LAPACK API found. -- Configuring done -- Generating done -- Build files have been written to: /media/RESEARCH/DEVELOP-SEISMIC/dip [ 9%] Building C object CMakeFiles/stest.dir/conjgrad.c.o /media/RESEARCH/DEVELOP-SEISMIC/dip/conjgrad.c:26:18: fatal error: blas.h: No such file or directory compilation terminated. make[2]: *** [CMakeFiles/stest.dir/conjgrad.c.o] Error 1 make[1]: *** [CMakeFiles/stest.dir/all] Error 2 make: *** [all] Error 2 What am I still doing wrong here? Here is a full Cmake file that was used to create the output above: cmake_minimum_required (VERSION 2.6) project (stretch-test) # Blas library find_package( BLAS REQUIRED ) find_package( LAPACK REQUIRED ) # Required C99 compiler set(CMAKE_C_FLAGS -std=c99) include_directories(${BLAS_INCLUDE_DIR} ${LAPACK_INCLUDE_DIR}) add_executable( stest main.c allp3.c apfilt.c conjgrad.c dip3.c divn.c helper.c trianglen.c komplex.c adjnull.c c99.c ) # end # link with math library on Linux # link with blas on Linux TARGET_LINK_LIBRARIES(stest m blas ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) -- 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 -- 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
Re: [CMake] FindBlas and header file blas.h
On 01/03/2013 11:57 AM, Nicholas Kinar wrote: Moreover, running Cmake (via make compilation) tells me that the files are found; however, the blas.h header file is not found. nkinar@Betty:/media/RESEARCH/DEVELOP-SEISMIC/dip$ make -- A library with BLAS API found. -- A library with BLAS API found. -- A library with LAPACK API found. -- Configuring done -- Generating done -- Build files have been written to: /media/RESEARCH/DEVELOP-SEISMIC/dip [ 9%] Building C object CMakeFiles/stest.dir/conjgrad.c.o /media/RESEARCH/DEVELOP-SEISMIC/dip/conjgrad.c:26:18: fatal error: blas.h: No such file or directory compilation terminated. make[2]: *** [CMakeFiles/stest.dir/conjgrad.c.o] Error 1 make[1]: *** [CMakeFiles/stest.dir/all] Error 2 make: *** [all] Error 2 What am I still doing wrong here? The issue appears to be that on Ubuntu, blas.h is named cblas.h. This file was installed in the /usr/include directory. Changing blas.h to cblas.h fixes the problem, and allows the compile to continue properly. Nicholas -- 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
Re: [CMake] FindBlas and header file blas.h
On 01/03/2013 11:57 AM, Nicholas Kinar wrote: Moreover, running Cmake (via make compilation) tells me that the files are found; however, the blas.h header file is not found. nkinar@Betty:/media/RESEARCH/DEVELOP-SEISMIC/dip$ make -- A library with BLAS API found. -- A library with BLAS API found. -- A library with LAPACK API found. -- Configuring done -- Generating done -- Build files have been written to: /media/RESEARCH/DEVELOP-SEISMIC/dip [ 9%] Building C object CMakeFiles/stest.dir/conjgrad.c.o /media/RESEARCH/DEVELOP-SEISMIC/dip/conjgrad.c:26:18: fatal error: blas.h: No such file or directory compilation terminated. make[2]: *** [CMakeFiles/stest.dir/conjgrad.c.o] Error 1 make[1]: *** [CMakeFiles/stest.dir/all] Error 2 make: *** [all] Error 2 What am I still doing wrong here? On Ubuntu, blas.h is named cblas.h and is installed into the /usr/include directory. Changing #include blas.h to #include cblas.h apparently fixes the problem. Nicholas -- 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
Re: [CMake] FindBlas and header file blas.h
On 01/03/2013 12:10 PM, Tim Gallagher wrote: Also worth noting: I just checked on an Ubuntu machine and the header file is called cblas.h, not blas.h. If none of that helps, then I'm out of suggestions. I don't use Ubuntu and most of my code is in Fortran :) Tim - Original Message - From: Tim Gallagher tim.gallag...@gatech.edu To: Nicholas Kinar n.ki...@usask.ca Cc: cmake@cmake.org Sent: Friday, March 1, 2013 1:06:34 PM Subject: Re: [CMake] FindBlas and header file blas.h And have you tried printing out the value of BLAS_INCLUDE_DIR? I'm not sure that actually exists, I don't see it set in my FindBLAS.cmake module. What is the path to blas.h? Have you verified it exists and is in one of the standard include locations such as /usr/include, /usr/local/include etc? It's possible it is in something like /usr/include/blas/blas.h and so it isn't found by default. Tim Yes, you are absolutely right, Tim; thanks for checking. Nicholas -- 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