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

ld: library not found for -lcrypto on macOS Sierra with OpenSSL installed via Homebrew #206

Closed
ralfr opened this issue Oct 9, 2016 · 25 comments

Comments

@ralfr
Copy link

ralfr commented Oct 9, 2016

Trying to build VerneMQ on macOS Sierra. OpenSSL installed via Homebrew. Command line to make: CFLAGS="-I /usr/local/Cellar/openssl/1.0.2j/include/" make rel

However, fails with the following:

===> Compiling lager_syslog ===> Compiling vmq_acl ===> Compiling eper ===> Compiling vmq_passwd gcc -I /usr/local/Cellar/openssl/1.0.2j/include/ vmq_passwd.c -lcrypto -o vmq_passwd ld: library not found for -lcrypto clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [compile] Error 1 ===> Hook for compile failed!

Any help is greatly appreciated!

@ioolkos
Copy link
Contributor

ioolkos commented Oct 9, 2016

oh, thanks @ralfr
Does this comment help?
#192 (comment)

VerneMQ should be running on OS X, but there were different issues for the SSL thing. I hope Apple did not change something there with Sierra AGAIN! :)

@ralfr
Copy link
Author

ralfr commented Oct 9, 2016

Unfortunately, the issue persists.

@ioolkos
Copy link
Contributor

ioolkos commented Oct 9, 2016

Also, this & this maybe help? it's basically all about the same thing OpenSSL and linking to it
#119 (comment)
#88 (comment)

@ioolkos
Copy link
Contributor

ioolkos commented Oct 9, 2016

Maybe the -L option is missing? (example from a user for his CFLAGS: -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include)

@ralfr
Copy link
Author

ralfr commented Oct 9, 2016

That did the trick! I'm one step closer. However, now it fails with this:

./libtool: line 983: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8) ./libtool: line 984: g++: command not found Makefile:419: recipe for target 'snappy.lo' failed make[2]: *** [snappy.lo] Error 1 make[2]: Leaving directory '/home/rrottmann/vernemq/_build/default/lib/eleveldb/c_src/snappy-1.0.4' Makefile:286: recipe for target 'all' failed make[1]: *** [all] Error 2 make[1]: Leaving directory '/home/rrottmann/vernemq/_build/default/lib/eleveldb/c_src/snappy-1.0.4' ===> Hook for compile failed!

@ralfr
Copy link
Author

ralfr commented Oct 9, 2016

I should maybe add that g++ is available on the Mac:

➜ vernemq git:(master) ✗ g++ clang: error: no input files

(VerneMQ deservers to become a Homebrew package...)

@ioolkos
Copy link
Contributor

ioolkos commented Oct 9, 2016

Ok, weird. But do you have Apple's XCode installed? or possibly something called the "Command Line Tools".
Or maybe there's some leaner way to get g++ on Mac?

Yes, we need this as a Homebrew package... & give more love to OS X :)

@ralfr
Copy link
Author

ralfr commented Oct 9, 2016

Yes. Xcode and Command Line Tools are there. And typing g++ is available:

➜  ~ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin16.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
➜  ~

@ioolkos
Copy link
Contributor

ioolkos commented Oct 9, 2016

Oh noes, then we seem to have a real problem on Sierra? @dergraf any idea there?

Just to make sure, can you run the make rel command again? (possibly after also deleting the _build directory).
Thank you so much for your help & patience!

on a sunday, no less... :)

@dergraf
Copy link
Contributor

dergraf commented Oct 9, 2016

No idea.. I d require a mac to be able to debug this. Are you on Sierra on your mb air @afa?

@ioolkos
Copy link
Contributor

ioolkos commented Oct 9, 2016

no, one version behind.

@ralfr
Copy link
Author

ralfr commented Oct 9, 2016

It worked!

Here is what I did:

cd /usr/local/include
ln -s ../opt/openssl/include/openssl .

In the vernemq repo root:
rm -rf _build
CFLAGS="-L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include" make rel

@ralfr
Copy link
Author

ralfr commented Oct 9, 2016

@ioolkos Are you on Twitter?

@ioolkos
Copy link
Contributor

ioolkos commented Oct 9, 2016

Ha, awesome. Many thanks @ralfr ! :)
We'll make note of those steps.

(my personal twitter name is @frescosecco)

@dergraf dergraf closed this as completed Oct 26, 2016
@codeadict
Copy link
Contributor

codeadict commented Nov 4, 2016

This issue is persisting on Sierra, have you upgraded @ralfr? , i'm making a Formula for homebrew but don't have any success it fails compiling eleveldb

@chimit
Copy link

chimit commented Mar 15, 2017

The above commands by @ralfr return another error:

$ CFLAGS="-L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include" make rel

...

===> Resolved vernemq-1.0.0rc2
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
make: *** [rel] Error 1

rebar3.crashdump:

Error: function_clause
[{relx,format_error,
       [{error,eacces}],
       [{file,"/home/tristan/Devel/rebar3/_build/default/lib/relx/src/relx.erl"},
        {line,220}]},
 {relx,report_error,2,
       [{file,"/home/tristan/Devel/rebar3/_build/default/lib/relx/src/relx.erl"},
        {line,336}]},
 {rebar_relx,do,4,
             [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_relx.erl"},
              {line,38}]},
 {rebar3_cuttlefish_release,do,1,
                            [{file,"/Users/user/Code/vernemq/_build/default/plugins/rebar3_cuttlefish/src/rebar3_cuttlefish_release.erl"},
                             {line,89}]},
 {rebar_core,do,2,
             [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_core.erl"},
              {line,153}]},
 {rebar3,main,1,
         [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar3.erl"},
          {line,66}]},
 {escript,run,2,[{file,"escript.erl"},{line,757}]},
 {escript,start,1,[{file,"escript.erl"},{line,277}]}]


@larshesel
Copy link
Contributor

Hi @chimit

The eacces error points to a file system permission issue. Can you see if the file mentioned /home/tristan/Devel/rebar3/_build/default/lib/relx/src/relx.erl is available for your user to read?

@larshesel
Copy link
Contributor

hi @chimit forget the above. It looks to me like you're not using the rebar3 file supplied with vernemq. If the REBAR environment variable has been set the makefile will use the rebar specified there. Maybe that is what is causing this issue?

@chimit
Copy link

chimit commented Mar 16, 2017

Hi, @larshesel
Sorry, I'm not familiar with Erlang. I don't see REBAR in the environment vars list (printenv).

After I start make rel I see:

$ make rel
/Users/user/vernemq/rebar3  release --overlay_vars vars.config

@larshesel
Copy link
Contributor

hi @chimit

It looks like this might be your issue: erlware/relx#564.

If you're feeling adventurous you could try to build rebar3 yourself: https://github.com/erlang/rebar3 and drop the rebar3 file into the vernemq folder

From what I understood v3.3.2 should not have this issue.

It would be great if you could confirm if this works for you as I don't have access to an OSX machine to test - if it does I'd downgrade the package we ship with vernemq.

@larshesel
Copy link
Contributor

hi @chimit did you solve your issue? Otherwise I just saw that there's a new version of rebar3 available (3.3.6) on http://www.rebar3.org/.

We would probably upgrade to this version on master soon anyway - but it would be great if you could try it out and verify if it solves the problem! To test it you would only have to drop the new version into a new clone of vernemq (overwriting the old rebar3 version) and run make rel.

Cheers!

@chimit
Copy link

chimit commented Apr 26, 2017

Hi, @larshesel!
Sorry for the late reply. I just replaced Rebar3 with the new version from the official website and repeat the steps by @ralfr and if was finally compiled. I only had to use sudo.

@larshesel
Copy link
Contributor

ok - I don't know about the sudo issue - but I'll recommend we upgrade our rebar3 version. Thanks for testing it out!

larshesel added a commit to larshesel/vernemq that referenced this issue Apr 26, 2017
This should fix build issues on osx. See
vernemq#206 (comment) and
vernemq#366.
@dergraf
Copy link
Contributor

dergraf commented Apr 26, 2017

@codeadict want to step in with your homebrew formula?

@codeadict
Copy link
Contributor

@chimit ^^ https://github.com/codeadict/homebrew-vernemq

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

No branches or pull requests

6 participants