Unable to link to libgfortran.a [duplicate]

我们两清 提交于 2019-12-05 18:02:29

You need to change the order in which you specify static libraries to the linker. If you do something like this:

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  \ 
-llapacke -llapack -lcublas -lblas -lcurand -lgfortran 

You should find it will work.

The underlying reason (and this is a trait of the gcc/gnu toolchain and not anything to do with nvcc) is that linking dependency lists for static libraries are parsed from left to right by the gnu linker. If you specify a static library before any library which depends on it, it will be skipped because it has no dependencies in the link list at the point in processing when it is first encountered.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!