rust-raspberrypi-OS-tutorials icon indicating copy to clipboard operation
rust-raspberrypi-OS-tutorials copied to clipboard

Problem setting up the MacOS environment, the serialport gem is not maintained.

Open livexia opened this issue 1 year ago • 7 comments

Problem: Unable to use bundle to install Ruby gem ruby-serialport

System info: Apple M1 with macOS Sonoma

ruby-serialport issue: [posix_serialport_impl.c: error: incompatible pointer to integer](posix_serialport_impl.c: error: incompatible pointer to integer)

The serialport gem is no longer maintained. I can pull the repo and apply the patch mentioned in the issue, but due to my lack of knowledge of Ruby/gem, it's not perfect, for some reason I need to add RUBYLIB=ruby-serialport/lib to specify the serialport lib path. Maybe someone good at gem has a better solution.I wonder if this can be done with rust.

livexia avatar May 02 '24 15:05 livexia

Any better solutions ? I also met this issue.

listentodella avatar Jun 02 '24 13:06 listentodella

A better solution would be to use a maintained serialport gem to replace the current one. If you just want to run the tutorials, I think manual patch ruby-serialport and install will do, but if you are not familiar with ruby, you will need to spend some time figuring out how to install the gem locally.

links:

  • https://github.com/hparra/ruby-serialport/issues/74

livexia avatar Jun 02 '24 13:06 livexia

yes, it's hard to know how to install gem locally.

  1. git clone above repo locally
  2. apply the patch
  3. bundle exec rake build to generate .gem file
  4. gem install local path/to/the gem file from last step

listentodella avatar Jun 02 '24 13:06 listentodella

  1. bundle config --local path '.vendor/bundle'
  2. bundle config --local without 'development'

after apply patch install locally:

  1. run gem install --local pkg/serialport-1.3.2.gem --install-dir ../ruby-serialport-output -V intall gem to ruby-serialport-output
  2. in Gemfile using gem 'serialport', path: "ruby-serialport-output" to specify path
  3. bundle install
  4. bundle list
❯ bundle list
Gems included by the bundle:
  * bindata (2.5.0)
  * bundler (1.17.2)
  * colorize (1.1.0)
  * elftools (1.2.0)
  * ruby-progressbar (1.13.0)
  * serialport (1.3.2)

livexia avatar Jun 02 '24 14:06 livexia

Somebody give us a pull request for the book? This is something I know nothing about, but it sounds like @livexia has it figured out.

BartMassey avatar Jun 02 '24 15:06 BartMassey

I don't think this solution is good or 100% correct, even though it works on my system. I came across this problem because I am helping someone run this tutorial. It fails on my own system, but had no problem on this person's system. Before this I know nothing about Ruby, I think this is a temporary solution, maybe someone with better knowledge should give a pr.

livexia avatar Jun 02 '24 16:06 livexia

Thank you for reporting this issue. The author has been on vacation for over a year now.

This seems to be a Ruby issue, I will take some time to check, but I'm not sure if I can solve it, but it's worth fixing it.

Jzow avatar Jul 30 '24 14:07 Jzow