Linking error on Windows 11 using Intel MKL as static library
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- rust
調査の方向性
Start with the example crate's Cargo.toml crate-type combinations and src/lib.rs, then run cargo build on the stated Windows MSVC environment with intel-mkl-static enabled. Compare the failing and working configurations and inspect the linker output. Done means the reported crate-type combinations link consistently without unresolved cblas symbols.
索引モデルが issue の本文から書いたものです。
説明
When compiling a small crate against ndarray-linalg using the intel-mkl-static feature, linking errors result depending on the value of lib.crate-type in Cargo.toml.
Example crate
// src/lib.rs
use num_complex::Complex64 as c64;
use ndarray::{Array2, ArrayView2};
pub trait HasDagger {
type Output;
fn dag(&self) -> Self::Output;
}
impl HasDagger for Array2<c64> {
type Output = Self;
fn dag(&self) -> Self {
self.t().map(|element| element.conj())
}
}
impl HasDagger for ArrayView2<'_, c64> {
type Output = Array2<c64>;
fn dag(&self) -> Self::Output {
self.t().map(|element| element.conj())
}
}
pub trait ConjBy {
fn conjugate_by(&self, op: &ArrayView2<c64>) -> Self;
}
impl ConjBy for Array2<c64> {
fn conjugate_by(&self, op: &ArrayView2<c64>) -> Self {
op.dot(self).dot(&op.dag())
}
}
[package]
name = "blas-rs"
version = "0.0.1"
edition = '2018'
[lib]
crate-type = [
'rlib',
'staticlib',
'cdylib',
]
[dependencies]
anyhow = '<1.0.49'
[dependencies.ndarray]
version = '0.15.4'
features = ['serde']
[dependencies.num-complex]
version = '0.4'
features = ['serde']
[dependencies.serde]
version = '1.0'
features = ['derive']
[dependencies.ndarray-linalg]
version = '0.14.1'
features = ['intel-mkl-static']
Example error:
$ cargo build
➜ cargo build
Compiling blas-rs v0.0.1 (C:\Users\cgran\source\scratch\blas-rs)
warning: Error finalizing incremental compilation session directory `\\?\C:\Users\cgran\source\scratch\blas-rs\target\debug\incremental\blas_rs-204zbe9n3gp6o\s-g6at8u30m7-1gpl7ds-working`: Access is denied. (os error 5)
error: linking with `link.exe` failed: exit code: 1120
|
= note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\link.exe"
= note: Creating library C:\...\target\debug\deps\blas_rs.dll.lib and object C:\...\target\debug\deps\blas_rs.dll.exp
blas_rs.pi0kkv54xyu470e.rcgu.o : error LNK2019: unresolved external symbol cblas_sgemm referenced in function _ZN7ndarray6linalg11impl_linalg12mat_mul_impl17h80b4dcd4e156b29cE
blas_rs.pi0kkv54xyu470e.rcgu.o : error LNK2019: unresolved external symbol cblas_dgemm referenced in function _ZN7ndarray6linalg11impl_linalg12mat_mul_impl17h80b4dcd4e156b29cE
blas_rs.pi0kkv54xyu470e.rcgu.o : error LNK2019: unresolved external symbol cblas_cgemm referenced in function _ZN7ndarray6linalg11impl_linalg12mat_mul_impl17h80b4dcd4e156b29cE
blas_rs.pi0kkv54xyu470e.rcgu.o : error LNK2019: unresolved external symbol cblas_zgemm referenced in function _ZN7ndarray6linalg11impl_linalg12mat_mul_impl17h80b4dcd4e156b29cE
C:\Users\cgran\source\scratch\blas-rs\target\debug\deps\blas_rs.dll : fatal error LNK1120: 4 unresolved externals
warning: `blas-rs` (lib) generated 1 warning
error: could not compile `blas-rs` due to previous error; 1 warning emitted
Running cargo build works for some settings of lib.crate-type, however:
["rlib", "staticlib", "cdylib"]: fails["staticlib", "cdylib"]: works["rlib", "staticlib"]: works["rlib"]: works["staticlib"]: works["rlib", "cdylib"]: fails["cdylib"]: works
Version info
➜ cargo --version
cargo 1.57.0 (b2e52d7ca 2021-10-21)
➜ rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\...\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc
installed targets for active toolchain
--------------------------------------
x86_64-apple-darwin
x86_64-pc-windows-gnu
x86_64-pc-windows-msvc
x86_64-unknown-linux-gnu
active toolchain
----------------
stable-x86_64-pc-windows-msvc (default)
rustc 1.57.0 (f1edd0429 2021-11-29)
- 主要言語
- Rust
- スター
- 452
- フォーク
- 95
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rust-ndarray/ndarray-linalg のほかの issue
-
Thin SVD オープン
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
rust-ndarray/ndarray-linalg#414 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
rust-ndarray/ndarray-linalg#413 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
rust-ndarray/ndarray-linalg#404 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
rust-ndarray/ndarray-linalg#402 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
rust-ndarray/ndarray-linalg#401 · リアクション 2 件 ·
rust-ndarray/ndarray-linalg の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
TheLarkInn/aipm#2413 ·
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
alexgorbatchev/simple-ptt#15 ·
-
tooling
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
todo:ticket
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
taikoxyz/taiko-mono#22168 · コメント 1 件 ·