Skip to content

Compilation error with out-of-tree builds with 0.24.0a1: LONG_BIT definition appears wrong for platform #4118

@lesteve

Description

@lesteve

🐛 Bug

Trying to use out-of-tree builds with 0.24.0a1 yields a compilation error: LONG_BIT definition appears wrong for platform

Maybe this is not supposed to work with the alpha version but will work fine with the 0.24 release?

I have found this same error in other places in the issue tracker e.g. #2186 (comment) or #775 (comment) but without a clear solution.

Excerpt of the build log with the error
building 'sklearn.__check_build._check_build' extension
creating build/temp.emscripten_3_1_44_wasm32-cpython-311/sklearn/__check_build
/tmp/tmp_co55dq1/cc -DNDEBUG -g -fwrapv -O3 -Wall -O2 -g0 -fPIC -DPY_CALL_TRAMPOLINE -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/tmp/build-env-o9s9adj9/include -I/opt/conda/envs/env/include/python3.11 -c sklearn/__check_build/_check_build.c -o build/temp.emscripten_3_1_44_wasm32-cpython-311/sklearn/__check_build/_check_build.o -g0 -O2
In file included from sklearn/__check_build/_check_build.c:35:
In file included from /opt/conda/envs/env/include/python3.11/Python.h:38:
/opt/conda/envs/env/include/python3.11/pyport.h:601:2: error: "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  601 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
      |  ^
sklearn/__check_build/_check_build.c:415:39: error: expression is not an integer constant expression
  415 |     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sklearn/__check_build/_check_build.c:415:41: note: division by zero
  415 |     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
      |                                         ^
2 errors generated.
emcc: error: '/emsdk/upstream/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -Werror=implicit-function-declaration --sysroot=/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -DNDEBUG -g3 -fwrapv -O3 -Wall -O2 -g0 -fPIC -DPY_CALL_TRAMPOLINE -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/tmp/build-env-o9s9adj9/include -I/opt/conda/envs/env/include/python3.11 -c -g0 -O2 -Werror=implicit-function-declaration -Werror=mismatched-parameter-types -Werror=return-type -O2 -g0 -fPIC -I/.pyodide-xbuildenv/xbuildenv/pyodide-root/cpython/installs/python-3.11.3/include/python3.11 -I/.pyodide-xbuildenv/xbuildenv/pyodide-root/cpython/installs/python-3.11.3/include/python3.11 sklearn/__check_build/_check_build.c -o build/temp.emscripten_3_1_44_wasm32-cpython-311/sklearn/__check_build/_check_build.o' failed (returned 1)
error: command '/tmp/tmp_co55dq1/cc' failed with exit code 1

To Reproduce

# Need set up emscripten 3.1.44 the usual way before
pip install pyodide-build==0.24.0a1
pyodide build scikit-learn

Expected behavior

Builds a Pyodide wheel for scikit-learn

Environment

  • Pyodide Version: 0.24.0a1
  • Browser version:
  • Any other relevant information:

Additional context

With Pyodide 0.24 the scikit-learn test suite fully passes, except some tests due to Pyodide limitations.

I saw the 0.24 release was approaching and I wanted to give a go to start running the scikit-learn tests inside Pyodide and in the scikit-learn CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions