GeoEnergyLab-EPFL / PyFrac

a Python planar 3D hydraulic fracture growth solver
http://pyfrac.epfl.ch/
Other
34 stars 20 forks source link

Problems with installation PyFrac on Windows #2

Closed AlexUser97 closed 1 year ago

AlexUser97 commented 1 year ago

I try to perform step number 5 in intsallation guide, but receive this error

-- Configuring done
-- Generating done
-- Build files have been written to: /d/PyFrac/TI_Kernel
[ 77%] Building CXX object CMakeFiles/TI_elasticity_kernel.dir/src/AssemblyDDM.cpp.o
[ 88%] Building CXX object CMakeFiles/TI_elasticity_kernel.dir/src/Selfcorr.cpp.o
[100%] Linking CXX executable build/TI_elasticity_kernel.exe
/usr/lib/gcc/x86_64-pc-msys/11.3.0/../../../../x86_64-pc-msys/bin/ld: cannot find -lopenblas: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/TI_elasticity_kernel.dir/build.make:209: build/TI_elasticity_kernel.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/TI_elasticity_kernel.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

The CMakeLists file in D:\PyFrac\TI_Kernel folder looks like:

# Copyright (c) ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland,
# Geo-Energy Laboratory, 2016-2019.  All rights reserved.
# See the LICENSE.TXT file for more details.
#
# Contributors:
# Brice Lecampion
# Haseeb Zia

cmake_minimum_required(VERSION 3.6)

project(TI_elasticity_kernel)

set(CMAKE_CXX_STANDARD 11)

set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/build)
# provide the correct path of folders containg OpenBLAS include files and libraries in the following. Note that if you
# are using msys2 on windows, you have to set it for UNIX.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIL_OPENBLAS -DIL_BLAS")
set(CMAKE_OPENBLAS_LIBRARIES "openblas")

if (UNIX AND NOT APPLE)
    # For windows, provide the correct path of folders containing OpenBLAS include files and libraries in the following.
    # Note that we are using msys2 on windows, so we are setting it for UNIX.
    include_directories(/C/Users/Alexandr/Documents/GitHub/OpenBLAS/include)
    link_directories(/C/Users/Alexandr/Documents/GitHub/OpenBLAS/lib)
elseif(APPLE)  # for APPLE
    include_directories(/usr/local/opt/openblas/include)
    link_directories(/usr/local/opt/openblas/lib)
endif()

set(SOURCE_FILES_DIR ${PROJECT_SOURCE_DIR}/src)

set(SOURCE_FILES
        main.cpp
        src/elasticity_kernel_integration.cpp
        src/mesh.cpp
        src/inputE.cpp
        src/elasticity_kernel_isotropy.cpp
        il/io/numpy/numpy.cpp
        src/AssemblyDDM.cpp
        src/output.h src
        src/Selfcorr.cpp)

add_executable(TI_elasticity_kernel ${SOURCE_FILES})

target_link_libraries(TI_elasticity_kernel  ${CMAKE_OPENBLAS_LIBRARIES})
target_compile_definitions(TI_elasticity_kernel PRIVATE IL_OPENBLAS=1 IL_BLAS=1)
target_include_directories(TI_elasticity_kernel PRIVATE ${CMAKE_SOURCE_DIR})
Skonki commented 1 year ago

Dear Alex,

sorry for our late reply.

According to your error, your CMake cannot find the openblas library.

It might simply be that your line:

"link_directories(/C/Users/Alexandr/Documents/GitHub/OpenBLAS/lib)" points to the wrong file.

For example we often point to:

"link_directories(../OpenBLAS/build/lib)"

where the .. are representative of the path to the OpenBLAS folder. So in your case it might be something like

"link_directories(/C/Users/Alexandr/Documents/GitHub/OpenBLAS/build/lib)"

At the moment I cannot see another issue with your code provided.

Best regards and happy holidays