Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish a new release to rubygems #67

Open
ruipserra opened this issue Mar 1, 2022 · 7 comments
Open

Publish a new release to rubygems #67

ruipserra opened this issue Mar 1, 2022 · 7 comments

Comments

@ruipserra
Copy link

#66 was merged a few months ago adding Ruby 3 compatibility, but it's not available in rubygems.
Can you publish a new release? Thanks!

@obromios
Copy link

obromios commented Mar 3, 2022

In the meantime, you can get commit with the #66 merge by inserting into your Gemfile
gem 'gsl', git: '[email protected]:SciRuby/rb-gsl.git', ref: '103a3e1'

Note that the gem name to use is gsl not rb-gsl. Can anyone tell me why on rubygems.org there are two gems gsl and rb-gsl but both point to the source code at [email protected]:SciRuby/rb-gsl.git'?

I tried the updated code with ruby 3.1.1 and it appears to work on this ruby version as well.

@xanadiu
Copy link

xanadiu commented Mar 31, 2022

I am wondering how to "push" a new rubygems version. For anybody struggling with the lack of GitHub credentials, including the https url in my Gemfile worked for me:

gem 'gsl', git: 'https://github.com/SciRuby/rb-gsl.git', ref: '103a3e1'

mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue May 28, 2022
**Background:**
The slow step of LSI is the SVD (singular value decomposition) of a
matrix. With even a relatively small collection of documents (say, about
20 blog posts), the native ruby implementation it too slow to be usable.

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. This performs at least an order of magnitude faster than
the ruby-only matrix decomposition, and is fast enough that using LSI
with Jekyll finishes in a reasonable amount of time.

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- luckily, there's a commit on main that makes it
compatible with Ruby 3, but nobody has released the gem so the only way
to use rb-gsl with Ruby 3 right now is to specify the git hash in your
Gemfile. See SciRuby/rb-gsl#67

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform the singular value decomposition quickly and works with
Ruby 3. Doing so will allow classifier-reborn to be used with Ruby 3
without depending on the unmaintained/unreleased GSL gem. Options for
ruby matrix libraries are somewhat limited, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn the same
way they would use it with GSL. That is, the user should install
`numo-narray` and `numo-linalg` gems, and classifier-reborn will detect
and use these if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue May 28, 2022
**Background:**
The slow step of LSI is the SVD (singular value decomposition) of a
matrix. With even a relatively small collection of documents (say, about
20 blog posts), the native ruby implementation it too slow to be usable.

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. This performs at least an order of magnitude faster than
the ruby-only matrix decomposition, and is fast enough that using LSI
with Jekyll finishes in a reasonable amount of time.

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- luckily, there's a commit on main that makes it
compatible with Ruby 3, but nobody has released the gem so the only way
to use rb-gsl with Ruby 3 right now is to specify the git hash in your
Gemfile. See SciRuby/rb-gsl#67

Notably, `rb-gsl` depends on
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray).
`narray` is deprecated, and the readme suggests using `Numo::NArray`
instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform the singular value decomposition quickly and works with
Ruby 3. Doing so will allow classifier-reborn to be used with Ruby 3
without depending on the unmaintained/unreleased GSL gem. Options for
ruby matrix libraries are somewhat limited, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn the same
way they would use it with GSL. That is, the user should install
`numo-narray` and `numo-linalg` gems, and classifier-reborn will detect
and use these if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue May 29, 2022
**Background:**
The slow step of LSI is the SVD (singular value decomposition) of a
matrix. With even a relatively small collection of documents (say, about
20 blog posts), the native ruby implementation it too slow to be usable.

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. This performs at least an order of magnitude faster than
the ruby-only matrix decomposition, and is fast enough that using LSI
with Jekyll finishes in a reasonable amount of time.

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- luckily, there's a commit on main that makes it
compatible with Ruby 3, but nobody has released the gem so the only way
to use rb-gsl with Ruby 3 right now is to specify the git hash in your
Gemfile. See SciRuby/rb-gsl#67

Notably, `rb-gsl` depends on
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray).
`narray` is deprecated, and the readme suggests using `Numo::NArray`
instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform the singular value decomposition quickly and works with
Ruby 3. Doing so will allow classifier-reborn to be used with Ruby 3
without depending on the unmaintained/unreleased GSL gem. Options for
ruby matrix libraries are somewhat limited, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn the same
way they would use it with GSL. That is, the user should install
`numo-narray` and `numo-linalg` gems, and classifier-reborn will detect
and use these if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue May 29, 2022
**Background:**
The slow step of LSI is the SVD (singular value decomposition) of a
matrix. With even a relatively small collection of documents (say, about
20 blog posts), the native ruby implementation it too slow to be usable.

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. This performs at least an order of magnitude faster than
the ruby-only matrix decomposition, and is fast enough that using LSI
with Jekyll finishes in a reasonable amount of time.

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- luckily, there's a commit on main that makes it
compatible with Ruby 3, but nobody has released the gem so the only way
to use rb-gsl with Ruby 3 right now is to specify the git hash in your
Gemfile. See SciRuby/rb-gsl#67

Notably, `rb-gsl` depends on
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray).
`narray` is deprecated, and the readme suggests using `Numo::NArray`
instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform the singular value decomposition quickly and works with
Ruby 3. Doing so will allow classifier-reborn to be used with Ruby 3
without depending on the unmaintained/unreleased GSL gem. Options for
ruby matrix libraries are somewhat limited, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn the same
way they would use it with GSL. That is, the user should install
`numo-narray` and `numo-linalg` gems, and classifier-reborn will detect
and use these if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue May 29, 2022
**Background:**
The slow step of LSI is the SVD (singular value decomposition) of a
matrix. With even a relatively small collection of documents (say, about
20 blog posts), the native ruby implementation it too slow to be usable.

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. This performs at least an order of magnitude faster than
the ruby-only matrix decomposition, and is fast enough that using LSI
with Jekyll finishes in a reasonable amount of time.

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- luckily, there's a commit on main that makes it
compatible with Ruby 3, but nobody has released the gem so the only way
to use rb-gsl with Ruby 3 right now is to specify the git hash in your
Gemfile. See SciRuby/rb-gsl#67

Notably, `rb-gsl` depends on
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray).
`narray` is deprecated, and the readme suggests using `Numo::NArray`
instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform the singular value decomposition quickly and works with
Ruby 3. Doing so will allow classifier-reborn to be used with Ruby 3
without depending on the unmaintained/unreleased GSL gem. Options for
ruby matrix libraries are somewhat limited, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn the same
way they would use it with GSL. That is, the user should install
`numo-narray` and `numo-linalg` gems, and classifier-reborn will detect
and use these if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue May 31, 2022
**Background:**
The slow step of LSI is computing the SVD (singular value decomposition)
of a matrix. Even with a relatively small collection of documents (say,
about 20 blog posts), the native ruby implementation is too slow to be
usable (taking hours to complete).

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. Computations with this gem perform orders of magnitude
faster than the ruby-only matrix implementation, and they're fast enough
that using LSI with Jekyll finishes in a reasonable amount of time
(seconds).

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- luckily, there's a commit on main that makes it
compatible with Ruby 3, but nobody has released the gem so the only way
to use rb-gsl with Ruby 3 right now is to specify the git hash in your
Gemfile. See SciRuby/rb-gsl#67

Notably, `rb-gsl` depends on
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray).
`narray` is deprecated, and the readme suggests using `Numo::NArray`
instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform singular value decomposition quickly and works with
Ruby 3. Doing so will allow classifier-reborn to be used with Ruby 3
without depending on the unmaintained/unreleased GSL gem. Options for
ruby matrix libraries are somewhat limited, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn with
Numo/Lapack the same way they'd use it with GSL. That is, the user
should install the `numo-narray` and `numo-linalg` gems (with their
required C libraries), and classifier-reborn will detect and use these
if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue Jun 2, 2022
**Background:**
The slow step of LSI is computing the SVD (singular value decomposition)
of a matrix. Even with a relatively small collection of documents (say,
about 20 blog posts), the native ruby implementation is too slow to be
usable (taking hours to complete).

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. Computations with this gem perform orders of magnitude
faster than the ruby-only matrix implementation, and they're fast enough
that using LSI with Jekyll finishes in a reasonable amount of time
(seconds).

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- there's a commit on main that makes it compatible with
Ruby 3, but nobody has released the gem so the only way to use rb-gsl
with Ruby 3 right now is to specify the git hash in your Gemfile. See
SciRuby/rb-gsl#67. This will be increasingly
problematic because Ruby 2.7 is now in [security
maintenance](https://www.ruby-lang.org/en/news/2022/04/12/ruby-2-7-6-released/)
and will become end of life in less than a year.

Notably, `rb-gsl` depends on the
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray)
gem. `narray` is deprecated, and the readme suggests using
`Numo::NArray` instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform singular value decomposition quickly and works with
Ruby 3. Doing so will make classifier-reborn compatible with Ruby 3
without depending on the unmaintained/unreleased gsl gem. There aren't
many gems that provide fast matrix support for ruby, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition, which is exactly what
we need. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn with
Numo/Lapack the same way they'd use it with GSL. That is, the user
should install the `numo-narray` and `numo-linalg` gems (with their
required C libraries), and classifier-reborn will detect and use these
if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue Jun 2, 2022
**Background:**
The slow step of LSI is computing the SVD (singular value decomposition)
of a matrix. Even with a relatively small collection of documents (say,
about 20 blog posts), the native ruby implementation is too slow to be
usable (taking hours to complete).

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. Computations with this gem perform orders of magnitude
faster than the ruby-only matrix implementation, and they're fast enough
that using LSI with Jekyll finishes in a reasonable amount of time
(seconds).

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- there's a commit on main that makes it compatible with
Ruby 3, but nobody has released the gem so the only way to use rb-gsl
with Ruby 3 right now is to specify the git hash in your Gemfile. See
SciRuby/rb-gsl#67. This will be increasingly
problematic because Ruby 2.7 is now in [security
maintenance](https://www.ruby-lang.org/en/news/2022/04/12/ruby-2-7-6-released/)
and will become end of life in less than a year.

Notably, `rb-gsl` depends on the
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray)
gem. `narray` is deprecated, and the readme suggests using
`Numo::NArray` instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform singular value decomposition quickly and works with
Ruby 3. Doing so will make classifier-reborn compatible with Ruby 3
without depending on the unmaintained/unreleased gsl gem. There aren't
many gems that provide fast matrix support for ruby, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition, which is exactly what
we need. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn with
Numo/Lapack the same way they'd use it with GSL. That is, the user
should install the `numo-narray` and `numo-linalg` gems (with their
required C libraries), and classifier-reborn will detect and use these
if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue Jun 2, 2022
**Background:**
The slow step of LSI is computing the SVD (singular value decomposition)
of a matrix. Even with a relatively small collection of documents (say,
about 20 blog posts), the native ruby implementation is too slow to be
usable (taking hours to complete).

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. Computations with this gem perform orders of magnitude
faster than the ruby-only matrix implementation, and they're fast enough
that using LSI with Jekyll finishes in a reasonable amount of time
(seconds).

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- there's a commit on main that makes it compatible with
Ruby 3, but nobody has released the gem so the only way to use rb-gsl
with Ruby 3 right now is to specify the git hash in your Gemfile. See
SciRuby/rb-gsl#67. This will be increasingly
problematic because Ruby 2.7 is now in [security
maintenance](https://www.ruby-lang.org/en/news/2022/04/12/ruby-2-7-6-released/)
and will become end of life in less than a year.

Notably, `rb-gsl` depends on the
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray)
gem. `narray` is deprecated, and the readme suggests using
`Numo::NArray` instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform singular value decomposition quickly and works with
Ruby 3. Doing so will make classifier-reborn compatible with Ruby 3
without depending on the unmaintained/unreleased gsl gem. There aren't
many gems that provide fast matrix support for ruby, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition, which is exactly what
we need. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn with
Numo/Lapack the same way they'd use it with GSL. That is, the user
should install the `numo-narray` and `numo-linalg` gems (with their
required C libraries), and classifier-reborn will detect and use these
if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue Jun 4, 2022
**Background:**
The slow step of LSI is computing the SVD (singular value decomposition)
of a matrix. Even with a relatively small collection of documents (say,
about 20 blog posts), the native ruby implementation is too slow to be
usable (taking hours to complete).

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. Computations with this gem perform orders of magnitude
faster than the ruby-only matrix implementation, and they're fast enough
that using LSI with Jekyll finishes in a reasonable amount of time
(seconds).

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- there's a commit on main that makes it compatible with
Ruby 3, but nobody has released the gem so the only way to use rb-gsl
with Ruby 3 right now is to specify the git hash in your Gemfile. See
SciRuby/rb-gsl#67. This will be increasingly
problematic because Ruby 2.7 is now in [security
maintenance](https://www.ruby-lang.org/en/news/2022/04/12/ruby-2-7-6-released/)
and will become end of life in less than a year.

Notably, `rb-gsl` depends on the
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray)
gem. `narray` is deprecated, and the readme suggests using
`Numo::NArray` instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform singular value decomposition quickly and works with
Ruby 3. Doing so will make classifier-reborn compatible with Ruby 3
without depending on the unmaintained/unreleased gsl gem. There aren't
many gems that provide fast matrix support for ruby, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition, which is exactly what
we need. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn with
Numo/Lapack the same way they'd use it with GSL. That is, the user
should install the `numo-narray` and `numo-linalg` gems (with their
required C libraries), and classifier-reborn will detect and use these
if they are found.
mkasberg added a commit to mkasberg/classifier-reborn that referenced this issue Jun 4, 2022
**Background:**
The slow step of LSI is computing the SVD (singular value decomposition)
of a matrix. Even with a relatively small collection of documents (say,
about 20 blog posts), the native ruby implementation is too slow to be
usable (taking hours to complete).

To work around this problem, classifier-reborn allows you to optionally
use the `gsl` gem to make use of the [Gnu Scientific
Library](https://www.gnu.org/software/gsl/) when performing matrix
calculations. Computations with this gem perform orders of magnitude
faster than the ruby-only matrix implementation, and they're fast enough
that using LSI with Jekyll finishes in a reasonable amount of time
(seconds).

Unfortunately, [rb-gsl](https://github.com/SciRuby/rb-gsl) is
unmaintained -- there's a commit on main that makes it compatible with
Ruby 3, but nobody has released the gem so the only way to use rb-gsl
with Ruby 3 right now is to specify the git hash in your Gemfile. See
SciRuby/rb-gsl#67. This will be increasingly
problematic because Ruby 2.7 is now in [security
maintenance](https://www.ruby-lang.org/en/news/2022/04/12/ruby-2-7-6-released/)
and will become end of life in less than a year.

Notably, `rb-gsl` depends on the
[narray](https://github.com/masa16/narray#new-version-is-under-development---rubynumonarray)
gem. `narray` is deprecated, and the readme suggests using
`Numo::NArray` instead.

**Changes:**
In this PR, my goal is to provide an alternative matrix implementation
that can perform singular value decomposition quickly and works with
Ruby 3. Doing so will make classifier-reborn compatible with Ruby 3
without depending on the unmaintained/unreleased gsl gem. There aren't
many gems that provide fast matrix support for ruby, but
[Numo](https://github.com/ruby-numo) seems to be more actively
maintained than rb-gsl, and Numo has a working Ruby 3 implementation
that can perform a singular value decomposition, which is exactly what
we need. This requires
[numo-narray](https://github.com/ruby-numo/numo-narray) and
[numo-linalg](https://github.com/ruby-numo/numo-linalg).

My goal is to allow users to (optionally) use classifier-reborn with
Numo/Lapack the same way they'd use it with GSL. That is, the user
should install the `numo-narray` and `numo-linalg` gems (with their
required C libraries), and classifier-reborn will detect and use these
if they are found.
@simon-dedeo
Copy link

For those who are still not using bundler, gemfiles, etc, here's how to install this version globally:

git clone [email protected]:SciRuby/rb-gsl.git
cd rb-gsl
git checkout 103a3e1
gem build *.gemspec
sudo gem install ./gsl-2.1.0.3.gem

This pulls the git repository, goes to katafract's fixed version (thank you!), builds the gem locally, and then installs. This works on Mac OS X 14.2 (Sonoma).

@dgdosen
Copy link

dgdosen commented Apr 30, 2024

This approach was working for me running on macos Sonoma - but some update (Xcode? gcc? bundler?) has caused this this gem to stop working, and I can't reinstall it:

blas2.c:1084:3: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned
long)') to parameter of type 'VALUE (*)(VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
  rb_define_module_function(module, "dsyr2!", rb_gsl_blas_dsyr2, 4);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:338:142: note: expanded from macro 'rb_define_module_function'
#define rb_define_module_function(mod, mid, func, arity)    RBIMPL_ANYARGS_DISPATCH_rb_define_module_function((arity), (func))((mod), (mid), (func), (arity))
                                                                                                                                             ^~~~~~
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:274:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *)
^
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:259:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _04(__VA_ARGS__, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE), int); \
                                                                       ^
blas2.c:1085:3: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned
long)') to parameter of type 'VALUE (*)(VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
  rb_define_module_function(module, "dsyr2", rb_gsl_blas_dsyr2_a, 4);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:338:142: note: expanded from macro 'rb_define_module_function'
#define rb_define_module_function(mod, mid, func, arity)    RBIMPL_ANYARGS_DISPATCH_rb_define_module_function((arity), (func))((mod), (mid), (func), (arity))
                                                                                                                                             ^~~~~~
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:274:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *)
^
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:259:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _04(__VA_ARGS__, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE), int); \
                                                                       ^
blas2.c:1086:3: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned
long)') to parameter of type 'VALUE (*)(VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
  rb_define_module_function(module, "zher2!", rb_gsl_blas_zher2, 4);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:338:142: note: expanded from macro 'rb_define_module_function'
#define rb_define_module_function(mod, mid, func, arity)    RBIMPL_ANYARGS_DISPATCH_rb_define_module_function((arity), (func))((mod), (mid), (func), (arity))
                                                                                                                                             ^~~~~~
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:274:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *)
^
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:259:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _04(__VA_ARGS__, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE), int); \
                                                                       ^
blas2.c:1087:3: error: incompatible function pointer types passing 'VALUE (VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned
long)') to parameter of type 'VALUE (*)(VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
  rb_define_module_function(module, "zher2", rb_gsl_blas_zher2_a, 4);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:338:142: note: expanded from macro 'rb_define_module_function'
#define rb_define_module_function(mod, mid, func, arity)    RBIMPL_ANYARGS_DISPATCH_rb_define_module_function((arity), (func))((mod), (mid), (func), (arity))
                                                                                                                                             ^~~~~~
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:274:1: note: passing argument to parameter here
RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *)
^
/opt/homebrew/var/rbenv/versions/3.2.2/include/ruby-3.2.0/ruby/internal/anyargs.h:259:72: note: expanded from macro 'RBIMPL_ANYARGS_DECL'
RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _04(__VA_ARGS__, VALUE(*)(VALUE, VALUE, VALUE, VALUE, VALUE), int); \
                                                                       ^
2 warnings and 4 errors generated.
make: *** [blas2.o] Error 1

make failed, exit code 2

Gem files will remain installed in /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/bundler/gems/rb-gsl-103a3e1941e2 for inspection.
Results logged to /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/bundler/gems/extensions/arm64-darwin-23/3.2.0/rb-gsl-103a3e1941e2/gem_make.out

  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/ext/builder.rb:119:in `run'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/ext/builder.rb:51:in `block in make'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/ext/builder.rb:43:in `each'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/ext/builder.rb:43:in `make'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/ext/ext_conf_builder.rb:41:in `build'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/ext/builder.rb:187:in `build_extension'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/ext/builder.rb:221:in `block in build_extensions'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in `each'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/ext/builder.rb:218:in `build_extensions'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/installer.rb:843:in `build_extensions'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/source/path/installer.rb:28:in `post_install'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/source/path.rb:244:in `generate_bin'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/source/git.rb:202:in `install'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/installer/gem_installer.rb:54:in `install'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/installer/parallel_installer.rb:156:in `do_install'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/installer/parallel_installer.rb:147:in `block in worker_pool'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/worker.rb:62:in `apply_func'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/worker.rb:57:in `block in process_queue'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/worker.rb:54:in `loop'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/worker.rb:54:in `process_queue'
  /opt/homebrew/var/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.16/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing gsl (2.1.0.3), and Bundler cannot continue.

In Gemfile:
  gsl

Anybody else have a similar issue?

@0xdevalias
Copy link

0xdevalias commented Jun 20, 2024

This approach was working for me running on macos Sonoma - but some update (Xcode? gcc? bundler?) has caused this this gem to stop working, and I can't reinstall it

I'm also running onto this issue on macOS Sonoma 14.4.1 (23E224); but in my case, I was just trying to use the existing published version of gsl 2.1.0.3 on a ruby 2.7.1 install.

Initially I had just done a brew install gsl, which gave me version 2.8; but looking closer at the notes in my Gemfile it said to try brew install [email protected]:

# ..snip..

# LSI (related posts)
# Note: You need to install one of nmatrix or narray first, and export NMATRIX=1 or NARRAY=1 before running bundle install
# otherwise gsl won't use them. Note that you can only use one or the other, not both.
#   see https://github.com/SciRuby/rb-gsl#nmatrix-and-narray-usage
#
# Both of these seem to be extremely outdated, see:
#   https://github.com/0xdevalias/devalias.net/issues/83
#   https://github.com/jekyll/classifier-reborn/issues/192
#   https://github.com/SciRuby/rb-gsl/issues/63
gem 'nmatrix'
gem 'gsl' # Note: you need to install a compatible version (eg. 2.1) of gsl first: brew install [email protected]
gem 'classifier-reborn'

# ..snip..

Which unfortunately no longer works:

⇒ brew install [email protected]
Warning: No available formula with the name "[email protected]".
==> Searching for similarly named formulae and casks...
Error: No formulae or casks found for [email protected].

Digging a little deeper, I found these issues:

It seems it's only compatible with gsl 2.1 as well:

I wonder, does using gsl version 2.1 work for you?

There are some instructions for building gsl on macOS without homebrew here:

  • https://gist.github.com/TysonRayJones/af7bedcdb8dc59868c7966232b4da903#osx
    • though installing it manually is just as simple, which we now describe.

      Download gsl-latest.tar.gz from the GSL ftp site and unzip it anywhere (e.g. /Downloads)
      Open the unzipped gsl folder in Terminal (e.g. cd ~/Downloads/gsl-2.4
      Run sudo ./configure && make && make install

      If the above gives a "permission denied" error, instead try

      sudo make clean
      sudo chown -R $USER .
      ./configure && make
      make install
      

We can see the latest version of the homebrew formula here:

And it's history here:

Though the first 2.x version listed there seems to be 2.2, so I guess we can't just copy the old brew build version:

Since the only thing that changed from the 1.x build was the source download link though.. maybe we could do it fairly easily.. with something like this:

class GslAT21 < Formula
  desc "Numerical library for C and C++"
  homepage "https://www.gnu.org/software/gsl/"
  url "https://ftp.gnu.org/gnu/gsl/gsl-2.1.tar.gz"
  mirror "https://ftpmirror.gnu.org/gsl/gsl-2.1.tar.gz"
  sha256 "59ad06837397617f698975c494fe7b2b698739a59e2fcf830b776428938a0c66"
  license "GPL-3.0-or-later"

  def install
    ENV.deparallelize
    system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
    system "make" # A GNU tool which doesn't support just make install! Shameful!
    system "make", "install"
  end

  test do
    system bin/"gsl-randist", "0", "20", "cauchy", "30"
  end
end

Saved in:

Then we could install it like this:

⇒ HOMEBREW_NO_INSTALL_FROM_API=1 brew info [email protected]
==> [email protected]: stable 2.1
Numerical library for C and C++
https://www.gnu.org/software/gsl/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/g/[email protected]
License: GPL-3.0-or-later

⇒ HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]
==> Fetching [email protected]
==> Downloading https://ftp.gnu.org/gnu/gsl/gsl-2.1.tar.gz
############################################################################################################################################ 100.0%
==> ./configure
==> make
==> make install
🍺  /usr/local/Cellar/[email protected]/2.1: 257 files, 8.1MB, built in 4 minutes 48 seconds
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

⇒ gsl-config --version
2.1

After which we could go back and see if rb-gsl can install now... but alas it cannot, and still gets the same errors from before.


Exploring this issue more:

⇒ clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

In the clang 15 docs it doesn't say it can be disabled:

But in clang 16 it does:

ChatGPT claims I should be able to pass that through like this:

CFLAGS="-Wno-incompatible-function-pointer-types" gem install gsl -v '2.1.0.3' --source 'https://rubygems.org/'

But when I tried I still got the same errors.

Not sure if that is because I'm passing it through wrong, the 'opt out' flag doesn't exist on clang 15, or if it just won't work as a solution at all.

Originally posted by @0xdevalias in #68 (comment)

@BenTalagan
Copy link

BenTalagan commented Sep 17, 2024

After which we could go back and see if rb-gsl can install now... but alas it cannot, and still gets the same errors from before.

@0xdevalias thank you, your technique worked for me on MacOS Ventura.

I had to remove the currently upgraded gsl version by homebrew :

brew uninstall gsl

After creating the local recipe as you did (in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/g/[email protected]), I've installed it with the following flags :

HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source [email protected]

Then relinked gsl :

HOMEBREW_NO_INSTALL_FROM_API=1 brew link [email protected]

Then, from my project environment (which uses rvm to activate ruby 2.7.1), I uninstalled the precedent gem version :

gem uninstall gsl

And reinstalled it with bundler from within the project dir :

bundle

The gem then accepted to build, using the local [email protected] library version installed with homebrew.

@0xdevalias
Copy link

0xdevalias commented Sep 24, 2024

thank you, your technique worked for me on MacOS Ventura

@BenTalagan Awesome! Glad it was helpful!


Then relinked gsl :

HOMEBREW_NO_INSTALL_FROM_API=1 brew link [email protected]

@BenTalagan Oh true.. I wonder if that was the reason why it didn't work for me:

After which we could go back and see if rb-gsl can install now... but alas it cannot, and still gets the same errors from before.

I can't remember exactly what I did, but skimming my notes above, it looks like I didn't link [email protected], nor does it look like I changed any ENV vars to make the gem installation point to that version; so maybe that would have made it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants