Skip to content

BUG: Issue with stripping on macOS Monterey + xcode 13.2 #16446

@tacaswell

Description

@tacaswell

Describe your issue.

After successfully compiling, during the final steps of installation

pip install --no-build-isolation .

with the current default branch of scipy fails with an error while stripping the files. I think the key line is

  /Library/Developer/CommandLineTools/usr/bin/strip: error: symbols referenced by indirect symbol table entries that can't be stripped in: /Users/tcaswell/source/p/scipy/scipy/.mesonpy-2w0tepol/install/Users/tcaswell/.pybuild/bleeding/lib/python3.10/site-packages/scipy/_lib/_ccallback_c.cpython-310-darwin.so

This is with the tip of the Python 3.10 branch (3.10.5+). Also tried with the main branch of meson-python.

[2/2] Generating scipy/generate-version with a custom command
  Installing scipy/__config__.py to /Users/tcaswell/source/p/scipy/scipy/.mesonpy-2w0tepol/install/Users/tcaswell/.pybuild/bleeding/lib/python3.10/site-packages//scipy
  Installing scipy/version.py to /Users/tcaswell/source/p/scipy/scipy/.mesonpy-2w0tepol/install/Users/tcaswell/.pybuild/bleeding/lib/python3.10/site-packages//scipy
  Installing scipy/_lib/_ccallback_c.cpython-310-darwin.so to /Users/tcaswell/source/p/scipy/scipy/.mesonpy-2w0tepol/install/Users/tcaswell/.pybuild/bleeding/lib/python3.10/site-packages/scipy/_lib
  Stripping target 'scipy/_lib/_ccallback_c.cpython-310-darwin.so'.
  Could not strip file.

  Stdout:


  Stderr:
  /Library/Developer/CommandLineTools/usr/bin/strip: error: symbols referenced by indirect symbol table entries that can't be stripped in: /Users/tcaswell/source/p/scipy/scipy/.mesonpy-2w0tepol/install/Users/tcaswell/.pybuild/bleeding/lib/python3.10/site-packages/scipy/_lib/_ccallback_c.cpython-310-darwin.so
  _PyBytes_AsStringAndSize
  _PyBytes_FromString
  _PyBytes_FromStringAndSize
  _PyCallable_Check
  _PyCapsule_GetContext
  _PyCapsule_GetName
  _PyCapsule_GetPointer
  _PyCapsule_New
  _PyCapsule_SetContext
  _PyCode_NewEmpty
  _PyCode_NewWithPosOnlyArgs
  _PyDict_GetItemString
  _PyDict_New
  _PyDict_Next
  _PyDict_SetItem
  _PyDict_SetItemString
  _PyDict_Size
  _PyErr_Clear
  _PyErr_ExceptionMatches
  _PyErr_Format
  _PyErr_GivenExceptionMatches
  _PyErr_NoMemory
  _PyErr_NormalizeException
  _PyErr_Occurred
  _PyErr_PrintEx
  _PyErr_SetObject
  _PyErr_SetString
  _PyErr_WarnEx
  _PyErr_WarnFormat
  _PyErr_WriteUnraisable
  _PyEval_RestoreThread
  _PyEval_SaveThread
  _PyException_SetTraceback
  _PyFloat_AsDouble
  _PyFloat_FromDouble
  _PyFloat_FromString
  _PyFrame_New
  _PyGILState_Ensure
  _PyGILState_Release
  _PyImport_AddModule
  _PyImport_GetModule
  _PyImport_GetModuleDict
  _PyImport_ImportModule
  _PyImport_ImportModuleLevelObject
  _PyInterpreterState_GetID
  _PyList_Append
  _PyList_New
  _PyLong_AsDouble
  _PyLong_AsLong
  _PyLong_AsSsize_t
  _PyLong_AsVoidPtr
  _PyLong_FromLong
  _PyLong_FromSize_t
  _PyLong_FromSsize_t
  _PyMem_Free
  _PyMem_Malloc
  _PyMem_Realloc
  _PyMethod_New
  _PyModuleDef_Init
  _PyModule_AddObject
  _PyModule_GetDict
  _PyModule_NewObject
  _PyNumber_Add
  _PyNumber_Index
  _PyOS_snprintf
  _PyOS_string_to_double
  _PyObject_Call
  _PyObject_ClearWeakRefs
  _PyObject_Free
  _PyObject_GC_Del
  _PyObject_GC_Track
  _PyObject_GC_UnTrack
  _PyObject_GetAttr
  _PyObject_GetAttrString
  _PyObject_GetItem
  _PyObject_GetIter
  _PyObject_Hash
  _PyObject_IsTrue
  _PyObject_Not
  _PyObject_RichCompare
  _PyObject_SetAttr
  _PyObject_SetAttrString
  _PyThreadState_Get
  _PyTraceBack_Here
  _PyTuple_GetItem
  _PyTuple_GetSlice
  _PyTuple_New
  _PyTuple_Pack
  _PyType_IsSubtype
  _PyType_Ready
  _PyUnicode_AsUTF8
  _PyUnicode_AsUTF8AndSize
  _PyUnicode_Compare
  _PyUnicode_Decode
  _PyUnicode_DecodeASCII
  _PyUnicode_FromFormat
  _PyUnicode_FromString
  _PyUnicode_FromStringAndSize
  _PyUnicode_InternFromString
  _Py_EnterRecursiveCall
  _Py_GetVersion
  _Py_LeaveRecursiveCall
  __PyDict_GetItem_KnownHash
  __PyObject_GC_New
  __PyObject_GenericGetAttrWithDict
  __PyObject_GetDictPtr
  __PyThreadState_UncheckedGet
  __PyUnicode_IsWhitespace
  __PyUnicode_Ready
  __Py_Dealloc
  ___assert_rtn
  ___stack_chk_fail
  _free
  _memcmp
  _sin
  _strcmp
  _strdup
  _strrchr
  _PyBaseObject_Type
  _PyByteArray_Type
  _PyBytes_Type
  _PyCFunction_Type
  _PyCapsule_Type
  _PyExc_AttributeError
  _PyExc_DeprecationWarning
  _PyExc_ImportError
  _PyExc_NameError
  _PyExc_OverflowError
  _PyExc_RuntimeError
  _PyExc_RuntimeWarning
  _PyExc_StopIteration
  _PyExc_SystemError
  _PyExc_TypeError
  _PyExc_ValueError
  _PyFloat_Type
  _PyList_Type
  _PyLong_Type
  _PyMethod_Type
  _PyObject_GenericGetAttr
  _PyTuple_Type
  _PyUnicode_Type
  __PyByteArray_empty_string
  __Py_FalseStruct
  __Py_NoneStruct
  __Py_TrueStruct
  __Py_ascii_whitespace
  ___stack_chk_guard
  _libcd_validate_csblobs: superblob is invalid

  /Library/Developer/CommandLineTools/usr/bin/strip: warning: changes being made to the file will invalidate the code signature in: /Users/tcaswell/source/p/scipy/scipy/.mesonpy-2w0tepol/install/Users/tcaswell/.pybuild/bleeding/lib/python3.10/site-packages/scipy/_lib/_ccallback_c.cpython-310-darwin.so


  + meson setup --native-file=/Users/tcaswell/source/p/scipy/scipy/.mesonpy-native-file.ini -Ddebug=false -Dstrip=true -Doptimization=2 --prefix=/Users/tcaswell/.pybuild/bleeding /Users/tcaswell/source/p/scipy/scipy /Users/tcaswell/source/p/scipy/scipy/.mesonpy-2w0tepol/build
  + meson compile
  + meson install --destdir /Users/tcaswell/source/p/scipy/scipy/.mesonpy-2w0tepol/install
  Traceback (most recent call last):
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
      hook = backend.prepare_metadata_for_build_wheel
  AttributeError: module 'mesonpy' has no attribute 'prepare_metadata_for_build_wheel'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
      whl_basename = backend.build_wheel(metadata_directory, config_settings)
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/mesonpy/__init__.py", line 837, in build_wheel
      return project.wheel(out).name
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/mesonpy/__init__.py", line 786, in wheel
      wheel = _WheelBuilder(self).build(self._install_plan, self._copy_files, self._build_dir)
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/mesonpy/__init__.py", line 318, in build
      self._project.build()  # ensure project is built
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/mesonpy/__init__.py", line 482, in build
      self._meson('install', '--destdir', os.fspath(self._install_dir))
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/mesonpy/__init__.py", line 430, in _meson
      return self._proc('meson', *args)
    File "/Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/mesonpy/__init__.py", line 426, in _proc
      subprocess.check_call(list(args))
    File "/Users/tcaswell/.pybuild/bleeding/lib/python3.10/subprocess.py", line 369, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['meson', 'install', '--destdir', '/Users/tcaswell/source/p/scipy/scipy/.mesonpy-2w0tepol/install']' returned non-zero exit status 1.
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/tcaswell/.virtualenvs/bleeding/bin/python3 /Users/tcaswell/.virtualenvs/bleeding/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/h8/fznvr0sj7hsb027_j45psrvr0000gn/T/tmpw1kosxgz
  cwd: /Users/tcaswell/source/p/scipy/scipy
  Preparing metadata (pyproject.toml) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Reproducing Code Example

pip install -v --no-build-isolation .

Error message

# see above

SciPy/NumPy/Python version information

N/A (can not install scipy)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Build issuesIssues with building from source, including different choices of architecture, compilers and OSMesonItems related to the introduction of Meson as the new build system for SciPydefectA clear bug or issue that prevents SciPy from being installed or used as expected

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions