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

Faild build On OSX 10.11(Elp) #255

Closed
imiskolee opened this issue Aug 19, 2015 · 43 comments
Closed

Faild build On OSX 10.11(Elp) #255

imiskolee opened this issue Aug 19, 2015 · 43 comments

Comments

@imiskolee
Copy link

@imiskolee imiskolee commented Aug 19, 2015

failed to run custom build command for openssl-sys v0.6.4
Process didn't exit successfully: /Users/misko/developer/rust_projects/aws-simple-sdk.rs/target/debug/build/openssl-sys-149f6ef08ad7404d/build-script-build (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/usr/lib
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=crypto
cargo:rustc-link-lib=z
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
CARGO_MANIFEST_DIR = Some("/Users/misko/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.6.4")
OUT_DIR = Some("/Users/misko/developer/rust_projects/aws-simple-sdk.rs/target/debug/build/openssl-sys-149f6ef08ad7404d/out")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
debug 0
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O0" "-c" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/misko/developer/rust_projects/aws-simple-sdk.rs/target/debug/build/openssl-sys-149f6ef08ad7404d/out/src/openssl_shim.o" "/Users/misko/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.6.4/src/openssl_shim.c"

command did not execute successfully, got: exit code: 1

--- stderr
/Users/misko/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.6.4/src/openssl_shim.c:1:10: fatal error: 'openssl/hmac.h' file not found

include <openssl/hmac.h>

     ^

1 error generated.
thread '

' panicked at 'explicit panic', /Users/misko/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.13/src/lib.rs:510

@robertlong
Copy link

@robertlong robertlong commented Aug 20, 2015

I'm also seeing the same issue on OSX 10.11

failed to run custom build command for `openssl-sys v0.6.4`
Process didn't exit successfully: `/Users/robertlong/workspace/eve/runtime/target/debug/build/openssl-sys-765ddf9de3c5179c/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/usr/lib
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=crypto
cargo:rustc-link-lib=z
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
CARGO_MANIFEST_DIR = Some("/Users/robertlong/.multirust/toolchains/nightly-2015-08-10/cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.4")
OUT_DIR = Some("/Users/robertlong/workspace/eve/runtime/target/debug/build/openssl-sys-765ddf9de3c5179c/out")
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
debug 0
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
running: "cc" "-O0" "-c" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-fPIC" "-o" "/Users/robertlong/workspace/eve/runtime/target/debug/build/openssl-sys-765ddf9de3c5179c/out/src/openssl_shim.o" "/Users/robertlong/.multirust/toolchains/nightly-2015-08-10/cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.4/src/openssl_shim.c"


command did not execute successfully, got: exit code: 1



--- stderr
/Users/robertlong/.multirust/toolchains/nightly-2015-08-10/cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.4/src/openssl_shim.c:1:10: fatal error: 'openssl/hmac.h' file not found
#include <openssl/hmac.h>
         ^
1 error generated.
thread '<main>' panicked at 'explicit panic', /Users/robertlong/.multirust/toolchains/nightly-2015-08-10/cargo/registry/src/github.com-0a35038f75765ae4/gcc-0.3.11/src/lib.rs:514
stack backtrace:
   1:        0x10ff0f1b5 - sys::backtrace::write::h6ddc342d792b0e00eys
   2:        0x10ff18740 - panicking::on_panic::h958ebf4d6905d53emex
   3:        0x10fed1762 - rt::unwind::begin_unwind_inner::hbd872a23a0e4a7d76Hw
   4:        0x10fe2c9cc - rt::unwind::begin_unwind::h4878656591332600981
   5:        0x10fe25ed0 - fail::h760db72685f0b7d0COa
   6:        0x10fe36058 - run::h77877c702f7c820fKHa
   7:        0x10fe2f9a9 - Config::compile_object::h7f3ab7454f729dd6ema
   8:        0x10fe293fb - Config::compile::h7653fa0ba387c0b8Rha
   9:        0x10fdf88a7 - build_openssl_shim::h5076206d24a8328fSfa
  10:        0x10fdf1043 - main::h53a555fd2c70138diaa
  11:        0x10ff17fad - __rust_try
  12:        0x10ff196cd - rt::lang_start::ha6eaa4ada71a9cdbh9w
  13:        0x10fe0064e - main

Loading

@sfackler
Copy link
Owner

@sfackler sfackler commented Aug 20, 2015

It looks like OSX 10.11 doesn't ship with openssl anymore. You'll need to install your own copy I guess.

Loading

@imiskolee
Copy link
Author

@imiskolee imiskolee commented Aug 21, 2015

i fix it as:
first,i compliing openssl-sys success.
than, compliing openssl it success.

Loading

@paulrouget
Copy link

@paulrouget paulrouget commented Aug 21, 2015

This worked for me (when building Servo):

export OPENSSL_INCLUDE_DIR=/usr/local/Cellar/openssl/1.0.2d_1/include/

Loading

@back2mach
Copy link

@back2mach back2mach commented Sep 27, 2015

I install the openssl using Homebrew, and the this works for me:
export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include

Loading

@ogham
Copy link

@ogham ogham commented Oct 1, 2015

I had to do both of the following to get it to work, rather than just the first one (fish, not bash). Not sure what is up with that, but if the above by itself doesn't work, try this!

set -x OPENSSL_INCLUDE_DIR /usr/local/opt/openssl/include
set -x OPENSSL_ROOT_DIR /usr/local/opt/openssl
$ brew info openssl
openssl: stable 1.0.2d (bottled)

Loading

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Oct 2, 2015

I also had success doing brew link --force openssl - that was enough to get Servo building for me again. The OSX update perhaps reset a bunch of symlinks?

Loading

@sfackler
Copy link
Owner

@sfackler sfackler commented Oct 2, 2015

OSX doesn't ship OpenSSL headers anymore starting with El Capitan.

Loading

@k4rtik
Copy link

@k4rtik k4rtik commented Oct 8, 2015

Same observation as #255 (comment), relinking openssl with brew fixed the build for me as well.

Loading

@k4rtik
Copy link

@k4rtik k4rtik commented Oct 8, 2015

But probably it's not the best solution to this problem, as brew doctor produces a new warning now:

$ brew doctor
[...]
Warning: Some keg-only formula are linked into the Cellar.
Linking a keg-only formula, such as gettext, into the cellar with
`brew link <formula>` will cause other formulae to detect them during
the `./configure` step. This may cause problems when compiling those
other formulae.

Binaries provided by keg-only formulae may override system binaries
with other strange results.

You may wish to `brew unlink` these brews:
    openssl

Loading

@tpberntsen
Copy link

@tpberntsen tpberntsen commented Oct 8, 2015

Same problem here on Mac OS X 10.11 (El Capitan). Running brew link --force openssl (as mentioned elsewhere in this thread) solved the problem, and things compiled beautifully.

Loading

@DrewHood
Copy link

@DrewHood DrewHood commented Oct 17, 2015

Hey folks, same issue. Unfortunately the Homebrew solution didn't work for me. Anyone have any other ideas?

Loading

@killercup
Copy link

@killercup killercup commented Oct 18, 2015

brew link --force openssl worked for me on OS X 10.11. Might be good to mention this in Servo's Readme.

Loading

@imiskolee
Copy link
Author

@imiskolee imiskolee commented Oct 19, 2015

thinks.is fix.

Loading

@iszak
Copy link

@iszak iszak commented Dec 8, 2015

I tried all the suggestions in this ticket, I am using homebrew via boxen so my openssl is installed under /opt/boxen/homebrew/Cellar/openssl/1.0.2e/include/ on OS X 10.11.2 (El Capitan) and this solved it for me

export C_INCLUDE_PATH=/opt/boxen/homebrew/Cellar/openssl/1.0.2e/include

I am posting this in an effort to help any others seeking to find a solution

Loading

@Alsmile
Copy link

@Alsmile Alsmile commented Dec 10, 2015

I fix it as:
export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include
export DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include

Loading

@ar-jan
Copy link

@ar-jan ar-jan commented Dec 14, 2015

I have the same problem on Ubuntu 14.04, any ideas what to do there?

I have this:
$ /usr/bin/openssl version
OpenSSL 1.0.1f 6 Jan 2014

Though which openssl points to my Anaconda installation, /home/arjan/Programs/anaconda3/bin/openssl (OpenSSL 1.0.1k 8 Jan 2015).

Loading

@ar-jan
Copy link

@ar-jan ar-jan commented Dec 14, 2015

Never mind, my issue was while installing Eve, and there I found a solution, sudo apt-get install libssl-dev.

Loading

@herrernst
Copy link

@herrernst herrernst commented Dec 16, 2015

As iszak mentioned, I too had to export C_INCLUDE_PATH on OS X 10.11.2, just exporting OPENSSL_INCLUDE_DIR had no effect.

Loading

@andrewtj
Copy link

@andrewtj andrewtj commented Dec 16, 2015

@herrernst Try cargo clean and then build with OPENSSL_INCLUDE_DIR and OPENSSL_LIB_DIR set. See #316 for further commentary on why you should set both.

Loading

@herrernst
Copy link

@herrernst herrernst commented Dec 16, 2015

@andrewtj You're right, thanks.

Loading

@tamird
Copy link

@tamird tamird commented Jan 11, 2016

This is still an issue; it was not helped by brew link.

DEP_OPENSSL_INCLUDE=$(brew --prefix openssl)/include cargo run did the trick.

Loading

@sfackler
Copy link
Owner

@sfackler sfackler commented Jan 11, 2016

@tamird did you cargo clean after brew linking?

Loading

@KodrAus
Copy link

@KodrAus KodrAus commented Mar 7, 2016

No combination of the above suggestions seem to be working for me... I either get a link error for openssl/hmac.h in openssl-sys-extras v0.7.6 or a link error for openssl/ssl.h in openssl v0.7.6

Loading

@seangrogg
Copy link

@seangrogg seangrogg commented Mar 11, 2016

Fixed with Alsmile's recommendation:

export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include 
export DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include

Loading

@kometen
Copy link

@kometen kometen commented Mar 19, 2016

Fixed with Alsmile's recommendation using macports:

export DEP_OPENSSL_INCLUDE=/opt/local/include         
export OPENSSL_INCLUDE_DIR=/opt/local/include         

Loading

@KodrAus
Copy link

@KodrAus KodrAus commented Mar 26, 2016

I couldn't get any suggestions to work, but a clean install of OSX 10.11 with brew link --force openssl did fix this for me.

Loading

@denen99
Copy link

@denen99 denen99 commented Apr 6, 2016

I had to update CLFAGS with

export CFLAGS="-I /usr/local/opt/openssl/include"

Loading

@alexreidy
Copy link

@alexreidy alexreidy commented Jun 4, 2016

Thanks guys. I first tried the brew link to no avail, but compilation succeeded after the exports.

brew link --force openssl
export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include 
export DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include

This was on Yosemite 10.10.5

Loading

@e-oz
Copy link

@e-oz e-oz commented Jul 11, 2016

@larsbergstrom thank you very much, your advice about brew link --force openssl is still valid, even in Sierra. @sfackler please consider to add this line as 4 line into readme instruction.

Loading

@pcwalton
Copy link

@pcwalton pcwalton commented Aug 3, 2016

Upstream Homebrew seems to refuse to link it anymore. :(

Loading

@sfackler
Copy link
Owner

@sfackler sfackler commented Aug 3, 2016

Yay!

I'm working on adjusting some APIs to hopefully allow openssl to build without requiring headers to be installed for the basic feature set. Should make it "just work" on OSX.

Loading

@geyang
Copy link

@geyang geyang commented Aug 7, 2016

upstream homebrew refuse to link.

brew --version
Homebrew 0.9.9 (git revision b8ce1; last commit 2016-08-06)
Homebrew/homebrew-core (git revision fea8; last commit 2016-08-06)

Loading

@ghost
Copy link

@ghost ghost commented Sep 20, 2016

I use macOS Sierra and zsh
i add two line in to .zshrc and it work perfectly

export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib

Loading

@morriswinkler
Copy link

@morriswinkler morriswinkler commented Oct 5, 2016

One solution would be to check for the OS version and if it fails then print the paragraph from the Readme.md#L34-L40 that explains how to build under OSX 10.11. This is how other people deal with this kind of problem until there is a real fix.

This would have certainly saved me 5 minutes of my life, and after checking the options, i conclude that exporting Env vars is the most elegant solution in the moment.

Loading

@sfackler
Copy link
Owner

@sfackler sfackler commented Oct 6, 2016

Yep, that would definitely be a reasonable thing to do. Want to open a PR?

Loading

@morriswinkler
Copy link

@morriswinkler morriswinkler commented Oct 6, 2016

I am fairly new to Rust and it is 4 o'clock in the morning.

How would I catch the c compiler exit() return value from the build.rs main().
Is that even possible, otherwise I would check for the pkg-config path and then
check for the environment variables, if both is not to be found panic.

I just checked my 10.9 installation and found

/usr/local/Cellar/openssl/1.0.2d_1/include/openssl/ssl.h
/usr/local/Cellar/openssl/1.0.2f/include/openssl/ssl.h
/usr/local/Cellar/openssl/1.0.2h_1/include/openssl/ssl.h

so pkg-config then check if ssl.h is to be found in any of

pkg-config include paths

/usr/include/openssl/ssl.h 
/usr/local/include/openssl/ssl.h

now check the env for

OPENSSL_INCLUDE_DIR
OPENSSL_LIB_DIR

if all of that returned false or empty then panic.

Any suggestion on how to catch the llvm error.

Loading

@dashed
Copy link

@dashed dashed commented Nov 1, 2016

For lurkers, on El Capitan (osx) I needed to add the following in my .bash_profile:

export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib
export DEP_OPENSSL_INCLUDE=`brew --prefix openssl`/include

Loading

nbigaouette added a commit to nbigaouette/gitlab-api-rs that referenced this issue Dec 7, 2016
pkgw added a commit to tectonic-typesetting/tectonic that referenced this issue Jan 8, 2017
Turns out the OpenSSL problem on OSX is well known:
sfackler/rust-openssl#255 . Trying the most recent
and comprehensive-looking suggestion.
@learnopengles
Copy link

@learnopengles learnopengles commented Jan 13, 2017

This worked for me on MacPorts:

export OPENSSL_INCLUDE_DIR=/opt/local/include
export OPENSSL_LIB_DIR=/opt/local/lib

I do seem to be running into some kind of conflict with libgit2_sys (rust-lang/cargo#3538); I've seen similar bugs opened but not yet sure what the actual cause is. The problem does go away when using brew instead of macports.

Loading

@samuela
Copy link

@samuela samuela commented Nov 17, 2021

If you're using the Nix package manager, I found that the following works:

nix-shell -p openssl pkg-config

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet