-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows missing dll error when building and running examples on Windows with Python 3.8> #149
Comments
Thanks for reporting. I don't have access to a Windows machine to test on, but will be happy to receive a PR to fix this. |
Made some progress on this by adding the below to
This resolves the missing dll issue and simple examples will build. Unfortunately some examples now have an
I'll take another look into this later and see if I can make a smaller example. |
Nearly there! This is pushing my limited understanding of the compilers but it seems to work. module demo
implicit none
TYPE :: DemoType
Integer :: nL
end type DemoType
public :: hello
contains
! This function caused build fail without above change
function hello(val_in) result(outval)
REAL, intent(in):: val_in
REAL :: outval
outval = val_in + 1.0
end function
end module demo Including more than 1 file caused a seg fault! |
OK, looks good. Usually you would compile |
That's what I had been doing for linux but in Windows it was having some issues. I'll take another look later. |
@sbland would you mind sharing your compiler list and build tools (MSVC? gcc through MSYS/mingw/something else) for windows? I'm trying something out with all three, found your hints super useful.. if I hit upon a solution I can report here too |
I got f90wrap to work on Windows 10 (64 bit, home edition) with Anaconda Python 3.8.8, numpy version 1.20.1 and f90wrap 0.2.7; gfortran through mingw-w64 (v8.1.0). I built f90wrap with python setup.py install after telling distutils.cfg to use mingw32 (and not the microsoft visual c/c++ compiler) |
Note that gfortran is available through conda-forge via |
Thanks @bilderbuchi - I'll try it out. |
@bilderbuchi It seems the package contains some older versions of the compilers; is it up-to-date with what ships with the other toolchains? The conda package version seems to suggest gcc v5.x |
Yeah, no, it's 5.3.0, unfortunately not the freshest, but luckily enough for my Fortran codebase. As this gcc is underpinning much of the scientific Python ecosystem it's not easy to upgrade, apparently, but there are issues about that, see e.g. conda-forge/fpm-feedstock#4 conda-forge/conda-forge.github.io#1044 |
@sbland did you try the mingw-w64 toolchain? Hope it resolved your issue. |
i tried setup.py install with anaconda 3.8.8 on a windows machine today; latest f90wrap does not need the patch in init.py. This issue can be closed? |
@sbland Did you compile the shared library on Windows 10 while you define and use "user defined data type"? Your example code went well on my Windows 10. I compiled the *.pyd file and *.dll file and imported into Python and got correct results. However, while I use the "user defined data type", the compiler will assume they are "void" and give me the error "getctype: No C-type found in "{'typespec': 'type', 'typename': 'real_array'}", assuming void." The code I tested is from "f90wrap/examples/arrays_in_derived_types_issue50" test.f90
Do you have any suggestions? Thank you. |
Apparently by now gcc and gfortran 13 and 14 builds are available for Windows on conda-forge, so it might be worth revisiting this. |
Since Python 3.8 dlls are only loaded from a trusted location on Windows https://docs.python.org/3/whatsnew/3.8.html#ctypes
This brakes building and running f90wrap on Windows due to the following error:
ImportError: DLL load failed while importing sizeof_fortran_t: The specified module could not be found.
This can be fixed by adding the dll location using
os.add_dll_directory("PATH_TO_f90WRAP/f90wrap.libs")
.I'm not sure what the solution is to fixing this in f90wrap but I'll take a look.
The text was updated successfully, but these errors were encountered: