SJ001 / AI-Feynman

MIT License
607 stars 186 forks source link

Compiler issue with the Fortran files on Windows 10 (symbolic_regress2.f and symbolic_regress3.f do work, but others don't) #49

Closed sirisian closed 2 years ago

sirisian commented 2 years ago

I'm converting the project to run on Windows 10 (so I can use my GPU without WSL2). Converting the .scr files into python was easy enough, but I can't for the life of me get the Fortran files to compile to valid exe files. (Using gfortran from latest mingw64),

gfortran -ffixed-line-length-none -O3 -o symbolic_regress1.exe symbolic_regress1.f
gfortran -ffixed-line-length-none -O3 -o symbolic_regress2.exe symbolic_regress2.f
gfortran -ffixed-line-length-none -O3 -o symbolic_regress3.exe symbolic_regress3.f
gfortran -ffixed-line-length-none -O3 -o symbolic_regress_mdl2.exe symbolic_regress_mdl2.f
gfortran -ffixed-line-length-none -O3 -o symbolic_regress_mdl3.exe symbolic_regress_mdl3.f

All of those commands run fine producing an exe. When I run them though they say "This app can't run on your PC". Also when python subprocess tries to execute it I get the predictable: "OSError: [WinError 193] %1 is not a valid Win32 application".

That is all except the symbolic_regress2.exe and symbolic_regress3.exe which is completely fine. When I run it I get back:

STOP DEATH ERROR: missing file args.dat

Which is exactly what I'd expect. Why are the other Fortran files different? They're like corrupted or something when they compile. I tried the 32-bit gfortran and it produced similar results. Am I missing a flag? (I already ran this in Ubuntu fine, so I'm leaning toward a compiler issue, but I'm not familiar with Fortran).

edit: Interesting. Changing to win32 threads in mingw64 made the symbolic_regress2.exe stop working. Switching to older versions of the compiler didn't change the behavior.

sirisian commented 2 years ago

I gave up on this. Couldn't figure out a way to compile all Fortran files on Windows and get working binaries. Doesn't appear to be possible. Running things on Ubuntu instead.

I saw @SJ001 is converting it to C++ so that should make this possible in the future.