Fail to build with SCOTCH and PASTIX

Issue #506 wontfix
getzze created an issue

Hello, I am using ArchLinux and trying to build dolfin from the AUR (https://aur.archlinux.org/packages/dolfin-git/). Dolfin builds correctly, except the linking to the optional packages SCOTCH and PASTIX. It fails during the tests. For SCOTCH :

 -- Found SCOTCH (version 6.0.0)
-- Performing test SCOTCH_TEST_RUNS
-- Performing test SCOTCH_TEST_RUNS - Failed
-- [ /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/cmake/modules/FindSCOTCH.cmake:268 ] SCOTCH_TEST_LIB_COMPILED = FALSE
-- [ /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/cmake/modules/FindSCOTCH.cmake:270 ] SCOTCH_TEST_LIB_COMPILE_OUTPUT = Change Dir: /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec1886730031/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec1886730031.dir/build.make CMakeFiles/cmTryCompileExec1886730031.dir/build
make[1]: Entering directory '/tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec1886730031.dir/scotch_test_lib.cpp.o
/usr/bin/g++    -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4  -std=c++11  -I/opt/petsc/arch-linux2-cxx-opt/include    -o CMakeFiles/cmTryCompileExec1886730031.dir/scotch_test_lib.cpp.o -c /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/scotch_test_lib.cpp
Linking CXX executable cmTryCompileExec1886730031
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1886730031.dir/link.txt --verbose=1
/usr/bin/g++   -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4  -std=c++11    -Wl,-O1,--sort-common,--as-needed,-z,relro  CMakeFiles/cmTryCompileExec1886730031.dir/scotch_test_lib.cpp.o  -o cmTryCompileExec1886730031 -rdynamic -lptscotch -lscotch -lptscotcherr /usr/lib64/openmpi/libmpi_cxx.so /usr/lib64/openmpi/libmpi.so -Wl,-rpath,/usr/lib64/openmpi 
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzReadGetUnused'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzWriteClose'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzReadOpen'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzRead'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzWriteOpen'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzWrite'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzReadClose'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTryCompileExec1886730031.dir/build.make:93: recipe for target 'cmTryCompileExec1886730031' failed
make[1]: *** [cmTryCompileExec1886730031] Error 1
make[1]: Leaving directory '/tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp'
Makefile:117: recipe for target 'cmTryCompileExec1886730031/fast' failed
make: *** [cmTryCompileExec1886730031/fast] Error 2

-- [ /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/cmake/modules/FindSCOTCH.cmake:272 ] SCOTCH_TEST_LIB_EXITCODE = 
-- [ /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/cmake/modules/FindSCOTCH.cmake:274 ] SCOTCH_TEST_LIB_OUTPUT = 
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.8") 
-- Performing test SCOTCH_ZLIB_TEST_RUNS
-- Performing test SCOTCH_ZLIB_TEST_RUNS - Failed
-- [ /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/cmake/modules/FindSCOTCH.cmake:311 ] SCOTCH_ZLIB_TEST_LIB_COMPILED = FALSE
-- [ /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/cmake/modules/FindSCOTCH.cmake:313 ] SCOTCH_ZLIB_TEST_LIB_COMPILE_OUTPUT = Change Dir: /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec3018861140/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3018861140.dir/build.make CMakeFiles/cmTryCompileExec3018861140.dir/build
make[1]: Entering directory '/tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec3018861140.dir/scotch_test_lib.cpp.o
/usr/bin/g++    -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4  -std=c++11  -I/opt/petsc/arch-linux2-cxx-opt/include    -o CMakeFiles/cmTryCompileExec3018861140.dir/scotch_test_lib.cpp.o -c /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/scotch_test_lib.cpp
Linking CXX executable cmTryCompileExec3018861140
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3018861140.dir/link.txt --verbose=1
/usr/bin/g++   -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4  -std=c++11    -Wl,-O1,--sort-common,--as-needed,-z,relro  CMakeFiles/cmTryCompileExec3018861140.dir/scotch_test_lib.cpp.o  -o cmTryCompileExec3018861140 -rdynamic -lptscotch -lscotch -lptscotcherr /usr/lib64/openmpi/libmpi_cxx.so /usr/lib64/openmpi/libmpi.so -lz -Wl,-rpath,/usr/lib64/openmpi 
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzReadGetUnused'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzWriteClose'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzReadOpen'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzRead'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzWriteOpen'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzWrite'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libscotch.so: undefined reference to `BZ2_bzReadClose'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTryCompileExec3018861140.dir/build.make:94: recipe for target 'cmTryCompileExec3018861140' failed
make[1]: *** [cmTryCompileExec3018861140] Error 1
make[1]: Leaving directory '/tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp'
Makefile:117: recipe for target 'cmTryCompileExec3018861140/fast' failed
make: *** [cmTryCompileExec3018861140/fast] Error 2

-- [ /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/cmake/modules/FindSCOTCH.cmake:315 ] SCOTCH_TEST_LIB_EXITCODE = 
-- [ /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/cmake/modules/FindSCOTCH.cmake:317 ] SCOTCH_TEST_LIB_OUTPUT = 
-- SCOTCH could not be found. Be sure to set SCOTCH_DIR. (missing:  SCOTCH_TEST_RUNS)

And for PASTIX (from CMakeError.log) :

Performing C SOURCE FILE Test PASTIX_TEST_RUNS failed with the following output:
Change Dir: /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec4104957961/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec4104957961.dir/build.make CMakeFiles/cmTryCompileExec4104957961.dir/build
make[1]: Entering directory '/tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec4104957961.dir/src.c.o
/usr/bin/cc   -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4  -DPASTIX_TEST_RUNS  -fopenmp   -o CMakeFiles/cmTryCompileExec4104957961.dir/src.c.o   -c /tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTryCompileExec4104957961
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec4104957961.dir/link.txt --verbose=1
/usr/bin/cc  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4  -DPASTIX_TEST_RUNS  -fopenmp   -Wl,-O1,--sort-common,--as-needed,-z,relro  CMakeFiles/cmTryCompileExec4104957961.dir/src.c.o  -o cmTryCompileExec4104957961 -rdynamic -Wl,-Bstatic -lpastix -Wl,-Bdynamic -lrt -lm -lhwloc -lblas /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libgfortran.so /usr/lib64/openmpi/libmpi.so 
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_order_save':
(.text+0x2c48): undefined reference to `SCOTCH_graphSave'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_order_load':
(.text+0x2e00): undefined reference to `SCOTCH_graphLoad'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x36aa): undefined reference to `SCOTCH_graphInit'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x36fc): undefined reference to `SCOTCH_graphBuild'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x3733): undefined reference to `SCOTCH_graphCheck'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x3745): undefined reference to `SCOTCH_stratInit'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x3751): undefined reference to `SCOTCH_graphBase'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x37be): undefined reference to `SCOTCH_stratGraphOrder'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x380f): undefined reference to `SCOTCH_graphOrderList'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x3821): undefined reference to `SCOTCH_stratExit'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x39b8): undefined reference to `SCOTCH_graphBuild'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x3b16): undefined reference to `SCOTCH_stratExit'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x3b76): undefined reference to `SCOTCH_graphOrderList'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x3ef3): undefined reference to `SCOTCH_graphBuild'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x3f16): undefined reference to `SCOTCH_graphBase'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x3fd4): undefined reference to `SCOTCH_graphExit'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x402c): undefined reference to `SCOTCH_graphExit'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_scotch':
(.text+0x40dc): undefined reference to `SCOTCH_graphSave'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(pastix.o): In function `pastix_task_fax':
(.text+0x449e): undefined reference to `SCOTCH_graphExit'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(dof.o): In function `dofGraph':
(.text+0x9f): undefined reference to `SCOTCH_graphData'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(symbol_fax_graph.o): In function `symbolFaxGraph':
(.text+0x59): undefined reference to `SCOTCH_graphData'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(bordi.o): In function `orderSplit2':
(.text+0x45b): undefined reference to `SCOTCH_graphData'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(bordi.o): In function `orderSplit3':
(.text+0x88d): undefined reference to `SCOTCH_graphData'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib/libpastix.a(bordi.o): In function `bordi':
(.text+0x1744): undefined reference to `SCOTCH_graphData'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTryCompileExec4104957961.dir/build.make:95: recipe for target 'cmTryCompileExec4104957961' failed
make[1]: *** [cmTryCompileExec4104957961] Error 1
make[1]: Leaving directory '/tmp/yaourt-tmp-blacoste088/aur-dolfin-git/src/dolfin/build/CMakeFiles/CMakeTmp'
Makefile:117: recipe for target 'cmTryCompileExec4104957961/fast' failed
make: *** [cmTryCompileExec4104957961/fast] Error 2

Return value: 1
Source file was:

/* Test program pastix */

#define MPICH_IGNORE_CXX_SEEK 1
#include <stdint.h>
#include <mpi.h>
#include <pastix.h>

int main()
{
  pastix_int_t iparm[IPARM_SIZE];
  double       dparm[DPARM_SIZE];
  int i = 0;
  for (i = 0; i < IPARM_SIZE; ++i)
    iparm[i] = 0;
  for (i = 0; i < DPARM_SIZE; ++i)
    dparm[i] = 0.0;

  // Set default parameters
  pastix_initParam(iparm, dparm);

  return 0;
}

The problem seems to come from library linking. Scotch needs th bz2 lib, which is not linked in the compilation of scotch_test_lib.cpp. And for pastix, the linking to scotch library seems to be missing.

I don't have the environment variables SCOTCH_DIR and PASTIX_DIR set. Can it be the problem? I set them with export SCOTCH_DIR=/usr/include to the folder where the headers of the two libraries are (/usr/include in my case) without success.

Any idea?

Thanks

Comments (6)

  1. Chris Richardson

    Please try emailing fenics-support@fenicsproject.org. ArchLinux is not explicitly supported by the project.

  2. getzze reporter

    The installation on ArchLinux is not different from compiling from the source. It follows the installation procedure with these special options for cmake:

    cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/g++ \
    -DCMAKE_INSTALL_PREFIX="${pkg}"/usr \
        -DPYTHON_EXECUTABLE:PATH="${py2_interp}" \
        -DPYTHON_INCLUDE_DIR:PATH="${py2_inc}" \
        -DPYTHON_LIBRARY:FILEPATH="${py2_lib}" \
    -DDOLFIN_ENABLE_VTK=ON \
        -DCMAKE_SKIP_BUILD_RPATH=TRUE \
    -DCMAKE_SKIP_RPATH=TRUE \
    -DCMAKE_BUILD_TYPE="Debug"
    

    I really think it is a problem of missing dependency to bz2 lib. I am not an expert in cmake, so I don't know how to include the dependency.

  3. getzze reporter

    Solved. They were two independent problems: - with Scotch: my version was compiled with the bzip2 library, so the flag -lbz2 has to be added anytime scotch is used. Solved by rebuilding Scotch without this dependency. But a solution would be to add the bzip2 libs in dolfin/cmake/modules/FindSCOTCH.cmake

    • with Pastix: my version was built with scotch support so the scotch libraries should be added:

    modified file dolfin/cmake/modules/FindPaStiX.cmake after line 55 (check for hwloc libs) add the lines:

    # Check for scotch header
    find_path(SCOTCH_INCLUDE_DIRS scotch.h
      HINTS ${SCOTCH_DIR} $ENV{SCOTCH_DIR} ${SCOTCH_DIR}/include $ENV{SCOTCH_DIR}/include ${SCOTCH_DIR}/include/scotch
      DOC "Directory where the scotch header is located"
     )
    
    # Check for scotch library
    find_library(SCOTCH_LIBRARY scotch
      HINTS ${SCOTCH_DIR} $ENV{SCOTCH_DIR} ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib
      DOC "The scotch library"
      )
    
    if (SCOTCH_LIBRARY)
      set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARY})
    endif()
    

    However Pastix provides a tool (pastix-conf on linux) to list all the libraries on which it depends. It may be a better approach to include all dependencies.

  4. mylese

    Since this has been reopened, I'll just say that the AUR packages for pastix and dolfin-git handle this now. Scotch still has the bz2 dependency, and therefore so does pastix, dolfin is patched to find it.

  5. Log in to comment