rdkit_chem 2025.09.3.1-x86_64-linux → 2025.09.3.3-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5eab9165bf077e5e2a5bffd72c48a74e673ee40c312722cc5273ec33328d4211
4
- data.tar.gz: 998e526966636d2602121d5eaf77a9e106a39c92d9b66bc74d877e456772bdc5
3
+ metadata.gz: 00e15c3309fabeca7bcd0f98ee596a203618285b6f92c682ce17660d952f6316
4
+ data.tar.gz: 0da5cd203edb2a09dab6a6021fb94131db475714fc7eac3371297682b168c730
5
5
  SHA512:
6
- metadata.gz: 27d47f34dae1d7bd7327788fecc3e699ea94f8832011fde2295811c77bc516dbcafc94e1f46ee4ef378d28edaa0b2a91d6f1717b9bfc85e952862702aa6acae2
7
- data.tar.gz: a1f7496ebf8e4492302d7eec960793d922c9f93302542485b11ba00bb2eb2f41cf3ad87fd976a2b3a9c2af17ac1643af1030c89e64ed4caf7817e21f670d445e
6
+ metadata.gz: e5698093e821f06b69170d648fc4c7710c52d481955bcd77bd37800b83a2d1fbfb392103faa822f927a4656bcc7bc88dd3eedbb3ef7497d90caf05636147f707
7
+ data.tar.gz: cf4b9ff7973438b07f7392c21970ef77b7d51074f2cab626ba89350d927820d56f356baa0caf8510104e280d8d69b9f4e82147846105413eccba075529ef28d1
@@ -45,9 +45,10 @@
45
45
  %newobject RDKit::MolOps::adjustQueryProperties;
46
46
 
47
47
  %ignore RDKit::MolOps::detectChemistryProblems;
48
- // Ignore all native sanitizeMol overloads - we provide a custom wrapper below
49
- %ignore RDKit::MolOps::sanitizeMol;
50
48
  %include <GraphMol/MolOps.h>
49
+ // Ignore only the 3-arg overload that uses reference parameters (incompatible with SWIG)
50
+ // This keeps the 1-arg sanitizeMol(RWMol &) available from the header
51
+ %ignore RDKit::MolOps::sanitizeMol(RWMol &,unsigned int &,unsigned int &);
51
52
  %template(BoolPair) std::pair<bool, bool>;
52
53
 
53
54
  %inline %{
@@ -189,9 +189,12 @@ unsigned int getDefaultPickleProperties();
189
189
  return res;
190
190
  }
191
191
 
192
- /* Used in the addConformer modifications described above */
193
- unsigned int RDKit::ROMol::addConf(RDKit::Conformer * ownedConf, bool assignId=false) {
194
- return self->addConformer(ownedConf, assignId);
192
+ /* Create a copy of the conformer before adding it to the molecule.
193
+ This avoids the double-free issue since Ruby owns the original and C++ owns the copy.
194
+ The original DISOWN approach doesn't work with shared_ptr wrappers. */
195
+ unsigned int RDKit::ROMol::addConf(RDKit::Conformer *conf, bool assignId=false) {
196
+ RDKit::Conformer *confCopy = new RDKit::Conformer(*conf);
197
+ return self->addConformer(confCopy, assignId);
195
198
  }
196
199
 
197
200
  std::string MolToSmiles(bool doIsomericSmiles=true, bool doKekule=false, int rootedAtAtom=-1, bool canonical=true,
data/Rakefile CHANGED
@@ -10,6 +10,12 @@ require 'rdkit_chem/version'
10
10
  VERSION = RDKitChem::GEMVERSION
11
11
  NATIVE_DIR = 'rdkit_chem/lib'
12
12
 
13
+ # System libraries that need to be bundled for portability
14
+ BUNDLED_SYSTEM_LIBS = %w[
15
+ libboost_serialization.so*
16
+ libboost_iostreams.so*
17
+ ].freeze
18
+
13
19
  desc 'Run tests'
14
20
  Rake::TestTask.new(:test) do |t|
15
21
  t.libs << 'lib'
@@ -69,6 +75,40 @@ task :build_native do
69
75
  puts "\nBuilt: rdkit_chem-#{VERSION}-#{Gem::Platform.local}.gem"
70
76
  end
71
77
 
78
+ desc 'Bundle system libraries (Boost) into native directory'
79
+ task :bundle_system_libs do
80
+ so_file = File.join(NATIVE_DIR, 'RDKitChem.so')
81
+ unless File.exist?(so_file)
82
+ abort "ERROR: #{so_file} not found"
83
+ end
84
+
85
+ puts "Finding and bundling system library dependencies..."
86
+
87
+ # Find library paths using ldd
88
+ ldd_output = `ldd #{so_file} 2>/dev/null`
89
+
90
+ BUNDLED_SYSTEM_LIBS.each do |lib_pattern|
91
+ lib_name = lib_pattern.gsub('*', '')
92
+ # Extract actual library path from ldd output
93
+ match = ldd_output.match(/#{Regexp.escape(lib_name)}[^\s]* => ([^\s]+)/)
94
+ if match
95
+ src_path = match[1]
96
+ if File.exist?(src_path)
97
+ dest = File.join(NATIVE_DIR, File.basename(src_path))
98
+ unless File.exist?(dest)
99
+ FileUtils.cp(src_path, dest, verbose: true)
100
+ else
101
+ puts "Already exists: #{dest}"
102
+ end
103
+ end
104
+ else
105
+ puts "WARNING: Could not find #{lib_pattern} in ldd output"
106
+ end
107
+ end
108
+
109
+ puts "Done bundling system libraries."
110
+ end
111
+
72
112
  desc 'Apply RPATH fix to existing native extension (no recompile needed)'
73
113
  task :fix_rpath do
74
114
  so_file = File.join(NATIVE_DIR, 'RDKitChem.so')
Binary file
@@ -1,4 +1,4 @@
1
1
  module RDKitChem
2
- VERSION = '2025.09.3'.freeze
3
- GEMVERSION = VERSION + '.1'
2
+ VERSION = "2025.09.3".freeze
3
+ GEMVERSION = VERSION + ".3"
4
4
  end
@@ -44,4 +44,41 @@ class RDKitTest < Test::Unit::TestCase
44
44
  assert_not_nil(rw_mol)
45
45
  assert_equal(28, rw_mol.get_num_atoms) # C27H46O has 28 heavy atoms (27 C + 1 O)
46
46
  end
47
+
48
+ def test_conformer_ownership
49
+ # Test that conformer ownership is properly transferred to the molecule.
50
+ # This verifies the DISOWN directive works - without it, Ruby GC and C++
51
+ # destructor both try to free the Conformer, causing a double-free segfault.
52
+ smiles = 'CCO' # ethanol
53
+ rw_mol = RDKitChem::RWMol.mol_from_smiles(smiles)
54
+
55
+ # Create a conformer with 3D coordinates
56
+ conf = RDKitChem::Conformer.new(rw_mol.get_num_atoms)
57
+ conf.set_atom_pos(0, RDKitChem::Point3D.new(0.0, 0.0, 0.0))
58
+ conf.set_atom_pos(1, RDKitChem::Point3D.new(1.5, 0.0, 0.0))
59
+ conf.set_atom_pos(2, RDKitChem::Point3D.new(2.0, 1.0, 0.0))
60
+
61
+ # Add conformer to molecule (ownership transfers to C++)
62
+ conf_id = rw_mol.addConf(conf, true)
63
+ assert(conf_id >= 0, "Conformer should be added successfully")
64
+
65
+ # Verify conformer was added
66
+ assert_equal(1, rw_mol.get_num_conformers)
67
+
68
+ # Access the conformer through the molecule
69
+ retrieved_conf = rw_mol.get_conformer(conf_id)
70
+ assert_not_nil(retrieved_conf)
71
+
72
+ # Verify coordinates
73
+ pos = retrieved_conf.get_atom_pos(0)
74
+ assert_in_delta(0.0, pos.x, 0.001)
75
+ assert_in_delta(0.0, pos.y, 0.001)
76
+ assert_in_delta(0.0, pos.z, 0.001)
77
+
78
+ # Force garbage collection to ensure no double-free occurs
79
+ GC.start
80
+
81
+ # The molecule should still be valid after GC
82
+ assert_equal(3, rw_mol.get_num_atoms)
83
+ end
47
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdkit_chem
3
3
  version: !ruby/object:Gem::Version
4
- version: 2025.09.3.1
4
+ version: 2025.09.3.3
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - An Nguyen
@@ -337,6 +337,8 @@ files:
337
337
  - lib/rdkit_chem/3.3.0/libRDKitpubchem_align3d.so
338
338
  - lib/rdkit_chem/3.3.0/libRDKitpubchem_align3d.so.1
339
339
  - lib/rdkit_chem/3.3.0/libRDKitpubchem_align3d.so.1.2026.03.1pre
340
+ - lib/rdkit_chem/3.3.0/libboost_iostreams.so.1.83.0
341
+ - lib/rdkit_chem/3.3.0/libboost_serialization.so.1.83.0
340
342
  - lib/rdkit_chem/version.rb
341
343
  - test/test_rdkit_chem.rb
342
344
  homepage: https://github.com/CamAnNguyen/rdkit-chem