Crystal: Cannot find -lssl -lcrypto -lz

Created on 25 Apr 2016  路  7Comments  路  Source: crystal-lang/crystal

I'm kind of Linux noob. I'm playing Crystal and Kemal. But this happened when I try to execute "crystal build src/1kemaltest.cr"

`Error opening file '/home/*/Applications/CrystalTests/1kemaltest/.crystal/opt/crystal
/src/ecr/process.cr/bc_flags' with mode 'w': Permission denied
[5660866] ???
[6182178] ???
[9509852] ???
[8168491] ???
{a lot of number}
[5653341] ???
[12646872] main +40
[140537811283653] __libc_start_main +245
[5629425] ???

Error: you've found a bug in the Crystal compiler. Please open an issue, including source co
de that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues
*: ~/Applications/CrystalTests/1kemaltest $ `

And then I've tried this "sudo crystal build src/1kemaltest.cr" :) Compiler said:

/usr/bin/ld: cannot find -lssl /usr/bin/ld: cannot find -lcrypto /usr/bin/ld: cannot find -lz collect2: error: ld returned 1 exit status Error: execution of command failed with code: 1:cc -o "/home/*/Applications/Crystal
Tests/1kemaltest/1kemaltest" "${@}" -rdynamic -lssl -lcrypto -lz /opt/crystal/src/ext/libc
rystal.a -levent -lrt -lpcre -lm -lgc -lpthread -ldl``

As I said, I'm realy a newbie on Linux. Maybe it depends Linux. I'm not sure.

My source code is below:
`require "kemal"

get "/" do
"Hello World!"
end

Kemal.run`

My development environment is on Koding.com (Ubuntu VM)
Crystal version: 0.15.0

Most helpful comment

Hello @onuar, I believe the problem is that Crystal's debian package is not listing lot of these dependencies.

In order to compile something that depends on crypto, ssl and zlib, you need the development packages of these tools.

Please install libssl-dev and zlib1g-dev packages in order to compile.

You will need to install development packages for other libraries as you require link to them.

Hope that helps.

All 7 comments

@onuar how did you install Crystal? Seems like you are missing libssl and other dependencies.

I've followed this instructions:
http://crystal-lang.org/docs/installation/on_debian_and_ubuntu.html

Is there anything else I should do in this situation?

Hello @onuar, I believe the problem is that Crystal's debian package is not listing lot of these dependencies.

In order to compile something that depends on crypto, ssl and zlib, you need the development packages of these tools.

Please install libssl-dev and zlib1g-dev packages in order to compile.

You will need to install development packages for other libraries as you require link to them.

Hope that helps.

Is this a fresh box? Seems like you are also missing build tools.

Try installing with sudo apt-get install build-essential

Thanks everyone. I just installed openssl. Kemal is alive now!

@onuar Are you still running it as root (with sudo)? Does it still fail without? Because that's a separate issue and using root is the least proper workaround to it one can imagine.

For CentOS:
sudo yum install openssl-devel

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grosser picture grosser  路  3Comments

asterite picture asterite  路  3Comments

pbrusco picture pbrusco  路  3Comments

relonger picture relonger  路  3Comments

cjgajard picture cjgajard  路  3Comments