[Debichem-devel] Bug#1139276: osra: fails to build with openbabel >= 3.2.0
Sebastien Bacher
seb128 at ubuntu.com
Thu Dec 3 16:36:58 GMT 2026
Source: osra
Version: 2.2.4-1
Followup-For: Bug #1139276
X-Debbugs-Cc: seb128 at ubuntu.com
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu tenacious ubuntu-patch
Control: tags -1 patch ftbfs
Hi,
The attached patch fixes the build of osra 2.2.4-1 with OpenBabel 3.2.x. It
needs two changes, only the first of which is in the original report:
1. src/osra_openbabel.cpp: FOR_ATOMS_OF_MOL now iterates over OBAtom
pointers, so "OBMolAtomIter a,b; ... b = ai;" no longer compiles:
osra_openbabel.cpp:406:62: error: no match for 'operator=' (operand types
are 'OpenBabel::OBMolAtomIter' and 'OpenBabel::OBAtom*')
The new patch debian/patches/openbabel-3.2.patch keeps plain OBAtom
pointers (a = &*ai) and makes SetTetrahedtalUnknown() take an OBAtom *.
"&*ai" also works with the old iterator, so it should build with 3.1 too.
2. debian/patches/openbabel.patch replaces std::shared_ptr by obsharedptr in
src/osra_reaction.cpp. obsharedptr only exists in OpenBabel 3.1, it is
gone in 3.2 (no match in the 3.2.1 headers), and the build stops there
once the first error is fixed:
osra_reaction.cpp:63:11: error: 'obsharedptr' was not declared in this scope
The upstream source already uses std::shared_ptr, so the attached patch
just drops openbabel.patch from the series.
The patch (against the debian/patches directory of 2.2.4-1) adds the new
patch file, removes openbabel.patch and updates debian/patches/series.
Testing: a PPA build of osra 2.2.4-1ubuntu1~ppa2 on Ubuntu succeeded on
amd64, amd64v3, arm64, armhf, ppc64el and s390x, against libopenbabel-dev
3.2.0+dfsg-2. I have not built it against 3.2.1+dfsg-1 yet, nor on riscv64,
and I have not run the osra tests or checked the results on a wavy bond
molecule, which is the code path the first change touches.
We are carrying it in Ubuntu as osra 2.2.4-1ubuntu1 so openbabel can migrate.
As upstream told you they have no plans to move to 3.2, this will likely stay
in Debian as a patch too. I have not forwarded it upstream.
Cheers,
Sebastien
-- System Information:
Debian Release: forky/sid
APT prefers resolute-updates
APT policy: (500, 'resolute-updates'), (500, 'resolute-security'), (500, 'resolute'), (100, 'resolute-backports')
Architecture: amd64 (x86_64)
Kernel: Linux 7.0.0-44-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru a/debian/patches/openbabel-3.2.patch b/debian/patches/openbabel-3.2.patch
--- a/debian/patches/openbabel-3.2.patch
+++ b/debian/patches/openbabel-3.2.patch
@@ -0,0 +1,33 @@
+Description: Fix the build with OpenBabel 3.2
+ In OpenBabel 3.2 FOR_ATOMS_OF_MOL iterates over OBAtom pointers and
+ OBMolAtomIter can no longer be assigned from them. Keep plain OBAtom
+ pointers instead, "&*ai" works with both the old iterator and the new pointer.
+Author: Sebastien Bacher <sebastien.bacher at canonical.com>
+Forwarded: no
+Last-Update: 2026-12-02
+
+--- a/src/osra_openbabel.cpp
++++ b/src/osra_openbabel.cpp
+@@ -273,7 +273,7 @@
+ return (r);
+ }
+
+-void SetTetrahedtalUnknown(OBMolAtomIter atom)
++void SetTetrahedtalUnknown(OBAtom *atom)
+ {
+ OBStereoFacade facade(atom->GetParent());
+ OBTetrahedralStereo *stereo;
+@@ -401,10 +401,10 @@
+ if (bond[i].wedge && bond[i].hash) // wavy bonds
+ {
+ mol.AddBond(atom[bond[i].a].n, atom[bond[i].b].n, bond[i].type, OB_WEDGE_OR_HASH_BOND);
+- OBMolAtomIter a,b;
++ OBAtom *a = NULL, *b = NULL;
+ FOR_ATOMS_OF_MOL(ai, mol)
+- if (ai->GetIdx() == atom[bond[i].b].n) b = ai;
+- else if (ai->GetIdx() == atom[bond[i].a].n) a = ai;
++ if (ai->GetIdx() == atom[bond[i].b].n) b = &*ai;
++ else if (ai->GetIdx() == atom[bond[i].a].n) a = &*ai;
+ SetTetrahedtalUnknown(a);
+ SetTetrahedtalUnknown(b);
+ }
diff -Nru a/debian/patches/openbabel.patch b/debian/patches/openbabel.patch
--- a/debian/patches/openbabel.patch
+++ b/debian/patches/openbabel.patch
@@ -1,18 +0,0 @@
---- a/src/osra_reaction.cpp
-+++ b/src/osra_reaction.cpp
-@@ -60,13 +60,13 @@
- OBReaction react;
- for (int j=0; j<reactants.size(); j++)
- {
-- std::shared_ptr<OBMol> reactant(new OBMol);
-+ obsharedptr<OBMol> reactant(new OBMol);
- conv.ReadString(reactant.get(), page_of_structures[reactants[j]]);
- react.AddReactant(reactant);
- }
- for (int j=0; j<products.size(); j++)
- {
-- std::shared_ptr<OBMol> product(new OBMol);
-+ obsharedptr<OBMol> product(new OBMol);
- conv.ReadString(product.get(), page_of_structures[products[j]]);
- react.AddProduct(product);
- }
diff -Nru a/debian/patches/series b/debian/patches/series
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,2 @@
-openbabel.patch
no-thread.patch
+openbabel-3.2.patch
More information about the Debichem-devel
mailing list