Skip to content

create.sh fails to successfully build libnbd without python setuptools #290

@shimeike

Description

@shimeike

Version used
2.39

Describe the bug
When running the create.sh script to build virtnbdbackup in a Python virtual environment, the build of the libnbd python bindings fails with the error shown below. There are also warnings when running ./configure from the script.

Expected behavior
The provided script should complete successfully.

Logfiles:
Configure warnings:

checking for Python site-packages path... Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import distutils.sysconfig;                                                print (distutils.sysconfig.get_python_lib(1,0));
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'

checking for Python extension suffix (PEP-3149)... Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import distutils.sysconfig;                                          print (distutils.sysconfig.get_config_var('EXT_SUFFIX') or distutils.sysconfig.get_config_var('SO'))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'

Build error:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python3.13 -I../include -I../common/include -I../common/utils -g -O2 -MT libnbdmod_la-methods.lo -MD -MP -MF .deps/libnbdmod_la-methods.Tpo -c methods.c -o libnbdmod_la-methods.o >/dev/null 2>&1
mv -f .deps/libnbdmod_la-methods.Tpo .deps/libnbdmod_la-methods.Plo
/bin/sh ../libtool  --tag=CC   --mode=link gcc  -g -O2 -avoid-version -shared -module -shrext   -o libnbdmod.la -rpath  libnbdmod_la-handle.lo libnbdmod_la-libnbdmod.lo libnbdmod_la-methods.lo libnbdmod_la-utils.lo  ../common/utils/libutils.la ../lib/libnbd.la
libtool:   error: only absolute run-paths are allowed

Workaround:
Installing python setuptools prior to configuring libnbd removes the warnings and errors. Apparently setuptools was removed as a core venv dependency in python 3.12 (reference).

--- ./venv/create.sh
+++ ./venv/create.sh
@@ -19,6 +19,7 @@
 virtualenv -p $(which python3) ${VENVDIR}
 git clone https://github.com/abbbi/virtnbdbackup.git -b ${BRANCH}
 source ${VENVDIR}/bin/activate
+pip install -U setuptools
 curl https://download.libguestfs.org/libnbd/${LIBNBD_MAJ}/${LIBNBD_VERSION}.tar.gz  > ${LIBNBD_VERSION}.tar.gz
 tar xzf ${LIBNBD_VERSION}.tar.gz
 cd ${LIBNBD_VERSION}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions