Dear Kostas,

Yes of course I can share my recipe about compiling Getfem under Windows.
Well I have just had my laptop changed and I have just resintalled most of
my tools and recompiled Getfem so I cannot guarantee that my recipe would
work in any other case and I would probably not be able to explain why such
or such step doesn't work on another config... From my experience, errors
often come from bad values of environment variables so that headers or
libraries are not found!

Before dealing with Getfem, just make sure that you have a proper
installation of Python and MinGW. I have Anaconda with Python 3.7 as well
as Msys2 and MinGW (with gcc 10.3.0).
Concerning Python I have gotten used to follow the instruction from
https://ascend4.org/Setting_up_a_MinGW-w64_build_environment#Setup_Python_for_compilation_of_extensions
to create python<xy>.dll and modify pyconfig.h. I don't really know if this
last step remains necessary but I still do it.
In addition, I have found somewhere that it was necessary to replace
msvcr140 by vcruntime140 in cygwinccompiler.py in the Python folder
distutils.

Of course it is necessary to update the Path (possibly LD_LIBRARY_PATH,
LIBRARY_PATH and/or PATH?) to make sure that some important MinGW libraries
are seen from the compiler (typically gfortran, quadmath, stdc++,
gcc_s...). For me, they are located at [Installation dir of
msys64]\mingw64\lib\gcc\x86_64-w64-mingw32\10.3.0 .

Concerning Blas, I have installed OpenBlas (
https://github.com/xianyi/OpenBLAS/wiki) and I have then installed MUMPS
with the modified Makefile.inc in attachment but of course it may need
changes for different Blas installation or fortran compiler.

I have also installed Qhull as suggested in
https://getfem.org/install/install_windows.html .

Also it is important to update the Windows environment variables (PATH,
LD_LIBRARY_PATH, LIBRARY_PATH for the linker and CPATH for the include
directories) and make sure that Msys2 inherits them or define the
environment variables within the scope of msys2 console...

Now concerning Getfem itself, it depends whether you want to compile from
the stable tar.gz version (already containing configure) or from the dev
version from git repository. In this last case, probably due to
unix/windows incompatibiity that I can't explain, I have problems with the
content of AC_CONFIG_FILES in which I have to suppress manually all the
spaces and \ symbols. After that, autogen.sh works to create the configure
file.  Could this be something that might be fixed in the Getfem sources so
that configure.ac can be compatible for both unix and windows?

Then the compilation of Getfem follows
https://getfem.org/install/install_windows.html insofar as it is important
to first compile superlu and then configure again with the option
--disable-superlu after putting the superlu library in some place visible
from the linker.

Concretely I do the following

$ ./configure --prefix=[destination of the installation] --with-pic
--with-blas="-lopenblas" LDFLAGS="-lpthread -lgfortran -lquadmath -lstdc++
-lgcc_s -lm -L[installation dir of Python] -lpython37"
$ cd superlu
$ make
then copy the folder .libs containing libsuperlu.* to some place in the
path visible by the linker
$ cd ..
$ ./configure --prefix=[destination of the installation]   --with-pic
--with-blas="-lopenblas" LDFLAGS="-lpthread -lgfortran -lquadmath -lstdc++
-lgcc_s -lm -L[installation dir of Python]  -lpython37"
PYTHON="[installation dir of Python]/python.exe" --disable-superlu
(( I have noticed that I had to explicitly mention PYTHON=[path to
python.exe in unix style] because the windows style path (I mean
C:\...\...) in my general Windows environment variable leads to compilation
error for me. It may be different on another configuration of if the
environement variables are defined within msys64 and not Windows inherited
by msys64 as I do... I don't know.))
$ make
$ make install
Then you have to copy the getfem folder contained in
lib/pythonx.y/site-packages to some place that is included in your
PYTHONPATH or directly add the folder in the PYTHONPATH.

Until rather recently I had problems with the step of compilation of python
interface: I had to manually run the following command within the folder
interface/src/python and manually copy the resulting "_getfem.pyd" in the
installed folder lib/site-packages/getfem
$ g++ -shared ./Release/getfem_python_c.o
./Release/_getfem.cp37-win_amd64.def -L../.libs -L../../../src/.libs
 -lgetfemint -lgetfem -lsmumps -ldmumps -lcmumps -lzmumps -lmumps_common
-lmpiseq -lpord -lqhull -lsuperlu -lopenblas -lpthread -lgfortran
-lquadmath -lstdc++ -lgcc_s -lm -lpython37 -lstdc++ -lm -lpython37
-lvcruntime140 -o ./_getfem.pyd
but it doesn't seem necessary now for me. I don't know if it is due to
changes in the Getfem sources or to my new laptop configuration...

I hope this helps you to compile under Windows.

By the way, do you know if someone in the development team intends to add a
Julia interface beside python and matlab ones? This may be nice.

Best regards
Jean-François






Le mer. 15 déc. 2021 à 15:27, Konstantinos Poulios <logar...@googlemail.com>
a écrit :

> Dear Yintong Shang,
>
> If you use Anaconda on windows, it is quite easy to install multiple
> python versions on Anaconda. I have both 3.7 and 3.8 on my Windows system
> and use 3.7 for running GetFEM.
>
> @Jean-François Barthélémy <jfrancois.barthel...@gmail.com> could you
> maybe share your recipe for creating the Windows package, then maybe myself
> or someone else can built packages for newer Python and GetFEM versions.
> Some of the questions that I have is for example if you compile MUMPS
> yourself on windows, how about blas and lapack?
>
> Best regards
> Kostas
>
> On Tue, Dec 14, 2021 at 5:20 PM Jean-François Barthélémy <
> jfrancois.barthel...@gmail.com> wrote:
>
>> Dear Yintong Shang,
>>
>> I compiled GetFEM for Python 3.7 using MinGW but I am not planning to do
>> so for Python >=3.8 since I have problems with these versions of Python
>> with other libraries (especially using Boost.Python for C++/Python
>> interfaces involving numpy arrays). I'm sorry. But you can try to install
>> MinGW and compile GetFEM following the instructions of the website (
>> https://getfem.org/install/install_windows.html).
>>
>> Best regards
>> JF Barthélémy
>>
>>
>> Le mar. 14 déc. 2021 à 16:16, shayitoshang <shayitosh...@gmail.com> a
>> écrit :
>>
>>> To whom it may concern,
>>>
>>> I want to install GetFEM on Windows 10 system, and I notice from
>>> https://getfem.org/download.html
>>> that only Python 3.7 is supported. But I have been using Python 3.8 and
>>> changing version is tiring.
>>>
>>> Will there be support for Python 3.8 lately or if it is possible to use
>>> GetFEM on my current configuration?
>>>
>>> Best,
>>> Yintong Shang
>>>
>>

Attachment: Makefile.inc
Description: Binary data

Reply via email to