2

I'm trying to connect ruby on rails with MariaDB at the moment. But for some reason when trying to install the mysql2 gem I'm getting this error:

/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto

What SSL/Crypto library am I missing for ruby on rails?

I couldn't find anyone else with this exact problem.

The error I'm getting:

"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -
I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -
I/usr/include/mysql -Wdate-time -D_FORTIFY_SOURCE=2   -g -O2 -fdebug-prefix-
map=/build/ruby2.3-yge53O/rub$
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */

"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -
I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -
I/usr/include/mysql -Wdate-time -D_FORTIFY_SOURCE=2   -g -O2 -fdebug-prefix-map=/build/ruby2.3-yge53O/rub$
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
Leo Izen
  • 4,165
  • 7
  • 37
  • 56
Stefan
  • 37
  • 7
  • what command are you running that produces this error? can you reproduce this with `gem install mysql2 -v [version]`? – Jared Beck Nov 07 '17 at 14:26

1 Answers1

4

It looks like you are missing the libssl-dev package. Try running:

sudo apt-get update
sudo apt-get install libssl-dev

Once the package is installed, try installing your gem again.

Tom Aranda
  • 5,919
  • 11
  • 35
  • 51