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

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

Open
livexia opened this issue May 2, 2024 · 6 comments

Comments

@livexia
Copy link

livexia commented May 2, 2024

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.

@listentodella
Copy link

Any better solutions ? I also met this issue.

@livexia
Copy link
Author

livexia commented Jun 2, 2024

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:

@listentodella
Copy link

listentodella commented Jun 2, 2024

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

@livexia
Copy link
Author

livexia commented Jun 2, 2024

  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)

@BartMassey
Copy link
Member

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.

@livexia
Copy link
Author

livexia commented Jun 2, 2024

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.

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

3 participants