Связывание внешней библиотеки архивов cblas с помощью cmake

Я загрузил и собрал (по-видимому, правильно) соответствующие библиотеки BLAS и CBLAS (с netlib.org/blas) в моей среде Linux Fedora. Результатом этого стал файл blas_LINUX.a, который я переименовал в libblas.a и скопировал в \usr\local\lib, и файл cblas.h, который я скопировал в \usr\include. Впоследствии я попытался сослаться на это в файле CMakeList.txt в проекте CLion. Файл выглядит следующим образом:

project(test C)
cmake_minimum_required(VERSION 3.10)

set(CMAKE_C_STANDARD 99)

include_directories(include)

add_executable(${PROJECT_NAME} src/main.c)

find_library(blas libblas.a /usr/local/lib)
MESSAGE(STATUS "CBLAS location is: " ${blas})

target_link_libraries(${PROJECT_NAME} ${blas})

Судя по сообщению, которое cmake выдает при перезагрузке, похоже, что библиотека cblas найдена нормально. Однако, когда я пытаюсь запустить свое приложение, я получаю следующее сообщение об ошибке компоновщика:

undefined reference to `cblas_dgemm`

Ниже приведено содержимое моего файла main.c.

#include <stdio.h>
#include <stdlib.h>

#include <cblas.h>

int main(int arg, char *args[]) {

  .
  .
  .

    printf("Processing cblas_dgemm matrix multiplication.\n");
    cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, N, N, N, alpha, A[0], N, B[0], N, beta, C[0], N);

  .
  .
  .
    return 0;
}

Я не совсем уверен, где я ошибаюсь. Я новичок в использовании cmake, и я хожу кругами, пытаясь понять, в чем проблема, при поиске в Интернете. Любые указатели в правильном направлении будут приняты и оценены.

Поправка (CMakeOutput.txt выглядит следующим образом)

The system is: Linux - 5.4.8-200.fc31.x86_64 - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/bin/cc 
Build flags: 
Id flags:  

The output was:
0


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"

The C compiler identification is GNU, found in "/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/3.15.3/CompilerIdC/a.out"

Determining if the C compiler works passed with the following output:
Change Dir: /home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_3ac25/fast && gmake[1]: Entering directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp'
/usr/bin/gmake -f CMakeFiles/cmTC_3ac25.dir/build.make CMakeFiles/cmTC_3ac25.dir/build
gmake[2]: Entering directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3ac25.dir/testCCompiler.c.o
/usr/bin/cc    -o CMakeFiles/cmTC_3ac25.dir/testCCompiler.c.o   -c /home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_3ac25
/home/xxx.xxx/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/bin/cmake/linux/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3ac25.dir/link.txt --verbose=1
/usr/bin/cc      -rdynamic CMakeFiles/cmTC_3ac25.dir/testCCompiler.c.o  -o cmTC_3ac25 
gmake[2]: Leaving directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp'
gmake[1]: Leaving directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp'



Detecting C compiler ABI info compiled with the following output:
Change Dir: /home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_8e81c/fast && gmake[1]: Entering directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp'
/usr/bin/gmake -f CMakeFiles/cmTC_8e81c.dir/build.make CMakeFiles/cmTC_8e81c.dir/build
gmake[2]: Entering directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o
/usr/bin/cc   -v -o CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o   -c /home/xxx.xxx/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/bin/cmake/linux/share/cmake-3.15/Modules/CMakeCCompilerABI.c
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/9/cc1 -quiet -v /home/xxx.xxx/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/bin/cmake/linux/share/cmake-3.15/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o -version -o /tmp/ccTuVrPj.s
GNU C17 (GCC) version 9.2.1 20190827 (Red Hat 9.2.1-1) (x86_64-redhat-linux)
    compiled by GNU C version 9.2.1 20190827 (Red Hat 9.2.1-1), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.1.0, isl version isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/9/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/9/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/9/include
 /usr/local/include
 /usr/include
End of search list.
GNU C17 (GCC) version 9.2.1 20190827 (Red Hat 9.2.1-1) (x86_64-redhat-linux)
    compiled by GNU C version 9.2.1 20190827 (Red Hat 9.2.1-1), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.1.0, isl version isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0e6902e158034d8f60c5405e0210406c
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
 as -v --64 -o CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o /tmp/ccTuVrPj.s
GNU assembler version 2.32 (x86_64-redhat-linux) using BFD version version 2.32-30.fc31
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/9/:/usr/libexec/gcc/x86_64-redhat-linux/9/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/9/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/9/:/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/9/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
Linking C executable cmTC_8e81c
/home/xxx.xxx/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/bin/cmake/linux/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8e81c.dir/link.txt --verbose=1
/usr/bin/cc     -v -rdynamic CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o  -o cmTC_8e81c 
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC) 
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/9/:/usr/libexec/gcc/x86_64-redhat-linux/9/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/9/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/9/:/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/9/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_8e81c' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/9/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/9/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccTQ8sAE.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_8e81c /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/9/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/9 -L/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/9/../../.. CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-redhat-linux/9/crtend.o /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crtn.o
COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_8e81c' '-mtune=generic' '-march=x86-64'
gmake[2]: Leaving directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp'
gmake[1]: Leaving directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp'



Parsed C implicit include dir info from above output: rv=done
  found start of include info
  found start of implicit include info
    add: [/usr/lib/gcc/x86_64-redhat-linux/9/include]
    add: [/usr/local/include]
    add: [/usr/include]
  end of search list found
  collapse include dir [/usr/lib/gcc/x86_64-redhat-linux/9/include] ==> [/usr/lib/gcc/x86_64-redhat-linux/9/include]
  collapse include dir [/usr/local/include] ==> [/usr/local/include]
  collapse include dir [/usr/include] ==> [/usr/include]
  implicit include dirs: [/usr/lib/gcc/x86_64-redhat-linux/9/include;/usr/local/include;/usr/include]


Parsed C implicit link information from above output:
  link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
  ignore line: [Change Dir: /home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp]
  ignore line: []
  ignore line: [Run Build Command(s):/usr/bin/gmake cmTC_8e81c/fast && gmake[1]: Entering directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp']
  ignore line: [/usr/bin/gmake -f CMakeFiles/cmTC_8e81c.dir/build.make CMakeFiles/cmTC_8e81c.dir/build]
  ignore line: [gmake[2]: Entering directory '/home/xxx.xxx/CLionProjects/assignment_2/cmake-build-debug/CMakeFiles/CMakeTmp']
  ignore line: [Building C object CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o]
  ignore line: [/usr/bin/cc   -v -o CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o   -c /home/xxx.xxx/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/bin/cmake/linux/share/cmake-3.15/Modules/CMakeCCompilerABI.c]
  ignore line: [Using built-in specs.]
  ignore line: [COLLECT_GCC=/usr/bin/cc]
  ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none]
  ignore line: [OFFLOAD_TARGET_DEFAULT=1]
  ignore line: [Target: x86_64-redhat-linux]
  ignore line: [Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux]
  ignore line: [Thread model: posix]
  ignore line: [gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC) ]
  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
  ignore line: [ /usr/libexec/gcc/x86_64-redhat-linux/9/cc1 -quiet -v /home/xxx.xxx/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/bin/cmake/linux/share/cmake-3.15/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o -version -o /tmp/ccTuVrPj.s]
  ignore line: [GNU C17 (GCC) version 9.2.1 20190827 (Red Hat 9.2.1-1) (x86_64-redhat-linux)]
  ignore line: [    compiled by GNU C version 9.2.1 20190827 (Red Hat 9.2.1-1), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.1.0, isl version isl-0.16.1-GMP]
  ignore line: []
  ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
  ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/9/include-fixed"]
  ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/9/../../../../x86_64-redhat-linux/include"]
  ignore line: [#include "..." search starts here:]
  ignore line: [#include <...> search starts here:]
  ignore line: [ /usr/lib/gcc/x86_64-redhat-linux/9/include]
  ignore line: [ /usr/local/include]
  ignore line: [ /usr/include]
  ignore line: [End of search list.]
  ignore line: [GNU C17 (GCC) version 9.2.1 20190827 (Red Hat 9.2.1-1) (x86_64-redhat-linux)]
  ignore line: [    compiled by GNU C version 9.2.1 20190827 (Red Hat 9.2.1-1), GMP version 6.1.2, MPFR version 3.1.6-p2, MPC version 1.1.0, isl version isl-0.16.1-GMP]
  ignore line: []
  ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
  ignore line: [Compiler executable checksum: 0e6902e158034d8f60c5405e0210406c]
  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
  ignore line: [ as -v --64 -o CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o /tmp/ccTuVrPj.s]
  ignore line: [GNU assembler version 2.32 (x86_64-redhat-linux) using BFD version version 2.32-30.fc31]
  ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/9/:/usr/libexec/gcc/x86_64-redhat-linux/9/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/9/:/usr/lib/gcc/x86_64-redhat-linux/]
  ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/9/:/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/9/../../../:/lib/:/usr/lib/]
  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
  ignore line: [Linking C executable cmTC_8e81c]
  ignore line: [/home/xxx.xxx/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/193.5662.56/bin/cmake/linux/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8e81c.dir/link.txt --verbose=1]
  ignore line: [/usr/bin/cc     -v -rdynamic CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o  -o cmTC_8e81c ]
  ignore line: [Using built-in specs.]
  ignore line: [COLLECT_GCC=/usr/bin/cc]
  ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper]
  ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none]
  ignore line: [OFFLOAD_TARGET_DEFAULT=1]
  ignore line: [Target: x86_64-redhat-linux]
  ignore line: [Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux]
  ignore line: [Thread model: posix]
  ignore line: [gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC) ]
  ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/9/:/usr/libexec/gcc/x86_64-redhat-linux/9/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/9/:/usr/lib/gcc/x86_64-redhat-linux/]
  ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/9/:/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/9/../../../:/lib/:/usr/lib/]
  ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_8e81c' '-mtune=generic' '-march=x86-64']
  link line: [ /usr/libexec/gcc/x86_64-redhat-linux/9/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/9/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccTQ8sAE.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_8e81c /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/9/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/9 -L/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/9/../../.. CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-redhat-linux/9/crtend.o /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crtn.o]
    arg [/usr/libexec/gcc/x86_64-redhat-linux/9/collect2] ==> ignore
    arg [-plugin] ==> ignore
    arg [/usr/libexec/gcc/x86_64-redhat-linux/9/liblto_plugin.so] ==> ignore
    arg [-plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper] ==> ignore
    arg [-plugin-opt=-fresolution=/tmp/ccTQ8sAE.res] ==> ignore
    arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
    arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
    arg [-plugin-opt=-pass-through=-lc] ==> ignore
    arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
    arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
    arg [--build-id] ==> ignore
    arg [--no-add-needed] ==> ignore
    arg [--eh-frame-hdr] ==> ignore
    arg [--hash-style=gnu] ==> ignore
    arg [-m] ==> ignore
    arg [elf_x86_64] ==> ignore
    arg [-export-dynamic] ==> ignore
    arg [-dynamic-linker] ==> ignore
    arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
    arg [-o] ==> ignore
    arg [cmTC_8e81c] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crt1.o] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crti.o] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/9/crtbegin.o] ==> ignore
    arg [-L/usr/lib/gcc/x86_64-redhat-linux/9] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/9]
    arg [-L/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64]
    arg [-L/lib/../lib64] ==> dir [/lib/../lib64]
    arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64]
    arg [-L/usr/lib/gcc/x86_64-redhat-linux/9/../../..] ==> dir [/usr/lib/gcc/x86_64-redhat-linux/9/../../..]
    arg [CMakeFiles/cmTC_8e81c.dir/CMakeCCompilerABI.c.o] ==> ignore
    arg [-lgcc] ==> lib [gcc]
    arg [--push-state] ==> ignore
    arg [--as-needed] ==> ignore
    arg [-lgcc_s] ==> lib [gcc_s]
    arg [--pop-state] ==> ignore
    arg [-lc] ==> lib [c]
    arg [-lgcc] ==> lib [gcc]
    arg [--push-state] ==> ignore
    arg [--as-needed] ==> ignore
    arg [-lgcc_s] ==> lib [gcc_s]
    arg [--pop-state] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/9/crtend.o] ==> ignore
    arg [/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crtn.o] ==> ignore
  collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/9] ==> [/usr/lib/gcc/x86_64-redhat-linux/9]
  collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64] ==> [/usr/lib64]
  collapse library dir [/lib/../lib64] ==> [/lib64]
  collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64]
  collapse library dir [/usr/lib/gcc/x86_64-redhat-linux/9/../../..] ==> [/usr/lib]
  implicit libs: [gcc;gcc_s;c;gcc;gcc_s]
  implicit dirs: [/usr/lib/gcc/x86_64-redhat-linux/9;/usr/lib64;/lib64;/usr/lib]
  implicit fwks: []


person Ruaghain    schedule 12.01.2020    source источник
comment
${cblas} не ${blas}. Вы пытались начать с простого target_link_libraries(${PROJECT_NAME} PUBLIC /usr/local/lib/libblas.a)?   -  person KamilCuk    schedule 15.01.2020
comment
Символ был связан, когда я попытался. Я, кстати, на Ubuntu. Можете ли вы опубликовать журнал CMake   -  person Bpaul    schedule 15.01.2020
comment
@KamilCuk извиняется, это была ошибка обновления. Я все равно попробовал ваше обновление. Боюсь, нет Джой. Та же проблема.   -  person Ruaghain    schedule 15.01.2020
comment
@Bpaul Я изменил вопрос, чтобы включить вывод.   -  person Ruaghain    schedule 15.01.2020
comment
Может быть другое имя библиотеки, например libopenblas.a для связи.   -  person Andry    schedule 15.01.2020
comment
@Andry Андрей, я мог бы использовать openblas, однако я надеюсь избежать этого и вместо этого узнать, где я ошибся в своей текущей реализации, и исправить это ;-)   -  person Ruaghain    schedule 15.01.2020
comment
Появляется ли сообщение об ошибке при запуске исполняемого файла или при компиляции? Если это происходит при запуске, возможно, библиотека была связана как динамическая (не статическая), и компоновщик времени выполнения не может найти библиотеку.   -  person chmike    schedule 15.01.2020
comment
@chmike происходит только тогда, когда я запускаю приложение. Хотя я это проверю.   -  person Ruaghain    schedule 15.01.2020


Ответы (4)


Ваш CMakeLists.txt должен иметь что-то вроде этого, следуя предложению FindBLAS:

include(FindBLAS)

if (BLAS_FOUND)
    target_compile_options(${PROJECT_NAME} PRIVATE ${BLAS_LINKER_FLAGS})
    target_link_libraries(${PROJECT_NAME} ${BLAS_LIBRARIES})
endif ()
person scooter me fecit    schedule 21.01.2020

Похоже, динамическому компоновщику не удается найти общую библиотеку.

Вы можете использовать ldd для проверки динамических зависимостей

Пример просмотра зависимостей /bin/ls

ldd /bin/ls
             linux-vdso.so.1 (0x00007ffcc3563000)
             libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f87e5459000)
             libcap.so.2 => /lib64/libcap.so.2 (0x00007f87e5254000)
             libc.so.6 => /lib64/libc.so.6 (0x00007f87e4e92000)
             libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f87e4c22000)
             libdl.so.2 => /lib64/libdl.so.2 (0x00007f87e4a1e000)
             /lib64/ld-linux-x86-64.so.2 (0x00005574bf12e000)
             libattr.so.1 => /lib64/libattr.so.1 (0x00007f87e4817000)
             libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f87e45fa000)

Убедитесь, что файлы .so существуют по указанному пути.

справочная страница ldd

person Mike Seeds    schedule 17.01.2020
comment
Маловероятно, так как библиотека является статической библиотекой (libblas.a). - person scooter me fecit; 21.01.2020
comment
Это ошибка времени выполнения, она должна быть как-то связана с разделяемой библиотекой. libblas также имеет версию .so. - person Mike Seeds; 23.01.2020
comment
С уважением, OP использовал статическую библиотеку, что привело к ошибке времени компиляции/ссылки, связанной с содержимым CMakeLists.txt. В Linux вы должны связать с .so, чтобы получить поддержку общего объекта/динамического связывания, а не статического .a. - person scooter me fecit; 24.01.2020
comment
@scootermefecit OP сказал, что это ошибка времени выполнения. Однако, когда я пытаюсь запустить свое приложение, я получаю следующее сообщение об ошибке компоновщика:. - person Mike Seeds; 25.01.2020
comment
Если бы это действительно была ошибка времени выполнения с динамической библиотекой (и я предполагаю, что OP находится в Linux), приложение должно было быть связано с библиотекой общих объектов, .so. Но это не так; он связан со статической библиотекой. Отсюда мой скептицизм, что это проблема динамической библиотеки. - person scooter me fecit; 06.02.2020
comment
Кто-то спросил его в комментариях. Появляется ли сообщение об ошибке при запуске исполняемого файла или при компиляции? и он ответил, происходит только тогда, когда я запускаю приложение. - person Mike Seeds; 06.02.2020

Я не знаю, как именно вы сгенерировали свой libblas.a, но вы могли бы взглянуть на директиву FindBLAS CMake. (Обратите внимание на примечание относительно C/C++)

https://cmake.org/cmake/help/v3.14/module/FindBLAS.html

person lnksz    schedule 20.01.2020
comment
По сути, я сделал следующее @Inksz 1. Извлек сжатый файл BLAS в каталог 2. Запустил gfortran -O3 -c *.f в этот каталог 3. Запустил ar cr libblas.a *.o 4. Скопировал его в каталог lib: sudo cp ./libblas.a /usr/local/lib/ - person Ruaghain; 20.01.2020

Здесь есть куча вещей, которые могут пойти не так, но для упрощения:

  1. скопируйте libblas.a в тот же каталог, что и ваша программа
  2. Явно ссылайтесь на него в make-файле.
  3. Проверьте, чтобы увидеть расположение CBLAS в выводе (не показано)
  4. Проверьте разрешения libblas.a и посмотрите на символы, используя nm
  5. Заставьте CMake связать все статически (например, здесь статически">вопрос о статической ссылке

Ваши симптомы предполагают, что вы подбираете какую-то другую библиотеку blas при компиляции, но не во время выполнения.

person gbronner    schedule 21.01.2020