Python模块表编译失败

时间:2017-04-28 17:44:00

标签: python gcc python-module

我正在尝试在Mingw32中为python 2.7安装tables

$ pip install tables

编译期间安装失败:

Running setup.py install for tables: started

    Running setup.py install for tables: finished with status 'error'
    Complete output from command C:/msys2/mingw32/bin/python2.exe -u -c "import setuptools, tokenize;__file__='c:/users/e026986/appdata/local/temp/pip-build-7nh9m0/tables/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:/users/e026986/appdata/local/temp/pip-cvcroq-record/install-record.txt --single-version-externally-managed --compile:
    * Using Python 2.7.13 (default, Jan 17 2017, 14:07:43)  [GCC 6.3.0 32 bit]
    * USE_PKGCONFIG: True

        ....

    * Could not find blosc headers and library; using internal sources.
    SSE2 detected
    C:/msys2/mingw32/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'extra_require'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
        ....

    C:\msys2\mingw32\bin/i686-w64-mingw32-gcc.exe -fno-strict-aliasing -march=i686 -mtune=generic -O2 -pipe -fwrapv -D__USE_MINGW_ANSI_STDIO=1 -DNDEBUG -DNDEBUG -DNDEBUG=1 -DWIN32=1 -D_HDF5USEDLL_=1 -DH5_BUILT_AS_DYNAMIC_LIB=1 -DHAVE_BZ2_LIB=1 -DHAVE_LZ4=1 -DHAVE_SNAPPY=1 -DHAVE_ZLIB=1 -DHAVE_ZSTD=1 -D__SSE2__=1 -Ihdf5-blosc/src -IC:/msys2/mingw32/include -IC:/msys2/mingw32/include -Ic-blosc/blosc -Ic-blosc/internal-complibs/lz4-1.7.5 -Ic-blosc/internal-complibs/snappy-1.1.1 -Ic-blosc/internal-complibs/zlib-1.2.8 -Ic-blosc/internal-complibs/zstd-1.1.3 -Ic-blosc/internal-complibs/zstd-1.1.3/common -Ic-blosc/internal-complibs/zstd-1.1.3 -IC:/msys2/mingw32/lib/python2.7/site-packages/numpy/core/include -IC:/msys2/mingw32/include/python2.7 -c tables/utilsextension.c -o build/temp.mingw-2.7/tables/utilsextension.o -Isrc -DH5_USE_18_API -DH5Acreate_vers=2 -DH5Aiterate_vers=2 -DH5Dcreate_vers=2 -DH5Dopen_vers=2 -DH5Eclear_vers=2 -DH5Eprint_vers=2 -DH5Epush_vers=2 -DH5Eset_auto_vers=2 -DH5Eget_auto_vers=2 -DH5Ewalk_vers=2 -DH5E_auto_t_vers=2 -DH5Gcreate_vers=2 -DH5Gopen_vers=2 -DH5Pget_filter_vers=2 -DH5Pget_filter_by_id_vers=2 -DH5Tarray_create_vers=2 -DH5Tget_array_dims_vers=2 -DH5Z_class_t_vers=2 -DSHUFFLE_SSE2_ENABLED

        ....

    C:\msys2\mingw32\bin/i686-w64-mingw32-gcc.exe -fno-strict-aliasing -march=i686 -mtune=generic -O2 -pipe -fwrapv -D__USE_MINGW_ANSI_STDIO=1 -DNDEBUG -DNDEBUG -DNDEBUG=1 -DWIN32=1 -D_HDF5USEDLL_=1 -DH5_BUILT_AS_DYNAMIC_LIB=1 -DHAVE_BZ2_LIB=1 -DHAVE_LZ4=1 -DHAVE_SNAPPY=1 -DHAVE_ZLIB=1 -DHAVE_ZSTD=1 -D__SSE2__=1 -Ihdf5-blosc/src -IC:/msys2/mingw32/include -IC:/msys2/mingw32/include -Ic-blosc/blosc -Ic-blosc/internal-complibs/lz4-1.7.5 -Ic-blosc/internal-complibs/snappy-1.1.1 -Ic-blosc/internal-complibs/zlib-1.2.8 -Ic-blosc/internal-complibs/zstd-1.1.3 -Ic-blosc/internal-complibs/zstd-1.1.3/common -Ic-blosc/internal-complibs/zstd-1.1.3 -IC:/msys2/mingw32/lib/python2.7/site-packages/numpy/core/include -IC:/msys2/mingw32/include/python2.7 -c c-blosc/blosc/bitshuffle-sse2.c -o build/temp.mingw-2.7/c-blosc/blosc/bitshuffle-sse2.o -Isrc -DH5_USE_18_API -DH5Acreate_vers=2 -DH5Aiterate_vers=2 -DH5Dcreate_vers=2 -DH5Dopen_vers=2 -DH5Eclear_vers=2 -DH5Eprint_vers=2 -DH5Epush_vers=2 -DH5Eset_auto_vers=2 -DH5Eget_auto_vers=2 -DH5Ewalk_vers=2 -DH5E_auto_t_vers=2 -DH5Gcreate_vers=2 -DH5Gopen_vers=2 -DH5Pget_filter_vers=2 -DH5Pget_filter_by_id_vers=2 -DH5Tarray_create_vers=2 -DH5Tget_array_dims_vers=2 -DH5Z_class_t_vers=2 -DSHUFFLE_SSE2_ENABLED
    In file included from C:/msys2/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/xmmintrin.h:31:0,
                     from C:/msys2/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/emmintrin.h:31,
                     from c-blosc/blosc/bitshuffle-sse2.c:23:
    C:/msys2/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/mmintrin.h: In function '_mm_add_si64':
    C:/msys2/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/mmintrin.h:318:3: error: can't convert a value of type 'int' to vector type '__vector(2) int' which has different size
       return (__m64) __builtin_ia32_paddq ((__v1di)__m1, (__v1di)__m2);
       ^~~~~~

       ....

    C:/msys2/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/emmintrin.h: In function '_mm_avg_epu16':
    C:/msys2/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/emmintrin.h:1443:3: error: can't convert a value of type 'int' to vector type '__vector(2) long long int' which has different size
       return (__m128i)__builtin_ia32_pavgw128 ((__v8hi)__A, (__v8hi)__B);
       ^~~~~~
    C:/msys2/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/emmintrin.h: In function '_mm_sad_epu8':
    C:/msys2/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/emmintrin.h:1449:3: error: can't convert a value of type 'int' to vector type '__vector(2) long long int' which has different size
       return (__m128i)__builtin_ia32_psadbw128 ((__v16qi)__A, (__v16qi)__B);
       ^~~~~~
    c-blosc/blosc/bitshuffle-sse2.c: In function 'bshuf_trans_byte_elem_SSE_16':
    c-blosc/blosc/bitshuffle-sse2.c:56:12: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
             a0 = _mm_loadu_si128((__m128i *) &in_b[2*ii + 0*16]);
             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    error: command 'C:\\msys2\\mingw32\\bin/i686-w64-mingw32-gcc.exe' failed with exit status 1

    ----------------------------------------
Command "C:/msys2/mingw32/bin/python2.exe -u -c "import setuptools, tokenize;__file__='c:/users/e026986/appdata/local/temp/pip-build-7nh9m0/tables/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:/users/e026986/appdata/local/temp/pip-cvcroq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:/users/e026986/appdata/local/temp/pip-build-7nh9m0/tables/

这似乎与SSE的支持有关,但我不太确定。有线索吗?

1 个答案:

答案 0 :(得分:0)

我找不到使用pip的解决方案。我尝试在使用gcc选项-mno-sse-mno-sse2-mno-mmx编译期间禁用SSE支持,但没有任何效果。

我最终手动安装了没有SSE的模块:

  • 解压由pip下载的包

  • 修改setup.py以删除 SSE支持,

  • 执行setup.py