arpack-ng
arpack-ng copied to clipboard
Visual Studio error LNK1120
Hi!
I tried to compile it using Microsoft Visual Studio Community 2017 (Version 15.9.17) with Intel Visual Fortran Compiler 19.0.0.117 but I got a link error:
arpack-ng_exports.def : error LNK2001: unresolved external symbol dlaqrb_ x64\Release MKL\arpack-ng.lib : fatal error LNK1120: 1 unresolved externals
File dlaqrb.f missing?
Please help to fix this error
Thank you!
I don't have a windows to reproduce this. Someone will have to help!
Would say you need lapack 3 (dlahqr used instead of deprecated dlaqrb) and this fix:
$ git diff
diff --git a/VISUAL_STUDIO/arpack-ng_exports.def b/VISUAL_STUDIO/arpack-ng_exports.def
index 2129b28..ab447a5 100644
--- a/VISUAL_STUDIO/arpack-ng_exports.def
+++ b/VISUAL_STUDIO/arpack-ng_exports.def
@@ -5,7 +5,6 @@ EXPORTS
cmout_
cvout_
dgetv0_
- dlaqrb_
dmout_
dnaitr_
dnapps_
Thank you! After I deleted dlaqrb_ from VISUAL_STUDIO/arpack-ng_exports.def it builds successfully.
Sorry for the next newbie questions. How can I use arpack correctly in Visual Studio projects? For example if I do the following:
- add path to arpack-ng.lib to Linker → General → Additional Import Library
- add arpack-ng.lib Linker → Input → Additional Dependencies
- copy arpack-ng.dll to local directory with .exe file After these steps my program compiles. But after I running it i get an run-time error: blasplus.dll was not found.
I need this blasplus.dll? I can not use arpack as stand-alone library?
Thanks a lot for your help!
Please PR the fix. Arpack needs blas / lapack : you'll need to add them in your paths according to your IDE (no windows, can't help). Not sure to understand what VISUAL_STUDIO/blasplus_imports.def deals with and how to use it : you may try to remove or empty it (if removing breaks) just for testing.
I tried to remove VISUAL_STUDIO/blasplus_imports.def or make it empty - many linking errors occurs.
I do not fully understand where to get .dll files from missing libraries (blasplus.dll, lapack.dll). Solution in VISUAL_STUDIO directory does not create .dll files.
Give a try to cmake (or autotools) on windows ? You'll need to build blas and lapack with cmake, then, to build arpack (which needs blas / lapack) with cmake : did you try ?
As far as I remember sln / proj files are used by MS Visual Studio to gather many information including symbols exported by dll. Not used windows for years, but, I would say sln / proj "want" blasplus_imports.def, and blasplus_imports.def "wants" to find symbols in "blasplus.dll" that you'll have to provide. You may try for testing :
- get rid of blasplus in all sln / proj files (so then you likely may remove blasplus_imports.def)
- you will still have to provide a compiled library for blas / lapack which will seem to be compelled to be named "blas.dll" and "lapack.dll" : you'll need to compile that ones from source, MS VS is not gonna do that for you ! (likely you can't use MKL for instance as shipped blas / lapack dll are not named like that)
Cmake would probably be more flexible... Never tested on wiindows. Seems blas (embedded in lapack) and lapack for windows are available here : http://icl.cs.utk.edu/lapack-for-windows/lapack/
>> git grep blasplus_imports.def
VISUAL_STUDIO/arpack-ng.vfproj: <Tool Name="VFPreBuildEventTool" CommandLine="lib /DEF:"$(InputDir)blasplus_imports.def" /SUBSYSTEM:WINDOWS /MACHINE:X86 /OUT:"$(InputDir)blasplus.lib" 1>NUL 2>NUL
lib /DEF:"$(InputDir)lapack_imports.def" /SUBSYSTEM:WINDOWS /MACHINE:X86 /OUT:"$(InputDir)lapack.lib" 1>NUL 2>NUL" Description="Build blasplus.lib lapack.lib (imports)"/>
VISUAL_STUDIO/arpack-ng.vfproj: <Tool Name="VFPreBuildEventTool" CommandLine="lib /DEF:"$(InputDir)blasplus_imports.def" /SUBSYSTEM:WINDOWS /MACHINE:X64 /OUT:"$(InputDir)blasplus.lib" 1>NUL 2>NUL
lib /DEF:"$(InputDir)lapack_imports.def" /SUBSYSTEM:WINDOWS /MACHINE:X64 /OUT:"$(InputDir)lapack.lib" 1>NUL 2>NUL" Description="Build blasplus.lib lapack.lib (imports)"/>
VISUAL_STUDIO/arpack-ng.vfproj: <Tool Name="VFPreBuildEventTool" CommandLine="lib /DEF:"$(InputDir)blasplus_imports.def" /SUBSYSTEM:WINDOWS /MACHINE:X86 /OUT:"$(InputDir)blasplus.lib" 1>NUL 2>NUL
lib /DEF:"$(InputDir)lapack_imports.def" /SUBSYSTEM:WINDOWS /MACHINE:X86 /OUT:"$(InputDir)lapack.lib" 1>NUL 2>NUL" Description="Build blasplus.lib lapack.lib (imports)"/>
VISUAL_STUDIO/arpack-ng.vfproj: <Tool Name="VFPreBuildEventTool" CommandLine="lib /DEF:"$(InputDir)blasplus_imports.def" /SUBSYSTEM:WINDOWS /MACHINE:X64 /OUT:"$(InputDir)blasplus.lib" 1>NUL 2>NUL
lib /DEF:"$(InputDir)lapack_imports.def" /SUBSYSTEM:WINDOWS /MACHINE:X64 /OUT:"$(InputDir)lapack.lib" 1>NUL 2>NUL" Description="Build blasplus.lib lapack.lib (imports)"/>
VISUAL_STUDIO/arpack-ng.vfproj: <File RelativePath=".\blasplus_imports.def"/>
@sylvestre : https://docs.travis-ci.com/user/reference/windows/
@fghoussen I don't have time or the interest to do it :)
Even if you would, you'll need to wget and build blas / lapack (I guess you don't want that)
You are selling me some dreams here ;)
The no-always-stable-wget may turn dreams into nightmares...
@GillianGrayson : works OK on W10 + cmake + MinGW + no-mpi (can't test in VS : no F90 compiler)
@sylvestre : BTW, I can try to PR a windows job but need 1) git clone lapack [fetching from web - may be not always so stable ?] 2) building lapack [may be quite long]. You decide. Not a big job at my side.
sure, many thanks :)
Now vcpkg (one can install in visual studio) integrates arpack-ng, should we drop visual studio support?
Suppress VISUAL STUDIO directory hosted in the repo? @FabienPean: what do you think?
I was not even aware the folder is present :) The files seem old and don't even open correctly with VS2022. Anyway, it would be better to remove them and push people to generate build files with CMake (which is also well supported in Visual Studio itself).
100% agree! :) @sylvestre: what do you think?