CMake libifport.so。5:无法打开共享对象文件:没有这样的文件或目录

时间:2021-12-12 12:44:19

I am trying to using cmake-gui to make a makefile to link fortran and python together. Everthing works fine when I was configuring and generating the makefile. But after I got the library and trying to use it in python. It turns out the problem that:

我正在尝试使用cmake-gui创建一个makefile,将fortran和python链接在一起。在配置和生成makefile时,一切都运行良好。但是在我得到库并尝试在python中使用它之后。问题是:

Traceback (most recent call last):
File "startDEMO.py", line 2, in <module>
import libdemo


ImportError: libifport.so.5: cannot open shared object file: No such file or directory

I am a new to the cmake,please took at my cmakelist. I want to create fortran as a subroutine and use python to do the operation.

我是新来这里的,请到我的商品目录看看。我想将fortran创建为子例程,并使用python执行操作。

cmake_minimum_required(VERSION 2.8.6)
PROJECT(Demo)
include(CMakeForceCompiler)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
CMAKE_FORCE_CXX_COMPILER(icpc "Intel Cxx Compiler")
CMAKE_FORCE_C_COMPILER(icc "Intel C Compiler")
CMAKE_FORCE_Fortran_COMPILER(ifort "Intel Fortran Compiler")
ELSE()
CMAKE_FORCE_CXX_COMPILER(icl.exe "Intel Cxx Compiler")
CMAKE_FORCE_C_COMPILER(icl.exe "Intel C Compiler")
CMAKE_FORCE_Fortran_COMPILER(ifort.exe "Intel Fortran Compiler")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
message(STATUS ${CMAKE_Fortran_COMPILER})
message(STATUS ${CMAKE_CXX_COMPILER})
message(STATUS ${CMAKE_C_COMPILER})
enable_language( Fortran )

SET(EXECUTABLE_OUTPUT_PATH ".")
SET(LIBRARY_OUTPUT_PATH  ".")

SET(SRC_COMP_LIB
     hello.f90
     md.f90
     startDEMO.py
)

ADD_LIBRARY(demo SHARED ${SRC_COMP_LIB} )
SET_TARGET_PROPERTIES(demo PROPERTIES LINKER_LANGUAGE Fortran)

Anyone could help me to do something with the cmakelist?

有人能帮我做一些cmakelist的事情吗?

1 个解决方案

#1


1  

Did you do

你做了

source /opt/intel/bin/compilervars.sh intel64    

(or ia32)

(或ia32)

that should be always done when using Intel compilers?

在使用英特尔编译器时应该始终这样做?

#1


1  

Did you do

你做了

source /opt/intel/bin/compilervars.sh intel64    

(or ia32)

(或ia32)

that should be always done when using Intel compilers?

在使用英特尔编译器时应该始终这样做?