Ошибка при компиляции исходников C, связанных с gcc DEBUG, при попытке скомпилировать файл .f90 с использованием f2py и Python3 - PullRequest
0 голосов
/ 19 сентября 2019

Сводка

Попытка скомпилировать базовый файл .f90 с использованием f2py приводит к ошибке, связанной с командой gcc: "gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERS =0x1915 ".

Описание:

Я на Windows 10 использую Python 3.7 с Anaconda 4.7.Numpy 1.17.2.У меня установлен MinGW для gfortran.MS Visual Studio 14.0.

foo.f90 file:

subroutine hello ()
    write(*,*)'Hello from Fortran90!!!'
end subroutine hello

Попытка скомпилировать foo.f90 с использованием f2py:

C:\Users\Sam\Desktop\Test>f2py -c foo.f90 -m foo
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "foo" sources
f2py options: []
f2py:> C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.c
creating C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7
Reading fortran codes...
        Reading file 'foo.f90' (format:free)
Post-processing...
        Block: foo
                        Block: hello
Post-processing (stage 2)...
Building modules...
        Building module "foo"...
                Constructing wrapper function "hello"...
                  hello()
        Wrote C/API module "foo" to file "C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.c"
  adding 'C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c' to sources.
  adding 'C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7' to include_dirs.
copying c:\users\sam\anaconda3\lib\site-packages\numpy\f2py\src\fortranobject.c -> C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7
copying c:\users\sam\anaconda3\lib\site-packages\numpy\f2py\src\fortranobject.h -> C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7
build_src: building npy-pkg config files
running build_ext
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Found executable C:\cygwin64\bin\DF.exe
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Found executable C:\MinGW\bin\gfortran.exe
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building 'foo' extension
compiling C sources
C compiler: gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes

creating C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users
creating C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users\sam
creating C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users\sam\appdata
creating C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users\sam\appdata\local
creating C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users\sam\appdata\local\temp
creating C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users\sam\appdata\local\temp\tmpl095xx8z
creating C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users\sam\appdata\local\temp\tmpl095xx8z\src.win-amd64-3.7
compile options: '-DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1915 -IC:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7 -Ic:\users\sam\anaconda3\lib\site-packages\numpy\core\include -Ic:\users\sam\anaconda3\include -Ic:\users\sam\anaconda3\include -c'
gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1915 -IC:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7 -Ic:\users\sam\anaconda3\lib\site-packages\numpy\core\include -Ic:\users\sam\anaconda3\include -Ic:\users\sam\anaconda3\include -c C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.c -o C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users\sam\appdata\local\temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.o
gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1915 -IC:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7 -Ic:\users\sam\anaconda3\lib\site-packages\numpy\core\include -Ic:\users\sam\anaconda3\include -Ic:\users\sam\anaconda3\include -c C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c -o C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users\sam\appdata\local\temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.o
In file included from c:\users\sam\anaconda3\include/Python.h:156:0,
                 from C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.h:7,
                 from C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c:2:
        c:\users\sam\anaconda3\include/fileutils.h:85:5:n file included from  c:\users\sam\anaconda3\include/Python.h:156:0error: ,
unknown type name '                 from C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.c:14__int64:'
    c:\users\sam\anaconda3\include/fileutils.h:85:5:__int64  st_size;
error:      unknown type name '^~~~~~~__int64
'In file included from
                                __int64 st_size;,

                from ^~~~~~~c:\users\sam\anaconda3\include/pyport.h:224
,
                from /usr/include/sys/stat.h:22:0,


C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.h:7                 from c:\users\sam\anaconda3\include/Python.h:63,
,
                from C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c:2C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.c:14::

[01m                                                                                                                  expected 'expected '::', '', ', ', ';', '', ';}', '' or '}__attribute__' or '' before '__attribute__.' before '' token.
    time_t ' token
    time_t
           t_atime;^

^
In file included from In file included from c:\users\sam\anaconda3\include/Python.h:8:0c:\users\sam\anaconda3\include/Python.h:8:0,,
                 from                  from C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.c:14C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.h:7:,

                from c:\users\sam\anaconda3\include/pyconfig.h:249:29:C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c:2
    unknown type name 'c:\users\sam\anaconda3\include/pyconfig.h:249:29:__int64 'error:
#       define PY_LONG_LONG unknown type name '

       define PY_LONG_LONG ^_
_int64
                            c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:312:9: ^note:
[01mc:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:312:9:PY_LONG_LONG '
'ypedef                                    PY_LONG_LONG npy_longlong;
          typedef ^~~~~~~~~~~~PY_LONG_LONG
         c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:4:0^~~~~~~~~~~~,
                 from   c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:12n file included from ,c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:4:0
                from ,
                from
                     ,
                 from ,c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4
                from ,
                from :C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.h:13
[01m,c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:313:31:
                  from        C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c:2expected '=:
', ',c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/npy_common.h:313:31:', ' ;error: ', 'expected 'asm=' or '', '__attribute__,' before '', 'npy_ulonglong;'', '
typedef unsigned PY_LONG_LONG asmnpy_ulonglong' or ';__attribute__
                              ' before '^~~~~~~~~~~~~npy_ulonglong'

 typedef unsigned PY_LONG_LONG npy_ulonglong;
                               ^~~~~~~~~~~~~
In file included from c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1830:0,
                 from c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:12,
                 from c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4In file included from ,
                from C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.h:13,
                 from
                from c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:12C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.c:15,:
                 from
c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:17:2:c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4 ,
                from C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.h:13#warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [,-Wcpp
                from ]
C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c:2 #warning:
  c:\users\sam\anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:17:2:^~~~~~~
#warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it with " \
  ^~~~~~~
In file included from c:\users\sam\anaconda3\include/Python.h:131:0,
                 from C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.h:7,
                 from C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c:2:
C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c: In function 'check_and_fix_dimensions':
c:\users\sam\anaconda3\include/pyerrors.h:491:19: warning: implicit declaration of function '_snprintf'; did you mean 'asnprintf'? [-Wimplicit-function-declaration]
 # define snprintf _snprintf
                   ^
C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\fortranobject.c:993:13: note: in expansion of macro 'snprintf'
             snprintf(msg, sizeof(msg),
             ^~~~~~~~
error: Command "gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1915 -IC:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7 -Ic:\users\sam\anaconda3\lib\site-packages\numpy\core\include -Ic:\users\sam\anaconda3\include -Ic:\users\sam\anaconda3\include -c C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.c -o C:\Users\Sam\AppData\Local\Temp\tmpl095xx8z\Release\users\sam\appdata\local\temp\tmpl095xx8z\src.win-amd64-3.7\foomodule.o" failed with exit status 1
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...