我的系统和文件上安装了 gfortranlibgfortran.a
可以在以下位置找到/usr/lib/gcc/x86_64-linux-gnu/4.6/
. Using nm
我确定该功能_gfortran_compare_string
在那里定义:
$ nm /usr/lib/gcc/x86_64-linux-gnu/4.6/libgfortran.a | grep _gfortran_compare_string
Returns
0000000000000000 T _gfortran_compare_string
0000000000000000 T _gfortran_compare_string_char4
但是,我的 CUDA-C 程序的链接器抛出错误:
/usr/local/cuda-6.0/bin/nvcc --cudart static -L/usr/lib/gcc/x86_64-linux-gnu/4.6 -L/home/chung/lapack-3.5.0 -link -o "pQP" ./src/pQP.o -lgfortran -llapacke -llapack -lcublas -lblas -lcurand
nvcc warning : The 'compute_10' and 'sm_10' architectures are deprecated, and may be removed in a future release.
/home/chung/lapack-3.5.0/liblapack.a(ilaenv.o): In function `ilaenv_':
ilaenv.f:(.text+0x81): undefined reference to `_gfortran_compare_string'
后来出现另一个错误,同样与 libgfortran 有关:
/home/chung/lapack-3.5.0/liblapack.a(xerbla.o): In function `xerbla_':
xerbla.f:(.text+0x49): undefined reference to `_gfortran_st_write'
xerbla.f:(.text+0x54): undefined reference to `_gfortran_string_len_trim'
xerbla.f:(.text+0x66): undefined reference to `_gfortran_transfer_character_write'
xerbla.f:(.text+0x76): undefined reference to `_gfortran_transfer_integer_write'
xerbla.f:(.text+0x7e): undefined reference to `_gfortran_st_write_done'
xerbla.f:(.text+0x87): undefined reference to `_gfortran_stop_string'
但是,再次使用 nm,我发现_gfortran_st_write
等在 libgfortran.a 中定义。
Links: 完整日志 https://gist.github.com/alphaville/0e2342b2e85c8b5ab33f and 源代码 https://github.com/alphaville/pQP.
Note:Lapack 使用 libgfortran。我最近安装了 lapack 并运行了所有测试,它们都通过了。