Beim Versuch, numpy lokal zu erstellen, hatte ich die folgende Fehlermeldung erhalten:
gcc: numpy/core/src/common/mem_overlap.c
gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fno-semantic-interposition -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now build/temp.linux-x86_64-3.8/numpy/core/src/multiarray/_multiarray_tests.o build/temp.linux-x86_64-3.8/numpy/core/src/common/mem_overlap.o -L/usr/lib -Lbuild/temp.linux-x86_64-3.8 -lnpymath -o numpy/core/_multiarray_tests.cpython-38-x86_64-linux-gnu.so
/usr/bin/ld: build/temp.linux-x86_64-3.8/numpy/core/src/common/mem_overlap.o:/home/ross/repos/numpy/numpy/core/include/numpy/ndarraytypes.h:1824: multiple definition of `PyArrayDTypeMeta_Type'; build/temp.linux-x86_64-3.8/numpy/core/src/multiarray/_multiarray_tests.o:/home/ross/repos/numpy/numpy/core/include/numpy/ndarraytypes.h:1824: first defined here
collect2: error: ld returned 1 exit status
error: Command "gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fno-semantic-interposition -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now build/temp.linux-x86_64-3.8/numpy/core/src/multiarray/_multiarray_tests.o build/temp.linux-x86_64-3.8/numpy/core/src/common/mem_overlap.o -L/usr/lib -Lbuild/temp.linux-x86_64-3.8 -lnpymath -o numpy/core/_multiarray_tests.cpython-38-x86_64-linux-gnu.so" failed with exit status 1
`Bisect`ing identifizierte 1809a0fde als Quelle des Problems. Beachten Sie, dass dieser Fehler bei mir nur mit gcc 10.1 aufgetreten ist. Mit gcc 9.3 traten keine Probleme auf. ### Beispiel für Reproduktionscode:$ git clone https://github.com/numpy/numpy.git
$ git checkout 1809a0fde
$ pip install -r test_requirements.txt
$ python setup.py build_ext -i
### Fehlermeldung:Wird aus dem numpy-Quellverzeichnis ausgeführt. Cythonisierende Quellen numpy/random/_bounded_integers.pxd.in hat sich nicht geändert Verarbeitung von numpy/random/mtrand.pyx numpy/random/_common.pyx hat sich nicht geändert Verarbeitung von numpy/random/_mt19937.pyx Verarbeitung von numpy/random/_pcg64.pyx Verarbeitung von numpy/random/_generator.pyx numpy/random/_bounded_integers.pyx hat sich nicht geändert numpy/random/_sfc64.pyx hat sich nicht geändert numpy/random/_philox.pyx hat sich nicht geändert numpy/random/bit_generator.pyx hat sich nicht geändert numpy/random/_bounded_integers.pyx.in hat sich nicht geändert numpy/core/setup.py:406: MismatchCAPIWarning: API-Mismatch erkannt, die C-API-Versionsnummern müssen aktualisiert werden. Die aktuelle C-API-Version ist 13, mit Prüfsumme 17a0f366e55ec05e5c5c149123478452, aber die aufgezeichnete Prüfsumme für C-API-Version 13 in core/codegen_dir/cversions.txt lautet 5b0e8bbded00b166125974fc71e80a33. Wenn Funktionen in der C-API hinzugefügt wurden, müssen Sie C_API_VERSION in numpy/core/setup_common.py aktualisieren. check_api_version(C_API_VERSION, codegen_dir) blas_opt_info: blas_mkl_info: UnixCCompiler anpassen Bibliotheken mkl_rt nicht gefunden in ['/home/ross/.virtualenvs/tmp/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/' ] NICHT VERFÜGBAR blis_info: Bibliotheken blis nicht gefunden in ['/home/ross/.virtualenvs/tmp/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/' ] NICHT VERFÜGBAR openblas_info: C-Compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC /tmp/tmpp_pb97eg/tmp erstellen /tmp/tmpp_pb97eg/tmp/tmpp_pb97eg erstellen Kompilierungsoptionen: '-c' gcc: /tmp/tmpp_pb97eg/source.c gcc -pthread /tmp/tmpp_pb97eg/tmp/tmpp_pb97eg/source.o -L/usr/lib64 -lopenblas -o /tmp/tmpp_pb97eg/a.out GEFUNDEN: Bibliotheken = ['openblas', 'openblas'] library_dirs = ['/usr/lib64'] Sprache = c define_macros = [('HAVE_CBLAS', Keine)] GEFUNDEN: Bibliotheken = ['openblas', 'openblas'] library_dirs = ['/usr/lib64'] Sprache = c define_macros = [('HAVE_CBLAS', Keine)] nicht vorhandener Pfad in 'numpy/distutils': 'site.cfg' lapack_opt_info: lapack_mkl_info: Bibliotheken mkl_rt nicht gefunden in ['/home/ross/.virtualenvs/tmp/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/' ] NICHT VERFÜGBAR openblas_lapack_info: C-Compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC /tmp/tmpeicqr4ho/tmp . erstellen /tmp/tmpeicqr4ho/tmp/tmpeicqr4ho erstellen Kompilierungsoptionen: '-c' gcc: /tmp/tmpeicqr4ho/source.c gcc -pthread /tmp/tmpeicqr4ho/tmp/tmpeicqr4ho/source.o -L/usr/lib64 -lopenblas -o /tmp/tmpeicqr4ho/a.out /usr/bin/ld: /tmp/tmpeicqr4ho/tmp/tmpeicqr4ho/source.o: in Funktion `main': /tmp/tmpeicqr4ho/source.c:4: undefinierter Verweis auf `zungqr_' Collect2: Fehler: ld hat 1 Exit-Status zurückgegeben NICHT VERFÜGBAR openblas_clapack_info: Bibliotheken openblas,lapack nicht gefunden in ['/home/ross/.virtualenvs/tmp/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib /'] NICHT VERFÜGBAR Flammeninfo: Bibliotheken-Flamme nicht gefunden in ['/home/ross/.virtualenvs/tmp/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/' ] NICHT VERFÜGBAR atlas_3_10_threads_info: Einstellung von PTATLAS=ATLAS Bibliotheken lapack_atlas nicht gefunden in /home/ross/.virtualenvs/tmp/lib Bibliotheken Tatlas, Tatlas nicht in /home/ross/.virtualenvs/tmp/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/local/lib . gefunden Bibliotheken Tatlas, Tatlas nicht in /usr/local/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/lib64 gefunden Bibliotheken Tatlas, Tatlas nicht in /usr/lib64 gefunden Bibliotheken lapack_atlas nicht in /usr/lib . gefunden Bibliotheken Tatlas, Tatlas nicht in /usr/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/lib/ gefunden Bibliotheken Tatlas, Tatlas nicht in /usr/lib/ gefundenNICHT VERFÜGBAR atlas_3_10_info: Bibliotheken lapack_atlas nicht gefunden in /home/ross/.virtualenvs/tmp/lib Bibliotheken satlas,Satlas nicht in /home/ross/.virtualenvs/tmp/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/local/lib . gefunden Bibliotheken satlas,Satlas nicht in /usr/local/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/lib64 gefunden Bibliotheken satlas,Satlas nicht in /usr/lib64 gefunden Bibliotheken lapack_atlas nicht in /usr/lib . gefunden Bibliotheken satlas,Satlas nicht in /usr/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/lib/ gefunden Bibliotheken satlas,Satlas nicht in /usr/lib/ gefunden NICHT VERFÜGBAR atlas_threads_info: Einstellung von PTATLAS=ATLAS Bibliotheken lapack_atlas nicht gefunden in /home/ross/.virtualenvs/tmp/lib Bibliotheken ptf77blas,ptcblas,atlas nicht in /home/ross/.virtualenvs/tmp/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/local/lib . gefunden Bibliotheken ptf77blas,ptcblas,atlas nicht in /usr/local/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/lib64 gefunden Bibliotheken ptf77blas,ptcblas,atlas nicht in /usr/lib64 gefunden Bibliotheken lapack_atlas nicht in /usr/lib . gefunden Bibliotheken ptf77blas,ptcblas,atlas nicht in /usr/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/lib/ gefunden Bibliotheken ptf77blas,ptcblas,atlas nicht in /usr/lib/ gefunden NICHT VERFÜGBAR atlas_info: Bibliotheken lapack_atlas nicht gefunden in /home/ross/.virtualenvs/tmp/lib Bibliotheken f77blas,cblas,atlas nicht in /home/ross/.virtualenvs/tmp/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/local/lib . gefunden Bibliotheken f77blas,cblas,atlas nicht in /usr/local/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/lib64 gefunden Bibliotheken f77blas,cblas,atlas nicht in /usr/lib64 gefunden Bibliotheken lapack_atlas nicht in /usr/lib . gefunden Bibliotheken f77blas,cblas,atlas nicht in /usr/lib . gefunden Bibliotheken lapack_atlas nicht in /usr/lib/ gefunden Bibliotheken f77blas,cblas,atlas nicht in /usr/lib/ gefunden NICHT VERFÜGBAR beschleunigen_info: NICHT VERFÜGBAR lapack_info: Bibliotheken lapack nicht gefunden in ['/home/ross/.virtualenvs/tmp/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/' ] NICHT VERFÜGBAR /home/ross/repos/numpy/numpy/distutils/system_info.py:1748: BenutzerWarnung: Lapack (http://www.netlib.org/lapack/) Bibliotheken nicht gefunden. Verzeichnisse für die Suche nach den Bibliotheken können im numpy/distutils/site.cfg-Datei (Abschnitt [lapack]) oder per Einstellung die LAPACK-Umgebungsvariable. return getattr(self, '_calc_info_{}'.format(name))() lapack_src_info: NICHT VERFÜGBAR /home/ross/repos/numpy/numpy/distutils/system_info.py:1748: BenutzerWarnung: Lapack (http://www.netlib.org/lapack/) Quellen nicht gefunden. Verzeichnisse für die Suche nach den Quellen können im numpy/distutils/site.cfg-Datei (Abschnitt [lapack_src]) oder per Einstellung die Umgebungsvariable LAPACK_SRC. return getattr(self, '_calc_info_{}'.format(name))() NICHT VERFÜGBAR numpy_linalg_lapack_lite: GEFUNDEN: Sprache = c define_macros = [('HAVE_BLAS_ILP64', Keine), ('BLAS_SYMBOL_SUFFIX', '64_')] nicht vorhandener Pfad in 'numpy/random': '{gen}.pxd' nicht vorhandener Pfad in 'numpy/random': '{gen}.pxd' /usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unbekannte Verteilungsoption: 'define_macros' warnings.warn(msg) Ausführen von build_ext Ausführen von build_src build_src py_modules-Quellen erstellen Gebäudebibliothek "npymath" Quellen Hinzufügen von 'numpy/core/src/npymath' zu include_dirs. Keine - nichts mit h_files = ['numpy/core/src/npymath/npy_math_internal.h'] Gebäudebibliothek "npysort" Quellen Hinzufügen von 'numpy/core/src/common' zu include_dirs. Keine - nichts mit h_files = ['numpy/core/src/common/npy_sort.h', 'numpy/core/src/common/npy_partition.h', 'numpy/core/src/common/npy_binsearch.h'] Gebäudebibliothek "npyrandom" Quellen Gebäudeerweiterung "numpy.core._multiarray_tests" Quellen conv_template:> numpy/core/src/multiarray/_multiarray_tests.c Gebäudeerweiterung "numpy.core._multiarray_umath" Quellen conv_template:> numpy/core/src/multiarray/arraytypes.c conv_template:> numpy/core/src/multiarray/einsum.c conv_template:> numpy/core/src/multiarray/lowlevel_strided_loops.c conv_template:> numpy/core/src/multiarray/nditer_templ.c conv_template:> numpy/core/src/multiarray/scalartypes.c conv_template:> numpy/core/src/umath/funcs.inc Hinzufügen von 'numpy/core/src/umath' zu include_dirs. conv_template:> numpy/core/src/umath/simd.inc conv_template:> numpy/core/src/umath/loops.h conv_template:> numpy/core/src/umath/loops.c conv_template:> numpy/core/src/umath/matmul.h conv_template:> numpy/core/src/umath/matmul.c conv_template:> numpy/core/src/umath/clip.h conv_template:> numpy/core/src/umath/clip.c conv_template:> numpy/core/src/umath/scalarmath.c conv_template:> numpy/core/src/npymath/npy_math_internal.h Hinzufügen von 'numpy/core/src/npymath' zu include_dirs. conv_template:> numpy/core/src/npymath/ieee754.c conv_template:> numpy/core/src/npymath/npy_math_complex.c conv_template:> numpy/core/src/common/templ_common.h Hinzufügen von 'numpy/core/src/common' zu include_dirs. conv_template:> numpy/core/src/common/npy_cpu_features.c numpy.core - nichts gemacht mit h_files = ['numpy/core/src/umath/funcs.inc', 'numpy/core/src/umath/simd.inc', 'numpy/core/src/umath/loops.h ', 'numpy/core/src/umath/matmul.h', 'numpy/core/src/umath/clip.h', 'numpy/core/src/npymath/npy_math_internal.h', 'numpy/core/src /common/templ_common.h', 'numpy/core/include/numpy/config.h', 'numpy/core/include/numpy/_numpyconfig.h', 'numpy/core/include/numpy/__multiarray_api.h', 'numpy/core/include/numpy/__ufunc_api.h'] Gebäudeerweiterung "numpy.core._umath_tests" Quellen Gebäudeerweiterung "numpy.core._rational_tests" Quellen Gebäudeerweiterung "numpy.core._struct_ufunc_tests" Quellen Gebäudeerweiterung "numpy.core._operand_flag_tests" Quellen Gebäudeerweiterung "numpy.fft._pocketfft_internal" Quellen Gebäudeerweiterung "numpy.linalg.lapack_lite" Quellen ### Warnung: Verwendung eines nicht optimierten Lapacks ### Gebäudeerweiterung "numpy.linalg._umath_linalg" Quellen ### Warnung: Verwendung eines nicht optimierten Lapacks ### Gebäudeerweiterung "numpy.random._mt19937" Quellen Gebäudeerweiterung "numpy.random._philox" Quellen Gebäudeerweiterung "numpy.random._pcg64" Quellen Gebäudeerweiterung "numpy.random._sfc64" Quellen Gebäudeerweiterung "numpy.random._common" Quellen Gebäudeerweiterung "numpy.random.bit_generator" Quellen Gebäudeerweiterung "numpy.random._generator" Quellen Gebäudeerweiterung "numpy.random._bounded_integers" Quellen Gebäudeerweiterung "numpy.random.mtrand" Quellen Erstellen von data_files-Quellen build_src: npy-pkg-Konfigurationsdateien erstellen UnixCCompiler anpassen Anpassen von UnixCCompiler mit new_build_clib Aufbau der 'npymath'-Bibliothek C-Quellen kompilieren C-Compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC Kompilierungsoptionen: '-Inumpy/core/src/npymath -Inumpy/core/include -Inumpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src /npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/home/ross/.virtualenvs/tmp/include -I/usr/include/python3.8 - Inumpy/core/src/common -Inumpy/core/src/npymath -c' zusätzliche Optionen: '-std=c99' gcc: numpy/core/src/npymath/halffloat.c gcc: numpy/core/src/npymath/npy_math.c gcc: numpy/core/src/npymath/npy_math_complex.c gcc: numpy/core/src/npymath/ieee754.c ar: Hinzufügen von 4 Objektdateien zu build/temp.linux-x86_64-3.8/libnpymath.a Aufbau einer 'npyrandom'-Bibliothek C-Quellen kompilieren C-Compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC Kompilierungsoptionen: '-Inumpy/core/include -Inumpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src /multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/home/ross/.virtualenvs/tmp/include -I/usr/include/python3.8 -Inumpy/core/src/common - Inumpy/core/src/npymath -c' zusätzliche Optionen: '-std=c99' gcc: numpy/random/src/distributions/distributions.c gcc: numpy/random/src/distributions/random_mvhg_count.c gcc: numpy/random/src/distributions/random_mvhg_marginals.c gcc: numpy/random/src/distributions/random_hypergeometric.c ar: Hinzufügen von 5 Objektdateien zu build/temp.linux-x86_64-3.8/libnpyrandom.a UnixCCompiler anpassen Anpassen von UnixCCompiler mit new_build_ext 'numpy.core._multiarray_tests' Erweiterung erstellen building C-Quellen kompilieren C-Compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC Kompilierungsoptionen: '-DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Inumpy/core/include -Inumpy/core/include/numpy -Inumpy/core/core/Inumpy/core/core/Inumpy/core/ /src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/home/ross/.virtualenvs/tmp/ include -I/usr/include/python3.8 -Inumpy/core/src/common -Inumpy/core/src/npymath -c' zusätzliche Optionen: '-std=c99' gcc: numpy/core/src/common/mem_overlap.c gcc: numpy/core/src/multiarray/_multiarray_tests.c gcc -pthread -shared -Wl,-O1,--sort-common,--as-bened,-z,relro,-z,now -fno-semantic-interposition -Wl,-O1,--sort-common, --as-needed,-z,relro,-z,now build/temp.linux-x86_64-3.8/numpy/core/src/multiarray/_multiarray_tests.o build/temp.linux-x86_64-3.8/numpy/core/ src/common/mem_overlap.o -L/usr/lib -Lbuild/temp.linux-x86_64-3.8 -lnpymath -o numpy/core/_multiarray_tests.cpython-38-x86_64-linux-gnu.so /usr/bin/ld: build/temp.linux-x86_64-3.8/numpy/core/src/common/mem_overlap.o:/home/ross/repos/numpy/numpy/core/include/numpy/ndarraytypes.h: 1825: Mehrfachdefinition von `PyArrayDTypeMeta_Type'; build/temp.linux-x86_64-3.8/numpy/core/src/multiarray/_multiarray_tests.o:/home/ross/repos/numpy/numpy/core/include/numpy/ndarraytypes.h:1825: zuerst hier definiert Collect2: Fehler: ld hat 1 Exit-Status zurückgegeben Fehler: Befehl "gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fno-semantic-interposition -Wl,-O1,-- sort-common,--as-needed,-z,relro,-z,now build/temp.linux-x86_64-3.8/numpy/core/src/multiarray/_multiarray_tests.o build/temp.linux-x86_64-3.8/ numpy/core/src/common/mem_overlap.o -L/usr/lib -Lbuild/temp.linux-x86_64-3.8 -lnpymath -o numpy/core/_multiarray_tests.cpython-38-x86_64-linux-gnu.so" fehlgeschlagen mit Ausgangsstatus 1
Python-Version: 3.8.3
NumPy-Version: 1809a0fde
GCC-Version: 10.1
Ich denke, diese Definitionen sind wahrscheinlich nicht unbedingt in Ordnung (jetzt, wo Sie es bemerken, gibt mir die statische Analyse von Clang auch einige Warnungen). Sie müssen wahrscheinlich in die spezifischen Header-Dateien verschoben werden, bis wir sie öffentlich machen?
Das sehe ich auch, gcc 10.1.1. Habe gestern Abend mein Betriebssystem aktualisiert, es gibt immer Probleme nach...
Ich sehe das mit
jupiter<strong i="6">@23</strong>:06 ➤ gcc --version
gcc (GCC) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Der Fehler ist ein fehlendes extern
in der Deklaration, gh-16435 sollte es beheben, Ross hat es für mich getestet.
Hilfreichster Kommentar
Der Fehler ist ein fehlendes
extern
in der Deklaration, gh-16435 sollte es beheben, Ross hat es für mich getestet.