KDevelop4:加载时出错的共享库 [英] KDevelop4: Error while loading shared libraries
问题描述
我想使用Intel MKL库的第一次。我使用的CMake来构建一个简单的项目中使用MKL。我在KDevelop的4.6环境中工作。
I am trying to use the Intel MKL libraries for the first time. I am using CMake to build a simple project in which MKL is used. I work in the KDevelop 4.6 environment.
该项目建成并没有错误安装。链接库因此是成功的。虽然在KDevelop的执行,我收到以下错误:
The project is built and installed without errors. Linking the libraries is thus succesful. While executing within KDevelop, I get the following error:
错误而载入共享库:libmkl_intel_lp64.so:无法打开共享对象文件:没有这样的文件或目录
该CMakeLists文件看起来基本如下:
The CMakeLists file looks essentially as follows:
project(testmkl)
cmake_minimum_required(VERSION 2.6)
enable_language(Fortran)
set(CMAKE_C_FLAGS "-std=c99 -Wall -lpthread")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# MKL
find_package(MKL REQUIRED)
include_directories(${MKL_INCLUDE_DIR})
find_package(M REQUIRED)
include_directories(${M_INCLUDES})
add_executable(testmkl ./main.c)
target_link_libraries(testmkl ${M_LIBRARIES} ${MKL_BLAS} ${MKL_LAPACK} ${MKL_INTEL} ${MKL_SEQUENTIAL} ${MKL_CORE})
install(TARGETS testmkl DESTINATION .)
libmkl_intel_lp64.so
在 LP_LIBRARY_PATH
环境变量的第一个文件夹中找到,所以我不希望的执行过程中的任何错误。其实,从命令窗口运行程序时,一切似乎很好地工作。
libmkl_intel_lp64.so
is found in the first folder of the LP_LIBRARY_PATH
environment variable, so I wouldn't expect any error during the execution. Actually, when running the program from the command window, everything seems to work fine.
该LDD输出的可执行文件是:
The ldd output for the executable is:
>> ldd ./testmkl
linux-vdso.so.1 => (0x00007fff951fe000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003061a00000)
libm.so.6 => /lib64/libm.so.6 (0x0000003061200000)
libmkl_intel_lp64.so => /opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64/libmkl_intel_lp64.so (0x00007f6f65ef6000)
libmkl_sequential.so => /opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64/libmkl_sequential.so (0x00007f6f65846000)
libmkl_core.so => /opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64/libmkl_core.so (0x00007f6f64317000)
libc.so.6 => /lib64/libc.so.6 (0x0000003060e00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003060600000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003061600000)
该链接库从而正确地找到。为什么不会在KDevelop的环境中工作方案?
The linked libraries are thus correctly found. Why won't the program work in the KDevelop environment?
欢迎任何帮助,非常感谢!
Any help is welcome, thanks!
推荐答案
首先一短的问题:你从终端excuting程序或试图从KDE的GUI(例如,通过双击)来执行?
First one short question: are you excuting your program from a terminal or trying to execute from KDE gui (e.g. by double-click)?
在许多Linux OS,现在则LD_LIBRARY_PATH德precated。 LD找到感谢的是,在 /etc/ld.so.conf中
上市和 /etc/ld.so.conf.d 依赖性code>。您可能需要添加脚本的某个地方,包括您的库。事实上,你只需要将路径添加到库中的这些脚本。
On many linux OS, now LD_LIBRARY_PATH is deprecated. LD finds the dependencies thanks to what is listed in /etc/ld.so.conf
and /etc/ld.so.conf.d
. You may have to add a script somewhere there to include your libraries. In fact you just have to add the path to your libraries in those scripts.
例如,从 /etc/ld.so.conf/libc.conf
:
# libc default configuration
/usr/local/lib
这可能会为你工作。
编辑:
你还跑768,16 ldconfig的
来更新数据库LD和/或使用 -v LDCONFIG
,它不相同,但有扩展的输出
edit:
you shoud also run ldconfig
to update the LD database and/or use ldconfig -v
, which does the same but with extended output
EDIT2: ldconfig的
可能需要root权限由GUI理解
edit2: ldconfig
may require root privileges to be understood by the GUI
这篇关于KDevelop4:加载时出错的共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!