← Back to team overview

dorsal team mailing list archive

Re: Downgrading to DOLFIN 0.9.9 and Armadillo 0.8.0

 

On Thu, Mar 10, 2011 at 6:00 PM, Johannes Ring <johannr@xxxxxxxxx> wrote:
> On Thu, Mar 10, 2011 at 5:53 PM, Marie E. Rognes <meg@xxxxxxxxx> wrote:
>>
>> I'm desperately trying to install DOLFIN 0.9.9(!) As far as I remember, that
>> requires an armadillo version < 1.0.0 (for instance 0.8.0).
>>
>> Installing said armadillo and DOLFIN 0.9.9 via dorsal gives me
>>
>> Building dolfin-0.9.9
>> -- Checking for package 'Armadillo'
>> -- Checking for package 'LAPACK'
>> CMake Error at
>> /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:70
>> (MESSAGE):
>>  Armadillo could not be found.  Be sure to set ARMADILLO_DIR.  (missing:
>>  ARMADILLO_TEST_RUNS)
>> Call Stack (most recent call first):
>>  cmake/modules/FindArmadillo.cmake:139 (find_package_handle_standard_args)
>>  CMakeLists.txt:156 (find_package)
>>
>> Could someone remind me of what variables to set to what to get this
>> rolling?
>
> When I built DOLFIN 0.9.9 recently I simply replaced
> cmake/modules/FindArmadillo.cmake with the one from DOLFIN-dev. Then
> you should be able to use whatever Armadillo version you want.

BTW, there are some other build related fixes that I stole from
DOLFIN-dev when I built 0.9.9 that also might be useful (see attached
patch).

Johannes
diff -Nru dolfin-0.9.9.orig/cmake/modules/FindArmadillo.cmake dolfin-0.9.9/cmake/modules/FindArmadillo.cmake
--- dolfin-0.9.9.orig/cmake/modules/FindArmadillo.cmake	2011-02-25 09:27:58.000000000 +0100
+++ dolfin-0.9.9/cmake/modules/FindArmadillo.cmake	2011-03-02 14:15:34.000000000 +0100
@@ -18,14 +18,14 @@
 
 find_path(ARMADILLO_INCLUDE_DIRS
   NAMES armadillo
-  PATHS ${ARMADILLO_DIR}/include $ENV{ARMADILLO_DIR}/include
+  HINTS ${ARMADILLO_DIR}/include $ENV{ARMADILLO_DIR}/include
   DOC "Directory where the Armadillo header file is located"
   )
 mark_as_advanced(ARMADILLO_INCLUDE_DIRS)
 
 find_library(ARMADILLO_LIBRARIES
   NAMES armadillo
-  PATHS ${ARMADILLO_DIR}/lib $ENV{ARMADILLO_DIR}/lib
+  HINTS ${ARMADILLO_DIR}/lib $ENV{ARMADILLO_DIR}/lib
   DOC "The Armadillo library"
   )
 mark_as_advanced(ARMADILLO_LIBRARIES)
@@ -50,14 +50,14 @@
   include(CheckCXXSourceRuns)
 
   # Armadillo needs the location of the Boost header files
-  if (NOT Boost_INCLUDE_DIR)
+  if (NOT Boost_FOUND)
     set(BOOST_ROOT $ENV{BOOST_DIR})
-    set(Boost_ADDITIONAL_VERSIONS 1.43 1.43.0)
+    set(Boost_ADDITIONAL_VERSIONS 1.43 1.43.0 1.44 1.44.0 1.45 1.45.0)
     find_package(Boost REQUIRED)
   endif()
 
   # These are needed for the try_run and check_cxx_source_runs commands below
-  set(CMAKE_REQUIRED_INCLUDES ${ARMADILLO_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
+  set(CMAKE_REQUIRED_INCLUDES ${ARMADILLO_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
   set(CMAKE_REQUIRED_LIBRARIES ${ARMADILLO_LIBRARIES})
   if (ARMADILLO_LINK_FLAGS)
     set(CMAKE_REQUIRED_LIBRARIES ${ARMADILLO_LINK_FLAGS} ${CMAKE_REQUIRED_LIBRARIES})
@@ -83,6 +83,7 @@
     ARMADILLO_CONFIG_TEST_VERSION_COMPILED
     ${CMAKE_CURRENT_BINARY_DIR}
     ${ARMADILLO_CONFIG_TEST_VERSION_CPP}
+    CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
     RUN_OUTPUT_VARIABLE OUTPUT
     )
 
@@ -90,25 +91,19 @@
     set(ARMADILLO_VERSION ${OUTPUT} CACHE TYPE STRING)
   endif()
 
-  # Check that C++ program runs
-  check_cxx_source_compiles("
+  if (${ARMADILLO_VERSION} VERSION_GREATER "0.9.10")
+    set(armadillo_test_str "
 #include <armadillo>
 int main()
 {
- arma::mat A = arma::rand(4, 4);
- arma::vec b = arma::rand(4);
+ arma::mat A = arma::randu(4, 4);
+ arma::vec b = arma::randu(4);
  arma::vec x = arma::solve(A, b);
  return 0;
 }
-"
-    ARMADILLO_TEST_RUNS)
-
-  # If program runs, trying adding LAPACK library and test again
-  if(NOT ARMADILLO_TEST_RUNS)
-    find_package(LAPACK)
-    if (LAPACK_LIBRARIES)
-      set(CMAKE_REQUIRED_LIBRARIES ${ARMADILLO_LIBRARIES} ${LAPACK_LIBRARIES})
-      check_cxx_source_runs("
+")
+  else()
+    set(armadillo_test_str "
 #include <armadillo>
 int main()
 {
@@ -117,8 +112,20 @@
  arma::vec x = arma::solve(A, b);
  return 0;
 }
-"
-      ARMADILLO_LAPACK_TEST_RUNS)
+")
+  endif()
+
+  # Check that C++ program runs
+  check_cxx_source_runs("${armadillo_test_str}" ARMADILLO_TEST_RUNS)
+
+  # If program does not run, try adding LAPACK library and test again
+  if(NOT ARMADILLO_TEST_RUNS)
+    if (NOT LAPACK_FOUND)
+      find_package(LAPACK)
+    endif()
+    if (LAPACK_LIBRARIES)
+      set(CMAKE_REQUIRED_LIBRARIES ${ARMADILLO_LIBRARIES} ${LAPACK_LIBRARIES})
+      check_cxx_source_runs("${armadillo_test_str}" ARMADILLO_LAPACK_TEST_RUNS)
 
       # Add LAPACK libary if required
       if (ARMADILLO_LAPACK_TEST_RUNS)
@@ -138,4 +145,4 @@
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(Armadillo
   "Armadillo could not be found. Be sure to set ARMADILLO_DIR."
-  ARMADILLO_TEST_RUNS)
+  ARMADILLO_LIBRARIES ARMADILLO_INCLUDE_DIRS ARMADILLO_TEST_RUNS)
diff -Nru dolfin-0.9.9.orig/cmake/modules/FindCGAL.cmake dolfin-0.9.9/cmake/modules/FindCGAL.cmake
--- dolfin-0.9.9.orig/cmake/modules/FindCGAL.cmake	2011-02-25 09:27:58.000000000 +0100
+++ dolfin-0.9.9/cmake/modules/FindCGAL.cmake	2011-02-25 09:29:35.000000000 +0100
@@ -9,10 +9,14 @@
 message(STATUS "Checking for package 'CGAL'")
 
 # Call CGAL supplied CMake script
-find_package(CGAL PATHS ${CGAL_DIR}/lib $ENV{CGAL_DIR}/lib)
+find_package(CGAL
+  HINTS
+  ${CGAL_DIR}
+  $ENV{CGAL_DIR}
+  PATH_SUFFIXES lib cmake/modules)
 
 # Set variables
-set(CGAL_INCLUDE_DIRS ${CGAL_INCLUDE_DIRS})
+set(CGAL_INCLUDE_DIRS ${CGAL_INCLUDE_DIRS} ${CGAL_3RD_PARTY_INCLUDE_DIRS})
 set(CGAL_LIBRARIES ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES})
 
 # Try compiling and running test program
diff -Nru dolfin-0.9.9.orig/cmake/modules/FindNumPy.cmake dolfin-0.9.9/cmake/modules/FindNumPy.cmake
--- dolfin-0.9.9.orig/cmake/modules/FindNumPy.cmake	2011-02-25 09:27:58.000000000 +0100
+++ dolfin-0.9.9/cmake/modules/FindNumPy.cmake	2011-02-25 09:28:25.000000000 +0100
@@ -9,10 +9,10 @@
   set(NUMPY_FIND_QUIETLY TRUE)
 endif(NUMPY_INCLUDE_DIR)
 
-exec_program("${PYTHON_EXECUTABLE}"
-  ARGS "-c 'import numpy; print numpy.get_include()'"
+execute_process(
+  COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.get_include()"
   OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
-  RETURN_VALUE NUMPY_NOT_FOUND)
+  RESULT_VARIABLE NUMPY_NOT_FOUND)
 
 if(NUMPY_INCLUDE_DIR)
   set(NUMPY_FOUND TRUE)
diff -Nru dolfin-0.9.9.orig/cmake/modules/FindPETSc.cmake dolfin-0.9.9/cmake/modules/FindPETSc.cmake
--- dolfin-0.9.9.orig/cmake/modules/FindPETSc.cmake	2011-02-25 09:27:58.000000000 +0100
+++ dolfin-0.9.9/cmake/modules/FindPETSc.cmake	2011-02-28 12:40:22.000000000 +0100
@@ -104,7 +104,7 @@
   # Define macro for getting PETSc variables from Makefile
   macro(PETSC_GET_VARIABLE var name)
     set(${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
-    execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} -f ${petsc_config_makefile} show VARIABLE=${name}
+    execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name}
       OUTPUT_VARIABLE ${var}
       RESULT_VARIABLE petsc_return)
   endmacro()
diff -Nru dolfin-0.9.9.orig/cmake/modules/FindSLEPc.cmake dolfin-0.9.9/cmake/modules/FindSLEPc.cmake
--- dolfin-0.9.9.orig/cmake/modules/FindSLEPc.cmake	2011-02-25 09:27:58.000000000 +0100
+++ dolfin-0.9.9/cmake/modules/FindSLEPc.cmake	2011-02-28 12:40:36.000000000 +0100
@@ -65,7 +65,7 @@
   # Define macro for getting SLEPc variables from Makefile
   macro(SLEPC_GET_VARIABLE var name)
     set(${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
-    execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} -f ${slepc_config_makefile} show VARIABLE=${name}
+    execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --no-print-directory -f ${slepc_config_makefile} show VARIABLE=${name}
       OUTPUT_VARIABLE ${var}
       RESULT_VARIABLE slepc_return)
   endmacro()

Follow ups

References