在 Linux 上链接 clapack

发布于 2024-12-29 12:10:06 字数 873 浏览 4 评论 0原文

我正在将一个使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪眸﹌ 2025-01-05 12:10:06

链接的顺序很重要。由于liblapack.a需要来自libf2c.a的函数,因此后者需要位于前者之后。因此更改

LINK_LIBRARIES(blas f2c lapack tmglib)

LINK_LIBRARIES(blas lapack f2c tmglib)

应该有所帮助。

The order of linking matters. Since liblapack.a needs functions from libf2c.a, the latter needs to come after the former. So changing

LINK_LIBRARIES(blas f2c lapack tmglib)

to

LINK_LIBRARIES(blas lapack f2c tmglib)

should help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文