pelzlpj / orpie

Curses-based RPN calculator
GNU General Public License v3.0
70 stars 5 forks source link

fix homebrew install #1

Closed mblakele closed 6 years ago

mblakele commented 8 years ago

I was very glad to find this repo with some recent commits, after I noticed that brew install orpie was broken and http://pessimization.com/software/orpie seemed to be offline. I use orpie almost every day, and it has a dedicated terminal tab open at all times.

You probably already know about the homebrew problems, but if I open this issue maybe it'll save you from some duplicate requests.

This was initial problem after a recent reboot:

$ orpie
dyld: Library not loaded: /usr/local/lib/libgsl.0.dylib
  Referenced from: /usr/local/bin/orpie
  Reason: image not found
Abort trap: 6

I tried this:

$ brew uninstall orpie
Uninstalling /usr/local/Cellar/orpie/1.5.2... (10 files, 3.9M)
$ brew install orpie
[...]
==> Installing orpie from homebrew/boneyard
==> Downloading http://pessimization.com/software/orpie/orpie-1.5.2.tar.gz

curl: (7) Failed to connect to pessimization.com port 80: Operation timed out
Error: Failed to download resource "orpie"
Download failed: http://pessimization.com/software/orpie/orpie-1.5.2.tar.gz

After finding this github repo I tried to patch the download URL:

diff --git a/orpie.rb b/orpie.rb
index ab47dac..93f5c74 100644
--- a/orpie.rb
+++ b/orpie.rb
@@ -1,7 +1,7 @@
 class Orpie < Formula
   desc "RPN calculator for the terminal"
-  homepage "http://pessimization.com/software/orpie/"
-  url "http://pessimization.com/software/orpie/orpie-1.5.2.tar.gz"
+  homepage "https://github.com/pelzlpj/orpie"
+  url "https://github.com/pelzlpj/orpie/releases/download/release-1.5.2/orpie-1.5.2.tar.gz"
   sha256 "de557fc7f608c6cb1f44a965d3ae07fc6baf2b02a0d7994b89d6a0e0d87d3d6d"

   depends_on "gsl"

That got me past the download error, but led to a compile time error:

$ brew install orpie
==> Installing orpie from homebrew/boneyard
==> Downloading https://github.com/pelzlpj/orpie/releases/download/release-1.5.2/orpie-1.5.2.tar.gz
==> Downloading from https://github-cloud.s3.amazonaws.com/releases/67002562/7db2774a-6ef8-11e6-9687-
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/orpie/1.5.2
==> make
Last 15 lines from /Users/mblakele/Library/Logs/Homebrew/orpie/02.make:
^
mlgsl_sf.c:261:1: error: too many arguments to function call, expected 4, have 5
SF4(ellint_D, Double_val, Double_val, Double_val, GSL_MODE_val)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mlgsl_sf.c:96:3: note: expanded from macro 'SF4'
  ML4_res(gsl_sf_##name##_e, conv1, conv2, conv3, conv4)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mlgsl_sf.c:77:62: note: expanded from macro 'ML4_res'
    name(conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), &res); \
    ~~~~                                                     ^~~~
/usr/local/Cellar/gsl/2.2.1/include/gsl/gsl_sf_ellint.h:84:1: note: 'gsl_sf_ellint_D_e' declared here
int gsl_sf_ellint_D_e(double phi, double k, gsl_mode_t mode, gsl_sf_result * result);
^
2 errors generated.
make: *** [gsl/mlgsl_sf.o] Error 2

READ THIS: https://git.io/brew-troubleshooting
orpie was moved to homebrew-boneyard because it has unfixable issues.
Please do not file any issues about this. Sorry!
$ brew info gsl
gsl: stable 2.2.1 (bottled)
Numerical library for C and C++
https://www.gnu.org/software/gsl/
/usr/local/Cellar/gsl/2.2.1 (272 files, 8.6M) *
  Poured from bottle on 2016-09-22 at 12:08:28
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gsl.rb
==> Options
--universal
    Build a universal binary

Any ideas? Maybe the version of gsl is too new?

Thanks!

pigmonkey commented 8 years ago

I'm not a Mac user, but this looks like the GSL 2.x bug that hit us on Linux earlier this year. In the Arch package we use the patch from the Debian package. You could see if applying that patch lets you build the program.

mblakele commented 8 years ago

@pigmonkey this bit?

-INCLUDES = -I ./curses -I ./gsl -I ./units
+INCLUDES = -I ./curses -I /usr/lib/ocaml/gsl/ -I ./units

I don't think that'll help on osx, much as I'd like it to. The homebrew ocaml doesn't install its own gsl.

pigmonkey commented 8 years ago
--- mlgsl_sf.c
+++ mlgsl_sf.c
@@ -258,7 +258,8 @@
 SF3(ellint_F, Double_val, Double_val, GSL_MODE_val)
 SF3(ellint_E, Double_val, Double_val, GSL_MODE_val)
 SF4(ellint_P, Double_val, Double_val, Double_val, GSL_MODE_val)
-SF4(ellint_D, Double_val, Double_val, Double_val, GSL_MODE_val)
+//SF4(ellint_D, Double_val, Double_val, Double_val, GSL_MODE_val)
+SF3(ellint_D, Double_val, Double_val, GSL_MODE_val)
 SF3(ellint_RC, Double_val, Double_val, GSL_MODE_val)
 SF4(ellint_RD, Double_val, Double_val, Double_val, GSL_MODE_val)
 SF4(ellint_RF, Double_val, Double_val, Double_val, GSL_MODE_val)
@@ -452,6 +453,7 @@
 SF2(legendre_Ql, Int_val, Double_val)

 /* Associated Legendre Polynomials and Spherical Harmonics  */
+/*
 SF3(legendre_Plm, Int_val, Int_val, Double_val)
 CAMLprim value
 ml_gsl_sf_legendre_Plm_array(value lmax, value m, value x, value result_array)
@@ -487,6 +489,7 @@
   ret = Val_int(gsl_ret);
   CAMLreturn(ret);
 }
+*/

 /* LOGARITHM and related functions */
 SF1(log, Double_val)
mblakele commented 8 years ago

This might be a better approach:

--- a/orpie.rb
+++ b/orpie.rb
@@ -1,10 +1,10 @@
 class Orpie < Formula
   desc "RPN calculator for the terminal"
-  homepage "http://pessimization.com/software/orpie/"
-  url "http://pessimization.com/software/orpie/orpie-1.5.2.tar.gz"
+  homepage "https://github.com/pelzlpj/orpie"
+  url "https://github.com/pelzlpj/orpie/releases/download/release-1.5.2/orpie-1.5.2.tar.gz"
   sha256 "de557fc7f608c6cb1f44a965d3ae07fc6baf2b02a0d7994b89d6a0e0d87d3d6d"

-  depends_on "gsl"
+  depends_on "homebrew/versions/gsl1"
   depends_on "ocaml"
   depends_on "camlp4" => :build

That seems to get me past the compile error above, but fails with a link error instead:

ocamlopt.opt -c -pp camlp4o -I ./curses -I ./gsl -I ./units -thread main.ml
ocamlopt.opt -pp camlp4o -I ./curses -I ./gsl -I ./units -thread -o orpie.opt curses/curses.cmx curses/ml_curses.o nums.cmxa bigarray.cmxa str.cmxa unix.cmxa threads.cmxa gsl/mlgsl_error.o gsl/mlgsl_blas.o gsl/mlgsl_blas_complex.o gsl/mlgsl_complex.o gsl/mlgsl_blas_float.o gsl/mlgsl_blas_complex_float.o gsl/mlgsl_matrix_complex.o gsl/mlgsl_matrix_double.o gsl/mlgsl_matrix_float.o gsl/mlgsl_matrix_complex_float.o gsl/mlgsl_vector_double.o gsl/mlgsl_vector_float.o gsl/mlgsl_permut.o gsl/mlgsl_linalg.o gsl/mlgsl_linalg_complex.o gsl/mlgsl_fun.o gsl/mlgsl_math.o gsl/mlgsl_sf.o gsl/gsl_error.cmx gsl/gsl_blas.cmx gsl/gsl_complex.cmx gsl/gsl_matrix.cmx gsl/gsl_matrix_complex.cmx gsl/gsl_vector.cmx gsl/gsl_vector_complex.cmx gsl/gsl_vector_flat.cmx gsl/gsl_matrix_flat.cmx gsl/gsl_vector_complex_flat.cmx gsl/gsl_matrix_complex_flat.cmx gsl/gsl_vectmat.cmx gsl/gsl_permut.cmx gsl/gsl_linalg.cmx gsl/gsl_fun.cmx units/units.cmx big_int_str.cmx gsl_assist.cmx install.cmx operations.cmx utility.cmx version.cmx rcfile.cmx rpc_stack.cmx add.cmx sub.cmx mult.cmx div.cmx inv.cmx pow.cmx solvelin.cmx rpc_calc.cmx txtin_parser.cmx txtin_lexer.cmx statefile.cmx interface.cmx interface_draw.cmx interface_main.cmx main.cmx -cclib ' -lcurses -L/usr/local/Cellar/gsl1/1.16/lib -lgsl -lgslcblas -lm'
File "_none_", line 1:
Error: No implementations provided for the following modules:
         Gsl_sf referenced from rpc_calc.cmx
         Gsl_math referenced from rpc_calc.cmx

Using brew install orpie --debug to open a shell, I applied this patch:

--- Makefile.in.orig    2016-09-25 13:11:46.000000000 -0700
+++ Makefile.in 2016-09-25 13:11:53.000000000 -0700
@@ -81,7 +81,7 @@
 GSL_CMO = gsl/gsl_error.cmo gsl/gsl_blas.cmo gsl/gsl_complex.cmo gsl/gsl_matrix.cmo gsl/gsl_matrix_complex.cmo \
        gsl/gsl_vector.cmo gsl/gsl_vector_complex.cmo gsl/gsl_vector_flat.cmo gsl/gsl_matrix_flat.cmo \
        gsl/gsl_vector_complex_flat.cmo gsl/gsl_matrix_complex_flat.cmo gsl/gsl_vectmat.cmo \
-       gsl/gsl_permut.cmo gsl/gsl_linalg.cmo gsl/gsl_fun.cmo
+       gsl/gsl_permut.cmo gsl/gsl_linalg.cmo gsl/gsl_fun.cmo gsl/gsl_math.cmo gsl/gsl_sf.cmo
 GSL_CMX = $(GSL_CMO:.cmo=.cmx)
 GSL_COBJS = gsl/mlgsl_error.o gsl/mlgsl_blas.o gsl/mlgsl_blas_complex.o gsl/mlgsl_complex.o gsl/mlgsl_blas_float.o \
         gsl/mlgsl_blas_complex_float.o gsl/mlgsl_matrix_complex.o gsl/mlgsl_matrix_double.o gsl/mlgsl_matrix_float.o \

Finally ./configure && make && make install. It's a bit crude because homebrew ends up confused about the state or the orpie package, but at least it runs. I'll see if I can do anything to clean it up.

jared-wallace commented 7 years ago

When compiling against Ocaml 4.04 on Fedora Rawhide, I had to add the following to complement the patch mentioned by pigmonkey:

--- gsl/gsl_sf.ml›  2016-11-29 20:45:11.975346785 -0600
+++ gsl/gsl_sf.ml.new›  2016-11-29 20:44:53.898348781 -0600
@@ -1150,8 +1150,8 @@
     = ml_gsl_sf_legendre_Plm_e"

-external  legendre_Plm_array : int -> int -> float -> float array -> unit
-    = "ml_gsl_sf_legendre_Plm_array"                                                                
+(*external  legendre_Plm_array : int -> int -> float -> float array -> unit
+    = "ml_gsl_sf_legendre_Plm_array"*)                                                                 

 external legendre_sphPlm : int -> int -> float -> float
@@ -1161,8 +1161,8 @@                                   
     = "ml_gsl_sf_legendre_sphPlm_e"                                                                 

-external  legendre_sphPlm_array : int -> int -> float -> float array -> unit
-    = "ml_gsl_sf_legendre_sphPlm_array"                                                                   
+(*external  legendre_sphPlm_array : int -> int -> float -> float array -> unit
+    = "ml_gsl_sf_legendre_sphPlm_array"*)                                                                   

 external  legendre_array_size : int -> int -> int•   
pelzlpj commented 6 years ago

Moving forward, the supported workflow for Homebrew will be through OPAM. This should be available somewhere in the next couple of days, tracking progress in https://github.com/pelzlpj/orpie/issues/5 .