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

Add macOS support #5

Open
Spoowy opened this issue Jan 11, 2019 · 6 comments
Open

Add macOS support #5

Spoowy opened this issue Jan 11, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@Spoowy
Copy link

Spoowy commented Jan 11, 2019

I'm getting this error:

The on_load function for module erlsass returned:
{error,{load_failed,"Failed to load NIF library: 'dlopen(/.../deps/erlsass/priv/erlsass_nif.so, 2): image not found'"}}

Do I have to compile anything else, since erlsass_nif.so is not existent.

Cheers,
Erwin

@ivanwel
Copy link
Contributor

ivanwel commented Jan 12, 2019

Hi Erwin,
Thanks for reaching out.

Please elaborate on your issue, namely: Operating system, Erlang/otp version, and did you install the required prerequisites as per the readme.md?

Also did you encounter any errors during compilation? (Note that rebar3 does this for you).

Please let me know and thanks ks for using Erlsass!

Cheers,
Irsan van Wel

@Spoowy
Copy link
Author

Spoowy commented Jan 12, 2019

Hey Irsan,
Thanks for the rapid reply!

Operating system: MacOS Mojave 10.14
Erlang/otp version: 21.0
Dependencies (gcc, g++) are installed.

This is the output the compilation gives me:

===> Compiling erlsass
make: Nothing to be done for `all'.
Darwin
Darwin
/.../_build/default/deps/erlsass/c_src
/.../_build/default/deps/erlsass/priv
cp libsass/lib/libsass.so ../priv
Undefined symbols for architecture x86_64:
  "_enif_alloc_env", referenced from:
      compile_file(enif_environment_t*, int, unsigned long const*) in erlsass_nif-fc98b9.o
  "_enif_free_env", referenced from:
      compile_file(enif_environment_t*, int, unsigned long const*) in erlsass_nif-fc98b9.o
  "_enif_get_list_length", referenced from:
      compile_file(enif_environment_t*, int, unsigned long const*) in erlsass_nif-fc98b9.o
  "_enif_get_string", referenced from:
      compile_file(enif_environment_t*, int, unsigned long const*) in erlsass_nif-fc98b9.o
  "_enif_make_atom", referenced from:
      mk_atom(enif_environment_t*, char const*) in erlsass_nif-fc98b9.o
      mk_error(enif_environment_t*, char const*) in erlsass_nif-fc98b9.o
      mk_ok(enif_environment_t*, char const*) in erlsass_nif-fc98b9.o
      compile_file(enif_environment_t*, int, unsigned long const*) in erlsass_nif-fc98b9.o
  "_enif_make_badarg", referenced from:
      compile_file(enif_environment_t*, int, unsigned long const*) in erlsass_nif-fc98b9.o
  "_enif_make_existing_atom", referenced from:
      mk_atom(enif_environment_t*, char const*) in erlsass_nif-fc98b9.o
      mk_error(enif_environment_t*, char const*) in erlsass_nif-fc98b9.o
      mk_ok(enif_environment_t*, char const*) in erlsass_nif-fc98b9.o
      compile_file(enif_environment_t*, int, unsigned long const*) in erlsass_nif-fc98b9.o
  "_enif_make_string", referenced from:
      mk_ok(enif_environment_t*, char const*) in erlsass_nif-fc98b9.o
      compile_file(enif_environment_t*, int, unsigned long const*) in erlsass_nif-fc98b9.o
  "_enif_make_tuple", referenced from:
      mk_error(enif_environment_t*, char const*) in erlsass_nif-fc98b9.o
      mk_ok(enif_environment_t*, char const*) in erlsass_nif-fc98b9.o
      compile_file(enif_environment_t*, int, unsigned long const*) in erlsass_nif-fc98b9.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
cp erlsass_nif.so ../priv
cp: erlsass_nif.so: No such file or directory
make: *** [copy2] Error 1
===> Hook for compile failed!

I shall be obliged!
Erwin

@ivanwel
Copy link
Contributor

ivanwel commented Jan 14, 2019

Hi Erwin,

Unfortunately I have never tested the lib on Mac OS, and I don't own a Mac so I can't really do it myself.
However I see more people that are encountering similar issues.

It seems that on Mac Os the C compiler needs different flags, based on your output dump I assume the compiler can't find/load the erlang nif header.

Are you able to clone the project and make some changes yourself ?

Have a look at:
http://erlang.org/pipermail/erlang-questions/2011-June/059679.html

Also a google search on Erlang NIF Mac Osx or similar might help you.

The following file is where the you want to look:
https://github.com/eyedouble/erlsass/blob/master/c_src/Makefile

At the top of that file you find a block 'Define os' you probably want to add some condition there for Darwin/MacOs.

Then under OS specific you want to add a clause for your OS and copy paste unix and then adjust the flags.

You might also want to have a look at:
https://github.com/eyedouble/erlsass/blob/master/rebar.config

Let me know, I'm pretty sure you should be able to get it to work.

Kr,

Irsan

@ivanwel
Copy link
Contributor

ivanwel commented Jan 14, 2019

By the way is your target environment Mac Os as well? Just out of interest...

@Spoowy
Copy link
Author

Spoowy commented Jan 14, 2019

Thanks for the info! I shall have a look. My target environment is Ubuntu 14

@ivanwel ivanwel changed the title Failed to load NIF library Add Mac Os support Jan 15, 2019
@ivanwel ivanwel changed the title Add Mac Os support Add MacOs support Jan 15, 2019
@ivanwel ivanwel changed the title Add MacOs support Add macOS support Jan 15, 2019
@ivanwel ivanwel changed the title Add macOS support Add macOS support Jan 15, 2019
@ivanwel
Copy link
Contributor

ivanwel commented Jan 15, 2019

Hi Erwin,

Good luck, let me know if you need any help. And when you get it to work I would be happy to add your changes.

PS. As you can see I have changed this title of this issue hope you agree.

Kr,

Irsan

@ivanwel ivanwel added the enhancement New feature or request label Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants