Error compiling with GNU Fortran (Rev3, Built by MSYS2 project) 10.1.0
When building I get the following error:
Error: Rank mismatch in argument 'yold' at (1) (rank-1 and scalar)
C:\Users\***\.julia\packages\ODEInterface\Dz5xs\src\bvpsol.f:4853:40:
4853 | CALL BLDFSC ('ACCEPTED', Y, N, DUMMY, YWGT, YMAX, TOL, ONE)
| 1
Error: Rank mismatch in argument 'yold' at (1) (rank-1 and scalar)
when calling ODEInterface.loadODESolvers(), the following are not compiled correctly: colnew_i32, bvpsol, bvp_m_proxy, colnew, bvpsol_i32
If I modify the build.jl build_bvpsol function to include the flag "-std=legacy", the build runs withouth errors.
function build_bvpsol(path::AbstractString)
options = Dict(
"add_flags_i64" => ["-w", "-std=legacy"],
"add_flags_i32" => ["-w", "-std=legacy"],
)
compile_gfortran(path,"bvpsol", options)
compile_gfortran(path,"linalg_bvpsol")
compile_gfortran(path,"zibconst")
compile_gfortran(path,"ma28_bvpsol")
link_gfortran(path,
["bvpsol","linalg_bvpsol","zibconst","ma28_bvpsol"])
println("\n\n!!! bvpsol: only non commercial use !!!")
println("Please note: bvpsol's license only covers non commercial use!")
println("see using ODEInterface; help_bvpsol_license() for the complete")
println("license text.")
return nothing
end
Now, when calling ODEInterface.loadODESolvers(), all seem to be ok except 'bvp_m_proxy'. The dll is generated in src but for some reason it is not found:
ODEInterface.SolverDLinfo("bvp_m_proxy", "", Ptr{Nothing} @0x0000000000000000, (), ErrorException("Cannot find one of [\"bvp_m_proxy\", \"BVP_M_PROXY\", \"Bvp_m_proxy\"] in libpaths or in [\"C:\\\\Users\\\\***\\\\.julia\\\\packages\\\\ODEInterface\\\\Dz5xs\\\\src\"]"))
Julia 1.5.0 ODEInterface v0.4.7 GNU Fortran (Rev3, Built by MSYS2 project) 10.1.0 Windows 10
Thank you for your feedback. We have two separate problems here:
First problem: Compiling bvpsol (the solver written by Deuflhard, Bader, Weimann) with GCC Version 10. Here setting std=legacy helps. Thank you very much. I have updated the devel branch. Your solution will soon be in master.
Second problem: Compiling the bvp_m_proxy (a proxy for a different solver written by Boisvert, Muir, Spiteri). Here I can reproduce your problem with gfortran (x86_64-w64-mingw32, versin 10.2.0) with Windows 7 Enterprise. Until now I have no idea why a
using Libdl
Libdl.dlopen("C:\\Users\\user\\.julia\\environmens\\v1.5\\dev\\ODEInterface\\src\\bvp_m_proxy")
results in a "The specified procedure could not be found." error.
as a workaround, would you suggest any particular version of gcc?
In the automatic Windows tests with AppVeyor I (still) use this x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64 version, which works.
I'll have to investigate further.
It's difficult to find the problem. ldd and DependencyWalker all show no problem. I even tried to load the dll-module the way Julia as doing it: https://github.com/JuliaLang/julia/blob/release-1.5/src/dlload.c#L94
#include <stdio.h>
#include <windows.h>
#include <winnls.h>
int main(void) {
/* char *filename = "dopri5.dll"; */
char *filename = "bvp_m_proxy.dll";
WCHAR *wfilename = NULL;
HANDLE lib=NULL;
printf("Test for %s\n", filename);
size_t len = MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);
if (!len) {printf("Error 1\n"); return 1;}
wfilename = (WCHAR*)alloca(len*sizeof(WCHAR));
if (!MultiByteToWideChar(CP_UTF8, 0, filename, -1, wfilename, len)) {
printf("Error 2\n");
return 1;
}
lib = LoadLibraryExW(wfilename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
printf("lib=%p\n", (void*)lib);
return 0;
}
which I compiled and run in the ODEInterface/src directory and there is no problem. I can dynamically load the library:
Test for bvp_m_proxy.dll
lib=0000000061f80000
Have you tested other Msys2-versions?
yes, I have tested with gfortran 8.3.0 and it works, no problems!
I still have no success in narrowing down the problem. I've found similar problems (in the past), e.g. https://sourceforge.net/p/mingw/mailman/message/19787051/ where an error in a def-file of mingw caused the same error.
Unfortunately I don't know any Windows tools how to check this.