Friday, December 27, 2019

Troubleshooting Ruby 2.7 compiler errors

So Ruby 2.7 was released at Xmas'19 and I got some errors when compiling it in Linux Mint 19.1. Some libraries were not configured. The errors ocurred at the linking phase of make. Five libraries got errors, and I'll walk across their solutions:

  • openssl:
    sudo apt install libssl-dev
  • gdbm:
    sudo apt install libgdbm-dev
  • dbm:
    sudo apt install libqdbm-dev
  • readline:
    sudo apt install libedit-dev
  • zlib:
    sudo apt install libz-dev
    cd /lib/x86_64-linux-gnu/
    sudo ln -s


Monday, May 13, 2019

Detecting key press in Ruby

To check whether a key is pressed in linux (non-blocking, non-waiting).
def keypressed
  system('stty raw -echo') # => Raw mode, no echo
  char = (STDIN.read_nonblock(1).chr rescue nil)
  system('stty -raw echo') # => Reset terminal mode
Inspired on