ankane / ankane/or-tools-ruby

Fedora images not supported

Open
#73 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
222
Forks
42
Avg merge
20h 35m
Merged PRs (30d)
2

Description

Fedora is not supported by the gem and does not build.

It is not quite as simple as adding the fedora builds form the Github. Fedora zips only ship with 64-bit shared libs. Thus, we need to copy them as well and add the lib64 path to the build path.

Find a suggested Patch below:

Index: ext/or-tools/vendor.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ext/or-tools/vendor.rb b/ext/or-tools/vendor.rb
--- a/ext/or-tools/vendor.rb	(revision 3dede323ead82db9d88c9e7d60f6c8e5d0248620)
+++ b/ext/or-tools/vendor.rb	(date 1741682905323)
@@ -45,6 +45,12 @@
   elsif os == "arch" && !arm
     filename = "or-tools_amd64_archlinux_cpp_v#{version}.tar.gz"
     checksum = "18c1d929e2144e9d9602659ea2fa790bd2a150f72c32c38a97f571839816d132"
+  elsif os == "fedora" && os_version == '40' && !arm
+    filename = "or-tools_amd64_fedora-40_cpp_v#{version}.tar.gz"
+    checksum = "ba595e2a9c86e23f559d1be17984ab4cfe56599bb0decd1f5e5b6c4008464023"
+  elsif os == "fedora" && os_version == '41' && !arm
+    filename = "or-tools_amd64_fedora-41_cpp_v#{version}.tar.gz"
+    checksum = "44e3ea31924ae1893a669c4ccf46b5efaf2d37157c0417a9b8038568e9e7c1fb"
   else
     platform =
       if Gem.win_platform?

@@ -144,6 +151,13 @@
     next if file.include?("libprotoc.")
     FileUtils.mv(File.join(extract_path, file), File.join(path, file))
   end
+
+  # Fedora images onyl provide 64 bit libs
+  FileUtils.mkdir(File.join(path, "lib64"))
+  Dir.glob("lib64/lib*{.dylib,.so,.so.*}", base: extract_path) do |file|
+    next if file.include?("libprotoc.")
+    FileUtils.mv(File.join(extract_path, file), File.join(path, file))
+  end
 end
 
 # export
Index: ext/or-tools/extconf.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ext/or-tools/extconf.rb b/ext/or-tools/extconf.rb
--- a/ext/or-tools/extconf.rb	(revision 3dede323ead82db9d88c9e7d60f6c8e5d0248620)
+++ b/ext/or-tools/extconf.rb	(date 1741683139633)
@@ -15,6 +15,7 @@
 if inc || lib
   inc ||= "/usr/local/include"
   lib ||= "/usr/local/lib"
+  lib64 ||= "/usr/local/lib64"
   rpath = lib
 else
   # download
@@ -22,6 +23,7 @@
 
   inc = "#{$vendor_path}/include"
   lib = "#{$vendor_path}/lib"
+  lib64 = "#{$vendor_path}/lib64"
 
   # make rpath relative
   # use double dollar sign and single quotes to escape properly
@@ -32,7 +34,7 @@
 # find_header and find_library first check without adding path
 # which can cause them to find system library
 $INCFLAGS << " -I#{inc}"
-$LDFLAGS.prepend("-Wl,-rpath,#{rpath} -L#{lib} ")
+$LDFLAGS.prepend("-Wl,-rpath,#{rpath} -L#{lib} -L#{lib64} ")
 raise "OR-Tools not found" unless have_library("ortools")
 
 create_makefile("or_tools/ext")

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read ext/or-tools/vendor.rb and ext/or-tools/extconf.rb, starting with the existing platform-selection and native-library path handling. Verify the suggested Fedora 40 and 41 changes against the available OR-Tools archives, then confirm the gem builds and loads successfully on Fedora with the 64-bit libraries.

Written by the indexing model from the issue text.

Assessment

Tech stack
fedora, ruby
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.