Link error when using dot() in trust-ndarray

Asked 2 years ago, Updated 2 years ago, 85 views

operating environment:
Windows 10 home 64bit trustc1.26.2 stable
host x86_64-pc-windows-msvc

extern crate ndarray;
usedarray::{arr2};

US>fnmain(){
    let a = arr2(&[[1., 2.], [3., 4.]]);
    println!("{:?}", a);
}

This one works fine with cargo run.

extern crate ndarray;
usedarray::{arr2};

US>fnmain(){
    let a = arr2(&[[1., 2.], [3., 4.]]);
    letb = arr2(&[[1., 2.], [5., 6.]]);
    let matrix = a.dot(&b);
    println!("{:?}", matrix);
}

Here you will see linking with `C:\Program Files(x86)\~~~\x64\link.exe`failed:exit code:1120 and link error.
I have included VC++ build tools.

I didn't know how to deal with it even when I looked it up.
If you know how to solve this problem, could you please let me know?

rust

2022-09-29 20:26

1 Answers

The toml file when a link error occurs is

 [dependencies]
ndarray="0.11.0"

It was

 [dependencies]
ndarray={version="0.11.0", feature=["blas"]}
blas-src={version="0.2.0", default-features=false, features=["openblas"]}
openblas-src={version="0.6.0", default-features=false, features=["cblas", "system"]}

Resolved by changing to .

The details of the link error are as follows.
Some of them are omitted because they are long.

error: linking with `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX64\x64\link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\...\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib"
   "C:\\...\\sample_proj\\target\\debug\\deps\\sample_proj-32a21e51ad011dc7.10o4t5xq5v1kj9xh.rcgu.o"
                                    (ryaku )
   "C:\\...\\sample_proj\\target\\debug\\deps\\sample_proj-32a21e51ad011dc7.ygdixdklmuroyow.rcgu.o" 
   "/OUT:C:\\...\\sample_proj\\target\\debug\\deps\\sample_proj-32a21e51ad011dc7.exe" 
   "C:\\...\\sample_proj\\target\\debug\\deps\\sample_proj-32a21e51ad011dc7.crate.allocator.rcgu.o" 
   "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\...\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" 
   "/NATVIS:C:\\...\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" 
   "/NATVIS:C:\\...\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" 
   "/LIBPATH:C:\\...\\sample_proj\\target\\debug\\deps" 
   "/LIBPATH:C:\\...\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" 
   "C:\\...\\sample_proj\\target\\debug\\deps\\libndarray-ce30bc73040fb13c.rlib" 
                                    (ryaku )
   "C:\\...\\sample_proj\\target\\debug\\deps\\liblibc-8c2934cfe4982c42.rlib" 
   "C:\\...\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-7448a93a40cf2c3f.rlib" 
                                    (omitted)
   "C:\\\...\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\x86_64-pc-windows-msvc\lib\\libcore-e2f4c2f8ebed02cb.rlib" 
   US>"C:\\\...\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\x86_64-pc-windows-msvc\\lib\\lib compiler_buildins-c4ca9f329f3bf160.rlib "advapi32.lib" "ws2_32.lib" us.lib "musvrbvrb.lib" library" shvel.32."
  = note : Non-UTF-8 output : sample_proj-32a21e51ad011dc7.3 ohv1ua84472yy1p.rcgu.o : error LNK2019:
    \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x82\x8bcblas_sgemm\x82\xaa\x8a\xd6\x90\x94_ZN7ndarray6 linalg11 impl_linalg12 mat_mul_impl_impl_imb845Ef17845Ef845Esc81010 
    \x82\xc5\x8eQ\x8f\x8f\x8f\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\r\nsample_proj-32a21e51ad011dc7.3ohv1ua84472yyy1p.rcgu.o:error LNK2019:
    \x96\xa2\x89\xf0\x8c\x88\x82\xcc\x8aO\x95\x94\x83V\x83\x93\x83{\x82\x8bcblas_dgemm\x82\xaa\x8a\x6\x90\x94_ZN7ndarray6 linalg11 impl_linalg12 mat_mul_impl_impl_imb845Ef17845Ef845Esc81010
    \x82\xc5\x8eQ\x8f\x8f\x82\xb3\x82\xea\x82\xdc\x82\xb5\x82\xbd\x81B\r\nC:\\\...sample_proj\\target\\debug\\deps\\\\sample_proj-32a21e51ad011dc7.exe
: fatal error LNK1120:2\x8c\x8f\x82\xa2\xa2\x89\xf0\x8c\x88\x82\x8aO\x95\x94\x8eQ\x8f\x6\r\n


2022-09-29 20:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.