rust-embedded/rust-raspberrypi-OS-tutorials

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

Opened this issue · 6 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.

Any better solutions ? I also met this issue.

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:

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
  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)

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.

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.