且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在搜索-lcudart时跳过不兼容的libcudart.so

更新时间:2021-10-28 21:51:04

当尝试将64位代码与32位库链接时,通常会发生此警告,请参阅以下问题:跳过不兼容的库编译

This warning often happens when trying to link a 64-bit code with a 32-bit library, see this question: Skipping Incompatible Libraries at compile.

您需要区分两个库文件:

You need to distinguish 2 library files:


  • $ CUDA_HOME / lib / libcudart.so 是32位版本的 cudart 库。

  • $ CUDA_HOME / lib64 / libcudart.so cudart 库的64位版本。

  • $CUDA_HOME/lib/libcudart.so, the 32-bit version of the cudart library.
  • $CUDA_HOME/lib64/libcudart.so, the 64-bit version of the cudart library.

(在您的情况下, $ CUDA_HOME / usr / local /cuda-5.0

基本上,链接器首先找到32位库( -L $

Basically, the linker finds the 32-bit library first (-L options are searched in order) and returns that warning even if it ends up finding the proper library.

您可能需要添加选项, $ CUDA_HOME / lib 环境变量$ $ CUDA_HOME / lib64 code> ld 可以在32位版本之前为您的64位架构找到合适的库。

You probably need to add $CUDA_HOME/lib64 to your LD_LIBRARY_PATH environment variable before $CUDA_HOME/lib so that ld can find the proper library for your 64-bit architecture before the 32-bit version.