sundmanbo / opencalphad

Open Calphad, thermodynamic calculation code
http://www.opencalphad.org
181 stars 76 forks source link

OpenCalphad build with MinGW #40

Closed Teslos closed 4 years ago

Teslos commented 4 years ago

Dear Bosse, The TQ4 and OC don't compile out of the box on the Windows machine with MinGW.
The problem is the getkey.c file which implements the getch() functionality using POSIX functions. However, MinGW doesn't implement POSIX functionality on windows. The workaround is a function getch() defined in conio.h which do the same thing as getkey but it is not POSIX compliant. I think it is implemented on many other systems but it is not guaranteed to exists as it is not POSIX :)

I don't know if the additional complexity of adding flags to compile with MinGW is worth it. Do you plan to support the MinGW for the future release?

Best regards ∃t

sundmanbo commented 4 years ago

Hi Teslos

You are still working with OC, I have not seen you updated much of your iso-C interface for OC. As a matter of fact I have updated one of the examples on TQ4lib and I think I managed to eliminate both getkey and this "tinyfile_dialog" routines. I am a bit too old to bother with POSIX or not, in fact I thought I am using MinGW but I am not really sure from where I downloaded by last gfortran version. To me the website for MinGW seemed quite dead whereas there is some more recent MSYS2 which seems to be a replacement but I want to change as little as possible. But I would appreciate help for the C connection and possibly also with Python although that seems to quite far away. This f2py converter is evidently only for F77 code.

Best wishes

Bosse

wallytutor commented 4 years ago
Dear Mr. Sundman, A little more than one year ago I forked OC and organized the code sort of my way so that I could understand better how to proceed with C interface organization. Please find the code here: https://github.com/waltermateriais/opencalphad (I tried without success to follow your updates in the beginning but without help I eventually stopped working, I should have contacted you by that time). As you will find under src/pyoc/, I have already provided Python/Cython interfaces for some C-API routines. Under src/sdk/ I placed the devel sources for interfaces. This version compiled on Cygwin, MSYS2, and Linux.  Currently I have more free time, so if someone helps me I can get back to work and finish the whole interfacing. KR,Walter From: Bo SundmanSent: Wednesday, January 15, 2020 7:37 PMTo: sundmanbo/opencalphadCc: SubscribedSubject: Re: [sundmanbo/opencalphad] OpenCalphad build with MinGW (#40) Hi TeslosYou are still working with OC, I have not seen you updated much of your iso-C interface for OC.As a matter of fact I have updated one of the examples on TQ4lib and I think I managed to eliminate both getkey and this "tinyfile_dialog" routines.I am a bit too old to bother with POSIX or not, in fact I thought I am using MinGW but I am not really sure from where I downloaded by last gfortran version. To me the website for MinGW seemed quite dead whereas there is some more recent MSYS2 which seems to be a replacement but I want to change as little as possible. But I would appreciate help for the C connection and possibly also with Python although that seems to quite far away. This f2py converter is evidently only for F77 code.Best wishesBosse—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
sundmanbo commented 4 years ago

I am not very familiar with anything else than Fortran and I try to ensure I can compile the new version of OC on WIndows, Linux and MacOS. I have collaborated interfacing OC with C or C++ for 2 commercial applications and if one could make a more general interface, also including Python, I would be happy to collaborate, mainly by avoiding creating problems with my Fortran code. I do not think I ca contribute discussing POSIX or related issues. For the moment I am mainly working on the code for step/map for interactive use, the OCASI/TQ interface has not gained much attention. I am also collaborating with someone developing a GUI (by creating OC macro files and writing python code) but again my main responsibility is not to mess up things so I prefer to stay with Fortran. But the getkey and tinyfile_dialogs were necessary for the interactive use of the Fortran code. For the use of OCASI/TQ they can be eliminated.

sundmanbo commented 4 years ago

I am retired and work on OC on my personal PC at home so I have very little chance to test installing OC on various OS or configurations. Anyone are welcome to provide improved Makefiles/installment procedures/scripts. Such things are outside my knowledge, I want to concentrate on the thermodynamics.

sundmanbo commented 4 years ago

Hi Teslos

I am sorry I am a bit slow but now I wonder why you are using getkey.c when you are running on Windows? Normally you should not compile and link that routine on Windows. I added it in order to have command line editing on Linux and it is only compiled if you use the Makefile. On WIndows I recommend using my homemade "linkmake" or "linkpara" routines to compile and link OC and they do not include getkey.c.

Can you explain why you want to use getkey.c? There is probably no problem for me to change to use the getch() you propose, is that normally available on linux systems?

Best wishes

Bosse

sundmanbo commented 4 years ago

Hi Teslos

Using the Makefile on WIndows you can remove compiling getkey.c altogether and the -Dlixed option when compiling metlib4.F90

Best wishes

Bosse

sundmanbo commented 4 years ago

As I have no responses I close this