简体   繁体   English

与BLAS OS X链接

[英]Linking with BLAS OS X

I am currently trying to compile a program using a library that I'm not very familiar with. 我目前正在尝试使用我不太熟悉的库来编译程序。 When I run the compiler, I get the following output/error: 运行编译器时,出现以下输出/错误:

Undefined symbols for architecture x86_64:
  "_cblas_ddot", referenced from:
      shark::LDA::train(shark::LinearClassifier<shark::blas::vector<double> >&, shark::LabeledData<shark::blas::vector<double>, unsigned int> const&) in libshark.a(LDA.cpp.o)
      shark::LDA::train(shark::LinearClassifier<shark::blas::vector<double> >&, shark::WeightedLabeledData<shark::blas::vector<double>, unsigned int> const&) in libshark.a(LDA.cpp.o)

My current idea is that this is from missing BLAS library, which I just downloaded and compiled (from fortran code?). 我当前的想法是,这是因为缺少了我刚刚下载并编译过的BLAS库(来自fortran代码?)。

The command-line arg for compiling looks like thsi 用于编译的命令行参数看起来像这样

g++ -o example -I/to/boost/include -I/to/shark/include -L/to/boost/lib -L/to/shark/lib -L/to/BLAS -lshark -lblas -l(boost_flags)

In /to/BLAS have a libblas.a , and I ran nm libblas.a which gives a line /to/BLAS有一个libblas.a ,我运行了nm libblas.a ,它给出了一行

libblas.a(ddot.o):
00000000000001c0 s EH_frame1
0000000000000000 T _ddot_

Without being too secure abut this, I assume that this means that the library does have the symbol, but without the _cblas_ prefix. 对此并不太安全,我认为这意味着该库确实具有符号,但没有_cblas_前缀。

What can I do from this point? 从这一点上我该怎么办? Can I change the symbols name? 我可以更改符号名称吗? Or do I need to link this library with something else? 还是我需要将此库与其他链接?

I use OS X Mavericks 我使用OS X Mavericks

Thanks in advance : ) 提前致谢 : )

Solution was as suggested by Logicrat, that I needed other files, I downloaded te source code from here and build it with cmake/make very seamless. 根据Logicrat的建议,解决方案是我需要其他文件,我从这里下载了源代码,并使用cmake / make进行了无缝连接。 Linking with the libraries that came from this resolved the issue. 与由此产生的库链接解决了该问题。

OS X ships with BLAS (including cblas) already installed (it's part of the Accelerate.framework). OS X附带了已安装的BLAS(包括cblas)(它是Accelerate.framework的一部分)。 There's no need to download and build your own. 无需下载和构建自己的。 Just link with -lcblas . 只需与-lcblas链接-lcblas

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM