Closed wclark2052 closed 3 years ago
Solved --
env DYLD_LIBRARY_PATH=/usr/local/opt/arrayfire/lib/ dotnet run
I am getting a similar issue on windows.
> open ArrayFire;;
> let arr = Data.RandNormal<double>(2,2);;
System.DllNotFoundException: Unable to load DLL 'af': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at ArrayFire.Interop.AFRandom.af_randn(IntPtr& array_out, UInt32 ndims, Int64[] dim_dims, af_dtype type)
at <StartupCode$FSI_0004>.$FSI_0004.main@()
Stopped due to error
dir "c:\Program Files\ArrayFire\v3\lib\af.*"
Directory of c:\Program Files\ArrayFire\v3\lib
2021-03-08 12:14 2,970,624 af.dll
2021-03-08 12:14 733,734 af.lib
Obviously a MAC specific env variable won't work on windows. What is the best practice? I'd rather not copy af.dll to the local folder if there is a better way.
I was able to answer my own question this morning.
On windows you can add the folder where af.dll is located to the PATH and then it will work.
e.g. set PATH=%PATH%;c:\Program Files\ArrayFire\v3\lib
Furthermore ensure that bitness matches. This probably means you start F# with fsianycpu.exe rather than fsi.exe
Hello - I'm presently using FSharp on a Mac, and I've had success previously using ArrayFire libraries in C++, Rust, and Python on this local machine. For my FSharp (dotnet) project I was able to install the ArrayFire dotnet package successfully:
dotnet add package ArrayFire
subsequent App.fsproj:
However, when running "dotnet run" I get the following build error:
My libaf dylibs are located at /usr/local/opt/arrayfire/lib, (though I don't know how I might be able to specify that here, in the dotnet build/run stage via terminal).
I've tried setting DYLD_PRINT_LIBRARIES (in fish shell: set -x DYLD_PRINT_LIBRARIES 1) as advised in the error message, and I get a long output of successful "dyld loaded" statements (not including any libaf dylibs), followed by this error which is almost the same as the last:
It could very well be an issue more specific to dotnet environments on a Mac (or my own environment configuration), than to ArrayFire itself, so apologies if that's the case. But any insight would be much appreciated, thanks.