Skip to content

[Build] Build scripts silently ignores non-accessible DLLs #308

Closed
@phil-opp

Description

@phil-opp

Description

When looking for available DLLs, the build scripts treats all access errors like files that don't exist:

arrayfire-rust/build.rs

Lines 71 to 76 in 7cfde6b

fn file_exists(location: &str) -> bool {
match fs::metadata(location) {
Ok(f) => f.is_file(),
Err(_) => false,
}
}

If the current user has no read permissions on the af.dll, it is not added to the backends list:

arrayfire-rust/build.rs

Lines 419 to 424 in 7cfde6b

if uni_lib_exists {
backends.push("af".to_string());
if !conf.use_lib && conf.with_graphics == "ON" {
backends.push("forge".to_string());
}
}

As a result, no arrayfire library is passed to the linker, which then throws a lot of errors because for the various af_* functions (see below).

The arrayfire build script should really trigger an error or panic if no backends are found instead of letting the users run into linker errors. Ideally, the error message would also mention that some files were found, but were not be accessible.

Build Environment

Compiler version: rustc 1.57.0 (f1edd0429 2021-11-29)
Operating system: Windows 10
Build environment: (described above)

Error Log

Lots of errors like these:

error LNK2019: unresolved external symbol af_retain_array referenced in function _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h3e2e43e5f6399194E

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions