Bug 265060 - archivers/py-borgbackup: Fails to run: PYTHONPREFIX_SITELIBDIR/borg/algorithms/checksums.cpython-39.so: Undefined symbol "static_assert"
Summary: archivers/py-borgbackup: Fails to run: PYTHONPREFIX_SITELIBDIR/borg/algorithm...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Matthias Andree
URL:
Keywords:
: 265346 (view as bug list)
Depends on: 265819
Blocks: 265346
  Show dependency treegraph
 
Reported: 2022-07-06 11:20 UTC by D. Sun
Modified: 2022-08-14 11:34 UTC (History)
18 users (show)

See Also:
pi: maintainer-feedback+
mandree: merge-quarterly+


Attachments
Avoid dependency with xxhash port (1.22 KB, patch)
2022-07-16 17:09 UTC, Jose G. Juanino
jjuanino: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description D. Sun 2022-07-06 11:20:53 UTC
When executing borg installed from the latest binary package (pkg install py39-borgbackup), I get the error:

> borg
===
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/borg/archiver.py", line 40, in <module>
    from .algorithms.checksums import crc32
ImportError: /usr/local/lib/python3.9/site-packages/borg/algorithms/checksums.cpython-39.so: Undefined symbol "static_assert"
===

Happens as all users, including root.

When building a package via the ports collection and then installing (make package; pkg install...), it works without issue.

All other installed packages are via binary package - pkg update / pkg upgrade shows everything is current, repo URL is "pkg+http://pkg.FreeBSD.org/${ABI}/latest".

Previously worked fine with Python 3.8.

OS: FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212
Kernel: GENERIC amd64

> pkg info | grep py39
===
py39-arrow-1.2.2               Better dates and times for Python
py39-attrs-21.4.0              Python attributes without boilerplate
py39-borgbackup-1.1.18         Deduplicating backup program
py39-borgmatic-1.5.24          Wrapper script for Borg backup software
py39-certifi-2022.5.18.1       Mozilla SSL certificates
py39-cffi-1.15.0_1             Foreign Function Interface for Python calling C code
py39-charset-normalizer-2.0.12 Real First Universal Charset Detector
py39-colorama-0.4.4            Cross-platform API to print colored terminal text from Python applications
py39-cryptography-3.4.8        Cryptographic recipes and primitives for Python developers
py39-dateutil-2.8.2            Extensions to the standard Python datetime module
py39-dnspython-2.2.1,1         DNS toolkit for Python
py39-docopt-0.6.2_1            Pythonic argument parser, that will make you smile
py39-funcsigs-1.0.2            Python function signatures from PEP362
py39-idna-3.3                  Internationalized Domain Names in Applications (IDNA)
py39-importlib-metadata-4.8.1  Read metadata from Python packages
py39-importlib-resources-5.4.0_1 Read resources from Python packages
py39-jsonschema-4.6.0_1        JSON Schema validation for Python
py39-llfuse-1.3.8              Python bindings for low-level FUSE API
py39-logfury-0.1.2             Toolkit for logging of library method calls
py39-markdown-3.3.7            Python implementation of Markdown
py39-openssl-20.0.1,1          Python interface to the OpenSSL library
py39-packaging-21.3            Core utilities for Python packages
py39-pycparser-2.21            C parser in Python
py39-pykwalify-1.8.0           Python library and CLI for JSON/YAML schema validation
py39-pyparsing-3.0.9           General parsing module for Python
py39-pyrsistent-0.14.11_1      Persistent/Functional/Immutable data structures
py39-pysocks-1.7.1             Python SOCKS module
py39-requests-2.28.0           Python HTTP for Humans
py39-ruamel.yaml-0.16.12       YAML 1.2 loader/dumper package for Python
py39-ruamel.yaml.clib-0.2.6    C version of reader, parser and emitter for ruamel.yaml
py39-setuptools-62.1.0_1       Python packages installer
py39-six-1.16.0                Python 2 and 3 compatibility utilities
py39-sqlite3-3.9.13_7          Standard Python binding to the SQLite3 library (Python 3.9)
py39-tqdm-4.64.0               Fast, extensible progress bar for Python
py39-urllib3-1.26.9,1          HTTP library with thread-safe connection pooling, file post, and more
py39-zipp-3.4.0                Backport of pathlib-compatible object wrapper for zip files
===
Comment 1 N. J. Thomas 2022-07-08 19:57:30 UTC
Seeing the
Comment 2 N. J. Thomas 2022-07-08 19:58:32 UTC
Seeing the same thing on an amd64 13.0 box. I thought it was my pkgs/os, so I stripped the machine down of all packages, upgraded to 13.1 and reinstalled everything, but the same error persisted.
Comment 3 N. J. Thomas 2022-07-08 20:17:44 UTC
Also confirmed that building from ports fixes the problem.
Comment 4 Marcel Bischoff 2022-07-08 21:27:42 UTC
I can confirm this as well. This bit me today after updating my remote backup server. It's a severe issue in my view as it broke my automatic backups.
Comment 5 Marcel Bischoff 2022-07-08 21:33:16 UTC
Building from ports does not fix it for me.
Comment 6 N. J. Thomas 2022-07-09 20:44:36 UTC
(In reply to Marcel Bischoff from comment #5)

Do you get the same error (that the pkg produces) when you build from ports?


When you built the port, did you build all the port dependencies as well?
Comment 7 patpro 2022-07-10 05:36:50 UTC
I've upgraded to FreeBSD 13.1-RELEASE yesterday (from 12.x-RELEASE) and I've upgraded all my pkgs, including the default Python version bump, resulting in this error during my daily backup jobs.
Another server running 13.1-RELEASE but with python 3.8 does not show this error.

I've removed the pkg and installed the port, with apparent success:

# pkg delete -f py39-borgbackup
# cd /usr/ports/archivers/py-borgbackup
# make install
# borg -V
borg 1.1.18
Comment 8 qt 2022-07-10 13:03:06 UTC
I ran into the same problem. As a workaround, I downloaded the standalone binary `borg-freebsd64` v1.2.1 (https://github.com/borgbackup/borg/releases/tag/1.2.1), renamed it to `borg`, and put it in `/usr/local/bin`
Comment 9 Jose G. Juanino 2022-07-11 22:24:45 UTC
Hi, 

honestly, I do not know the root cause of this annoying issue when upgrading to python 3.9, but at least I can confirm that building the package in poudriere with the last tree ports version results works.

Regards
Comment 10 Jose G. Juanino 2022-07-12 11:24:34 UTC
I am thinking about a fix to this issue, but only it occurs to me to force rebuild the port again in the public pkg repository by mean of adding

PORTREVISION=1

to Makefile

I think this will trigger the rebuild of pkg in the last ports tree and at least a valid version will be publicly available.

As I said yesterday, building the port with poudriere in the last ports tree version give a valid pkg in python 3.9 version, and it works fine.

Could any committer confirm whether what I am saying is feasible or is a nonsense?

Regards
Comment 11 qt 2022-07-12 12:32:02 UTC
(In reply to Jose G. Juanino from comment #10)

Would it make sense to upgrade to version 1.2.1? It is listed as stable: https://www.borgbackup.org/releases/borg-1.2.html
Comment 12 korsani 2022-07-13 07:34:44 UTC
Hi there,

Same problem here.

Building from ports did not solve.

Rebuilding xxhash from ports did not solve.

Installing via pip (pip install borgbackup) DOES work...
Comment 13 Thierry Dussuet 2022-07-16 00:03:28 UTC
For people who are having trouble to build this from the ports, you can try: make extract, then edit work-py3*/borgbackup-1.1.18/setup.py, there on line 26 set prefer_system_libxxhash = False instead of True. This worked here on all machines which had trouble with this error.
Comment 14 korsani 2022-07-16 07:57:26 UTC
Hi there,

This fix worked for me. Huge thanks !
Comment 15 Jose G. Juanino 2022-07-16 17:09:15 UTC
Created attachment 235291 [details]
Avoid dependency with xxhash port

Hi, thanks to Thierry Dussuet for address the issue.

I attach the patch to avoid dependency to xxhash port. Instead, it uses the xxhash library provided in the same port. Regards.
Comment 16 Marcel Bischoff 2022-07-17 09:38:18 UTC
I can verify that applying this patch works when building from ports.
Comment 17 pmisch 2022-08-11 10:19:48 UTC
Can this please be fixed. We're rolling out our backups with Ansible and pkg and this bug prevents us from deploying backups to new systems.
Comment 18 Kurt Jaeger freebsd_committer freebsd_triage 2022-08-11 18:13:59 UTC
testbuild@work
Comment 19 Kurt Jaeger freebsd_committer freebsd_triage 2022-08-13 09:48:37 UTC
(In reply to Kurt Jaeger from comment #18)
builds are fine, but I have a git problem committing this 8-(
Comment 20 commit-hook freebsd_committer freebsd_triage 2022-08-13 15:27:50 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9db903a89b3d1d7c0be2a56059542f3fdb412908

commit 9db903a89b3d1d7c0be2a56059542f3fdb412908
Author:     Jose G. Juanino <jjuanino@gmail.com>
AuthorDate: 2022-08-13 15:23:51 +0000
Commit:     Kurt Jaeger <pi@FreeBSD.org>
CommitDate: 2022-08-13 15:23:51 +0000

    archivers/py-borgbackup: avoid dependency on xxhash port

    - Instead, use the xxhash library provided in the same port

    PR:     265060
    Author: Jose G. Juanino <jjuanino@gmail.com>

 archivers/py-borgbackup/Makefile                   |  3 +--
 archivers/py-borgbackup/files/patch-setup.py (new) | 11 +++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)
Comment 21 Kurt Jaeger freebsd_committer freebsd_triage 2022-08-13 15:28:21 UTC
Committed, thanks!
Comment 22 commit-hook freebsd_committer freebsd_triage 2022-08-13 15:30:54 UTC
A commit in branch 2022Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4befea1c30c8c318adb1582f58bb54e8ae2c3772

commit 4befea1c30c8c318adb1582f58bb54e8ae2c3772
Author:     Jose G. Juanino <jjuanino@gmail.com>
AuthorDate: 2022-08-13 15:23:51 +0000
Commit:     Kurt Jaeger <pi@FreeBSD.org>
CommitDate: 2022-08-13 15:30:05 +0000

    archivers/py-borgbackup: avoid dependency on xxhash port

    - Instead, use the xxhash library provided in the same port

    PR:     265060
    Author: Jose G. Juanino <jjuanino@gmail.com>
    (cherry picked from commit 9db903a89b3d1d7c0be2a56059542f3fdb412908)

 archivers/py-borgbackup/Makefile                   |  3 +--
 archivers/py-borgbackup/files/patch-setup.py (new) | 11 +++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)
Comment 23 Matthias Andree freebsd_committer freebsd_triage 2022-08-13 16:06:13 UTC
would not it be better if we fixed xxhash?
Comment 24 Marcel Bischoff 2022-08-13 16:38:48 UTC
Probably. But please keep in mind: for weeks now, there has been no working package for Borg. For those of us who use it for server backups, the current fix is an acceptable (intermediate or permanent) solution.
Comment 25 Matthias Andree freebsd_committer freebsd_triage 2022-08-13 17:04:05 UTC
it would really help to find the root cause for bugs rather than patch around randomly. So considering the current state as an interim workaround that wants the REAL fix.
Comment 26 Thierry Dussuet 2022-08-13 17:20:01 UTC
(In reply to Matthias Andree from comment #23)
xxhash seems to have fixed this bug in December, but they did not release a new version yet. Submitted a patch for devel/xxhash in #265819
Comment 27 Matthias Andree freebsd_committer freebsd_triage 2022-08-13 17:26:56 UTC
So the thing is that static_assert() requires assert.h in C11 (which a simple web search for static_assert will show),
and to add insult to injury, the Python build stuff is botched and does not properly convey CPPFLAGS or CFLAGS to the module builds.
Comment 28 Matthias Andree freebsd_committer freebsd_triage 2022-08-13 17:32:53 UTC
Also pi@ please note that this is a botch without bumping PORTREVISION, but we'll need to do that AFTER 265819 has been committed, and we will need to bump ALL immediate and indirect users of xxhash because the botched Python builders in py-xxhash will not even emit warnings.
Comment 29 commit-hook freebsd_committer freebsd_triage 2022-08-13 18:52:31 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=714af13781970db3ec794eab4627d585b63df00a

commit 714af13781970db3ec794eab4627d585b63df00a
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-08-13 17:20:29 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-08-13 18:51:25 +0000

    archivers/py-borgbackup: use fixed xxhash instead of avoiding it

    This reverts commit 9db903a89b3d1d7c0be2a56059542f3fdb412908 because
    it does not fix the situation for lack of a PORTREVISION bump.
    Let us use the opportunity to fix the real bug instead.

    Now with xxhash fixed as of 0.8.1_2, drop 9db903a89, and
    bump PORTREVISION so we flush out the old garbage packages.

    A simple web search would have brought up that static_assert() is
    a C11 convenience macro defined in <assert.h>, and a detailed
    search would have turned up that this had been fixed in xxhash
    before.

    While here, add a smoke test to post-install.

    Proper fix was
    Reported by:    Thierry Dussuet <thierry.dussuet@protonmail.com>
    PR:             265060
    MFH:            2022Q3

 archivers/py-borgbackup/Makefile                    |  3 ++-
 archivers/py-borgbackup/files/patch-setup.py (gone) | 11 -----------
 2 files changed, 2 insertions(+), 12 deletions(-)
Comment 30 commit-hook freebsd_committer freebsd_triage 2022-08-13 18:55:35 UTC
A commit in branch 2022Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0b4a732cb0ac813fe1c4993e6375715dc1725e96

commit 0b4a732cb0ac813fe1c4993e6375715dc1725e96
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-08-13 17:20:29 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-08-13 18:54:30 +0000

    archivers/py-borgbackup: use fixed xxhash instead of avoiding it

    This reverts commit 9db903a89b3d1d7c0be2a56059542f3fdb412908 because
    it does not fix the situation for lack of a PORTREVISION bump.
    Let us use the opportunity to fix the real bug instead.

    Now with xxhash fixed as of 0.8.1_2, drop 9db903a89, and
    bump PORTREVISION so we flush out the old garbage packages.

    A simple web search would have brought up that static_assert() is
    a C11 convenience macro defined in <assert.h>, and a detailed
    search would have turned up that this had been fixed in xxhash
    before.

    While here, add a smoke test to post-install.

    Proper fix was
    Reported by:    Thierry Dussuet <thierry.dussuet@protonmail.com>
    PR:             265060
    MFH:            2022Q3

    (cherry picked from commit 714af13781970db3ec794eab4627d585b63df00a)

 archivers/py-borgbackup/Makefile                    |  3 ++-
 archivers/py-borgbackup/files/patch-setup.py (gone) | 11 -----------
 2 files changed, 2 insertions(+), 12 deletions(-)
Comment 31 Matthias Andree freebsd_committer freebsd_triage 2022-08-13 18:57:35 UTC
(In reply to Thierry Dussuet from comment #26)
Merci beaucoup, thank you very much, for this research and your patch.
Comment 32 Matthias Andree freebsd_committer freebsd_triage 2022-08-13 19:00:38 UTC
Ooops, some of the py-borgbackup/Makefile lines slipped into the bump-all-PORTREVISION-lines commit. Sorry for that.
Comment 33 Matthias Andree freebsd_committer freebsd_triage 2022-08-13 22:00:39 UTC
*** Bug 265346 has been marked as a duplicate of this bug. ***
Comment 34 commit-hook freebsd_committer freebsd_triage 2022-08-14 11:34:13 UTC
A commit in branch 2022Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5521ed80c2b20ef53fa15df7109af569d1c9fdf5

commit 5521ed80c2b20ef53fa15df7109af569d1c9fdf5
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-08-14 11:32:03 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-08-14 11:32:03 +0000

    archivers/py-borgbackup: fix up incomplete 0b4a732cb0ac

    which was incomplete because accidentally the parts I am committing
    here had slipped into the main branch's "version bump" commit,
    which had to be re-created for 2022Q3.

    Make up for the lost bits.

    PR:             265060

 archivers/py-borgbackup/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)