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

yaml.h #9

Open
soft4good opened this issue Jun 5, 2015 · 4 comments
Open

yaml.h #9

soft4good opened this issue Jun 5, 2015 · 4 comments

Comments

@soft4good
Copy link

Hi Joe,

Thank you very much for this library, very cool.

Now, i'm new to elixir and was trying to use your library in my project, i add it to the deps in mix.exs and do mix deps.get, all good, but then on compile time i keep getting:

==> yomel
c_src/utils.c:2:10: fatal error: 'yaml.h' file not found
#include <yaml.h>
         ^
1 error generated.
c_src/yomel_nif.c:2:10: fatal error: 'yaml.h' file not found
#include <yaml.h>
         ^
1 error generated.

== Compilation error on file lib/yomel/parser.ex ==
** (MatchError) no match of right hand side value: {:error, :on_load_failure}
    (stdlib) erl_eval.erl:657: :erl_eval.do_apply/6

could not compile dependency yomel, mix compile failed. You can recompile this dependency with `mix deps.compile yomel` or update it with `mix deps.update yomel`

14:37:28.439 [error] The on_load function for module Elixir.Yomel.Parser returned {:error,
 {:load_failed,
  'Failed to load NIF library: \'priv/yomel.so: invalid file format\''}}

What i'm missing? thanks!

I have yaml-cpp installed and yaml.h is in /usr/local/include/yaml.h ... Also, FYI, i'm trying to use this in a eJabberd module.

@soft4good
Copy link
Author

Well, if somebody else have this issue, just fixed it by adding /usr/local/include to the gcc include path, the path to yaml.h was missing...

setenv C_INCLUDE_PATH /usr/local/include/

Now i'm getting:

==> yomel
/usr/bin/ld: /tmp/utils-0c94c7.o: relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/tmp/utils-0c94c7.o: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

== Compilation error on file lib/yomel/parser.ex ==
** (MatchError) no match of right hand side value: {:error, :on_load_failure}
    (stdlib) erl_eval.erl:657: :erl_eval.do_apply/6


16:04:32.179 [error] The on_load function for module Elixir.Yomel.Parser returned {:error,
 {:load_failed, 'Failed to load NIF library: \'Cannot open "priv/yomel.so"\''}}

I'm using FreeBSD btw.

Will keep looking into it.

@Joe-noh
Copy link
Owner

Joe-noh commented Jun 5, 2015

Hi, @reinier-gonzalez
Thank you for your report!

Yomel is assuming that yaml.h from libyaml is used.
Can you manually make latest libyaml and use with it?

I'm sorry; the compile process isn't tested enough.
If you need to change what the task Mix.Tasks.Compile.Nif does, please feel free to send a pull-request!

Thanks.

@Joe-noh
Copy link
Owner

Joe-noh commented Jun 11, 2015

@reinier-gonzalez

I'm so sorry! It had a bug that wrong paths were specified.
Can you try again?

@gaaamii
Copy link

gaaamii commented Apr 14, 2016

@reinier-gonzalez This issue helped me use libyaml in my C project. Thanks!

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

3 participants