Skip to content

Clarification on g++ / libcxx requirements: `GLIBCXX_3.4.32' not found #1663

@pramodk

Description

@pramodk

Hello All,

This is somewhat related to #907 but I wanted to explicitly clarify the g++ / libcxx requirements - hence this issue.

I am on Ubuntu 22.04 with g++ v11 and python 3.10, and have bitsandbytes version 0.46.0 installed:

(venv) root@login-0:~# pip show bitsandbytes
Name: bitsandbytes
Version: 0.46.0
Summary: k-bit optimizers and matrix multiplication routines.
Home-page: https://github.com/bitsandbytes-foundation/bitsandbytes
...
Location: /root/dgx-stage/venv/lib/python3.10/site-packages
Requires: numpy, torch

However, attempting to load the module results in the following error:

Could not load bitsandbytes native library: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /root/dgx-stage/venv/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so)

Traceback (most recent call last):
  File "/root/dgx-stage/venv/lib/python3.10/site-packages/bitsandbytes/cextension.py", line 85, in <module>
    lib = get_native_library()
  File "/root/dgx-stage/venv/lib/python3.10/site-packages/bitsandbytes/cextension.py", line 72, in get_native_library
    dll = ct.cdll.LoadLibrary(str(binary_path))
  File "/usr/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found

My system's libstdc++ doesn't have GLIBCXX_3.4.32:

# strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_3.4.29
GLIBCXX_3.4.30
GLIBCXX_DEBUG_MESSAGE_LENGTH

Based on this StackOverflow thread, it seems GLIBCXX_3.4.32 is from g++-13.

As a workaround, I built bitsandbytes from source, which avoids the libcxx compatibility issue by compiling with system toolchain:

git clone https://github.com/bitsandbytes-foundation/bitsandbytes.git && cd bitsandbytes/
cmake -DCOMPUTE_BACKEND=cpu -S .
make
pip install -e .

I am opening this issue to confirm whether this is expected behavior and whether the wheel could be made backward-compatible (e.g., manylinux-compliant). I haven't checked the wheel build pipeline but suspect this may be a side effect of building with a newer GCC.

Thanks in advance!

Reproduction

As described above, install on Ubuntu 22.04 where GPU stack is not available and try to load the module.

Expected behavior

wheel should be compatible with platform like Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions