在 Linux 上链接 clapack
我正在将一个使用 clapack 的项目从 osx 迁移到 linux,并遇到一些问题。我通过下载 cmake 项目、编译必要的 .h 和 .a 文件并将其移动到项目中的相关位置来使用 clapack。
我在两种情况(osx 和 linux)中使用了相同的步骤,并且在两台机器上都有相同的源代码,但是我无法在 linux 上正确链接所有内容。
我的 cmake 文件中的代码行看起来像这样
#-----------------------------------------------------------------------------
# INCLUDE CLAPACK
#-----------------------------------------------------------------------------
INCLUDE_DIRECTORIES(${VMT_PRJ_SOURCE_DIR}/CLAPACK)
LINK_DIRECTORIES(${VMT_PRJ_SOURCE_DIR}/CLAPACK/lib)
LINK_LIBRARIES(blas f2c lapack tmglib)
,我收到的错误看起来像这样
/CLAPACK/lib/liblapack.a(sgesvd.c.o): In function `sgesvd_':
sgesvd.c:(.text+0x456): undefined reference to `s_cat'
sgesvd.c:(.text+0x1fa4): undefined reference to `s_cat'
这是我第一次完成从 osx 到 linux 的移植,不知道是否需要提出一些不同的要求为了链接或问题是什么
任何帮助将不胜感激。
斯科特
I am moving a project which uses clapack from osx to linux and experiencing some problems with it. I use clapack by downloading the cmake project, compiling and moving the necessary .h and .a files to a relevant location within my project.
I have used the same steps in both scenarios (osx and linux) and have the same exact source code on both machines however I cannot get the everything to link properly on linux.
the lined of code in my cmake file look like this
#-----------------------------------------------------------------------------
# INCLUDE CLAPACK
#-----------------------------------------------------------------------------
INCLUDE_DIRECTORIES(${VMT_PRJ_SOURCE_DIR}/CLAPACK)
LINK_DIRECTORIES(${VMT_PRJ_SOURCE_DIR}/CLAPACK/lib)
LINK_LIBRARIES(blas f2c lapack tmglib)
and the error I am getting looks like this
/CLAPACK/lib/liblapack.a(sgesvd.c.o): In function `sgesvd_':
sgesvd.c:(.text+0x456): undefined reference to `s_cat'
sgesvd.c:(.text+0x1fa4): undefined reference to `s_cat'
This is the first time I have done a port from osx to linux and don't know if there are some different requirements I need to make in order to link or what the problem is
Any help would be much appreciated.
Scott
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
链接的顺序很重要。由于
liblapack.a
需要来自libf2c.a
的函数,因此后者需要位于前者之后。因此更改为
应该有所帮助。
The order of linking matters. Since
liblapack.a
needs functions fromlibf2c.a
, the latter needs to come after the former. So changingto
should help.