Today I tried installing Ruby 2.2.0, which just came out, on my Ubuntu 14.04 (Trusty) machine.

The build (through the excellent ruby-build) failed though, and inspecting the logs, the error seemed to be related to libffi:

linking shared-object fiddle.so
/usr/bin/ld: ./libffi-3.2.1/.libs/libffi.a(raw_api.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
./libffi-3.2.1/.libs/libffi.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

The solution was to simply install libffi-dev:

sudo aptitude install libffi-dev

And then the installation proceeded without problems.