Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem compiling opm-grid on Arch Linux #561

Closed
ducbueno opened this issue Dec 12, 2021 · 4 comments
Closed

Problem compiling opm-grid on Arch Linux #561

ducbueno opened this issue Dec 12, 2021 · 4 comments

Comments

@ducbueno
Copy link

Hello there everyone.

I've been trying to build OPM in a secondary machine I have which has Arch Linux installed, however I've been facing some issues. There problems start when the build reaches opm-grid and seem to be related to MPI. I get several of the following error messages from CMake:

CMake Error at /home/ducbueno/src/opm/opm-common/cmake/Modules/OpmCompile.cmake:41 (add_library):
  Target "opmgrid" links to target "MPI::MPI_C" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?
Call Stack (most recent call first):
  /home/ducbueno/src/opm/opm-common/cmake/Modules/OpmLibMain.cmake:181 (opm_compile)
  CMakeLists.txt:119 (include)

The error happens whether I install openmpi or mpich. I haven't found any other MPI related packages for Arch Linux.

Does anyone have experience with this or knows how to fix this?

Thanks!

@ducbueno
Copy link
Author

ducbueno commented Dec 12, 2021

Here is the CMakeError.log:

Determining if the function sgemm_ exists failed with the following output:
Change Dir: /home/ducbueno/src/opm/opm-grid/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_50da3/fast && /usr/bin/make  -f CMakeFiles/cmTC_50da3.dir/build.make CMakeFiles/cmTC_50da3.dir/build
make[1]: Entering directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_50da3.dir/CheckFunctionExists.c.o
/usr/bin/cc   -std=c99 -DCHECK_FUNCTION_EXISTS=sgemm_ -o CMakeFiles/cmTC_50da3.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
Linking C executable cmTC_50da3
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_50da3.dir/link.txt --verbose=1
/usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=sgemm_ CMakeFiles/cmTC_50da3.dir/CheckFunctionExists.c.o -o cmTC_50da3 
/usr/bin/ld: CMakeFiles/cmTC_50da3.dir/CheckFunctionExists.c.o: in function `main':
CheckFunctionExists.c:(.text+0x10): undefined reference to `sgemm_'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_50da3.dir/build.make:99: cmTC_50da3] Error 1
make[1]: Leaving directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_50da3/fast] Error 2



Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/ducbueno/src/opm/opm-grid/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_ea0b3/fast && /usr/bin/make  -f CMakeFiles/cmTC_ea0b3.dir/build.make CMakeFiles/cmTC_ea0b3.dir/build
make[1]: Entering directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_ea0b3.dir/src.c.o
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD  -std=c99  -o CMakeFiles/cmTC_ea0b3.dir/src.c.o -c /home/ducbueno/src/opm/opm-grid/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_ea0b3
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ea0b3.dir/link.txt --verbose=1
/usr/bin/cc -std=c99  CMakeFiles/cmTC_ea0b3.dir/src.c.o -o cmTC_ea0b3 
/usr/bin/ld: CMakeFiles/cmTC_ea0b3.dir/src.c.o: in function `main':
src.c:(.text+0x3e): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x4a): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x56): undefined reference to `pthread_cancel'
/usr/bin/ld: src.c:(.text+0x67): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_ea0b3.dir/build.make:99: cmTC_ea0b3] Error 1
make[1]: Leaving directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_ea0b3/fast] Error 2


Source file was:
#include <pthread.h>

static void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_cancel(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/ducbueno/src/opm/opm-grid/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_c5bc6/fast && /usr/bin/make  -f CMakeFiles/cmTC_c5bc6.dir/build.make CMakeFiles/cmTC_c5bc6.dir/build
make[1]: Entering directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c5bc6.dir/CheckFunctionExists.c.o
/usr/bin/cc   -std=c99 -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_c5bc6.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
Linking C executable cmTC_c5bc6
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c5bc6.dir/link.txt --verbose=1
/usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_c5bc6.dir/CheckFunctionExists.c.o -o cmTC_c5bc6  -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_c5bc6.dir/build.make:99: cmTC_c5bc6] Error 1
make[1]: Leaving directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_c5bc6/fast] Error 2



Determining if the function cheev_ exists failed with the following output:
Change Dir: /home/ducbueno/src/opm/opm-grid/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_012e2/fast && /usr/bin/make  -f CMakeFiles/cmTC_012e2.dir/build.make CMakeFiles/cmTC_012e2.dir/build
make[1]: Entering directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_012e2.dir/CheckFunctionExists.c.o
/usr/bin/cc   -std=c99 -DCHECK_FUNCTION_EXISTS=cheev_ -o CMakeFiles/cmTC_012e2.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
Linking C executable cmTC_012e2
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_012e2.dir/link.txt --verbose=1
/usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=cheev_ CMakeFiles/cmTC_012e2.dir/CheckFunctionExists.c.o -o cmTC_012e2  /usr/lib/libblas.so -lpthread -lm -ldl 
/usr/bin/ld: CMakeFiles/cmTC_012e2.dir/CheckFunctionExists.c.o: in function `main':
CheckFunctionExists.c:(.text+0x10): undefined reference to `cheev_'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_012e2.dir/build.make:100: cmTC_012e2] Error 1
make[1]: Leaving directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_012e2/fast] Error 2



Determining if the function cheev_ exists failed with the following output:
Change Dir: /home/ducbueno/src/opm/opm-grid/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_f0e4e/fast && /usr/bin/make  -f CMakeFiles/cmTC_f0e4e.dir/build.make CMakeFiles/cmTC_f0e4e.dir/build
make[1]: Entering directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_f0e4e.dir/CheckFunctionExists.c.o
/usr/bin/cc   -std=c99 -DCHECK_FUNCTION_EXISTS=cheev_ -o CMakeFiles/cmTC_f0e4e.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.22/Modules/CheckFunctionExists.c
Linking C executable cmTC_f0e4e
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f0e4e.dir/link.txt --verbose=1
/usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=cheev_ CMakeFiles/cmTC_f0e4e.dir/CheckFunctionExists.c.o -o cmTC_f0e4e  /usr/lib/liblapack.so /usr/lib/libblas.so -fortranlibs 
cc: error: unrecognized command-line option ‘-fortranlibs’
make[1]: *** [CMakeFiles/cmTC_f0e4e.dir/build.make:101: cmTC_f0e4e] Error 1
make[1]: Leaving directory '/hdd/src/opm/opm-grid/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:127: cmTC_f0e4e/fast] Error 2

@ducbueno
Copy link
Author

And here is what CMake prints before the errors:

-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_C99
-- Performing Test HAVE_C99 - Success
-- Found C99: -std=c99  
-- Found Boost: /usr/lib64/cmake/Boost-1.76.0/BoostConfig.cmake (found suitable version "1.76.0", minimum required is "1.44.0") found components: system unit_test_framework 
-- Performing Test HAVE_CJSON
-- Performing Test HAVE_CJSON - Success
-- Found cjson: /usr/include/cjson  
CMake Deprecation Warning at /home/ducbueno/src/opm/opm-common/cmake/Modules/OpmInit.cmake:26 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:65 (OpmSetPolicies)


-- Looking for sgemm_
-- Looking for sgemm_ - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Found BLAS: /usr/lib/libblas.so  
-- Looking for cheev_
-- Looking for cheev_ - not found
-- Looking for cheev_
-- Looking for cheev_ - not found
-- Looking for cheev_
-- Looking for cheev_ - found
-- Found LAPACK: /usr/lib/liblapack.so;/usr/lib/libblas.so  
-- Performing Test HAVE_CXA_DEMANGLE
-- Performing Test HAVE_CXA_DEMANGLE - Success
-- Found GMP: /usr/lib/libgmpxx.so  
-- Found dune-common: /usr/include  
-- Version 2.8.0 of dune-common from /usr/lib64/cmake/dune-common
-- Found dune-geometry: /usr/include  
-- Version 2.8.0 of dune-geometry from /usr/lib64/cmake/dune-geometry
-- Found dune-uggrid: /usr/include  
-- Version 2.8.0 of dune-uggrid from /usr/lib64/cmake/dune-uggrid
-- Found dune-grid: /usr/include  
-- Version 2.8.0 of dune-grid from /usr/lib64/cmake/dune-grid
CMake Warning at /home/ducbueno/src/opm/opm-common/cmake/Modules/FindParMETIS.cmake:116 (message):
  MPI not found ==> ParMETIS disabled! Plase make sure -DUSE_MPI=ON was set
  if you need ParMETIS.
Call Stack (most recent call first):
  /home/ducbueno/src/opm/opm-common/cmake/Modules/OpmFind.cmake:144 (find_package)
  /home/ducbueno/src/opm/opm-common/cmake/Modules/OpmPackage.cmake:189 (find_and_append_package_to)
  /home/ducbueno/src/opm/opm-common/cmake/Modules/OpmPackage.cmake:87 (find_package_deps)
  /home/ducbueno/src/opm/opm-common/cmake/Modules/Finddune-istl.cmake:14 (find_opm_package)
  /home/ducbueno/src/opm/opm-common/cmake/Modules/OpmFind.cmake:144 (find_package)
  /home/ducbueno/src/opm/opm-common/cmake/Modules/OpmPackage.cmake:189 (find_and_append_package_to)
  opm-grid-prereqs.cmake:34 (find_package_deps)
  CMakeLists.txt:74 (include)


-- Performing Test HAVE_UMFPACK_WITHOUT_CHOLMOD
-- Performing Test HAVE_UMFPACK_WITHOUT_CHOLMOD - Success
-- Creating target SuitSparse::umfpack
-- Found SuiteSparse: /usr/lib/libumfpack.so;/usr/lib/libamd.so  
-- Found dune-istl: /usr/include  
-- Version 2.8.0 of dune-istl from /usr/lib64/cmake/dune-istl
-- Found PTScotch: /usr/include/scotch  
-- Could NOT find ZOLTAN (missing: MPI_FOUND) 
-- Setting OPM_TESTS_ROOT: /hdd/src/opm/opm-grid/../opm-tests
-- Performing Test HAVE_ATTRIBUTE_ALWAYS_INLINE
-- Performing Test HAVE_ATTRIBUTE_ALWAYS_INLINE - Success
-- Performing Test HAS_ATTRIBUTE_UNUSED
-- Performing Test HAS_ATTRIBUTE_UNUSED - Success
-- Performing Test HAS_ATTRIBUTE_DEPRECATED
-- Performing Test HAS_ATTRIBUTE_DEPRECATED - Success
-- Performing Test HAS_ATTRIBUTE_DEPRECATED_MSG
-- Performing Test HAS_ATTRIBUTE_DEPRECATED_MSG - Success
-- CMake version: 3.22.1
-- Linux distribution: Arch Linux
-- Target architecture: x86_64
-- Found Git: /usr/bin/git (found version "2.34.1") 
-- Source code repository: git 4bee258d
-- GNU C++ compiler version: 11.1.0
-- Linker: ld 2.36.1
Processing opm_defaults opm-grid
-- Checking to see if CXX compiler accepts flag -Wl,--enable-new-dtags
-- Checking to see if CXX compiler accepts flag -Wl,--enable-new-dtags - yes
-- Precompiled headers: disabled
-- Build type: Release
-- Checking to see if CXX compiler accepts flag -mtune=native
-- Checking to see if CXX compiler accepts flag -mtune=native - yes
-- All warnings enabled: -Wall -Wextra -Wshadow
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Checking to see if CXX compiler accepts flag -pthread
-- Checking to see if CXX compiler accepts flag -pthread - yes
-- Found CppCheck: /usr/bin/cppcheck  
-- Disabling clang-check as CMAKE_EXPORT_COMPILE_COMMANDS is not enabled
-- Generating debug symbols: -ggdb3
-- Looking for strip utility
-- Looking for strip utility - found
-- Performing Test HAVE_DYNAMIC_BOOST_TEST
-- Performing Test HAVE_DYNAMIC_BOOST_TEST - Success
-- Writing config file "/hdd/src/opm/opm-grid/build/config.h"...

@blattms
Copy link
Member

blattms commented Dec 13, 2021

This is a result of our current incompatible default settings with DUNE and using our own special way of building. It only happens for newer DUNE version that use imported targets. I have been bitten by this myself quite a few times.

The easiest work around is to set the defaults to DUNE's defaults e.g.

cmake -DUSE_MPI=ON -DUSE_SUPERLU=ON -DUSE_QUADMATH=ON

or in a options file passed to cmake cmake -C /path/to/opts.file with entries like

set(USE_MPI ON         CACHE STRING "Use mpi")
set(USE_SUPERLU ON CACHE String "Use superlu")
set(USE_QUADMATH ON CACHE String "Use quadmath")

@ducbueno
Copy link
Author

That solved it! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants