benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 114 forks source link

make: *** [compile] Error 1 on ubuntu natty #49

Closed abhinavsingh closed 13 years ago

abhinavsingh commented 13 years ago

==> ejson (get-deps) ==> oauth (get-deps) ==> ibrowse (get-deps) ==> couchbeam (get-deps) ==> ejson (compile) Compiling c_src/decode.c In file included from c_src/erl_nif_compat.h:8:0, from c_src/decode.c:18: /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:28:23: error: redefinition of typedef ‘ERL_NIF_TERM’ /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:28:23: note: previous declaration of ‘ERL_NIF_TERM’ was here /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:35:2: error: conflicting types for ‘ErlNifFunc’ /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:35:2: note: previous declaration of ‘ErlNifFunc’ was here /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:38:35: error: redefinition of typedef ‘ErlNifEnv’ /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:38:35: note: previous declaration of ‘ErlNifEnv’ was here /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:40:16: error: redefinition of ‘struct enif_entry_t’ /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:40:16: note: originally defined here /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:51:2: error: conflicting types for ‘ErlNifEntry’ /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:51:2: note: previous declaration of ‘ErlNifEntry’ was here /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:65:2: error: conflicting types for ‘ErlNifBinary’ /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:65:2: note: previous declaration of ‘ErlNifBinary’ was here In file included from /usr/lib/erlang/erts-5.7.4/include/erl_nif.h:84:0, from c_src/erl_nif_compat.h:8, from c_src/decode.c:18: /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:29:1: error: conflicting types for ‘enif_inspect_binary’ /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:29:1: note: previous declaration of ‘enif_inspect_binary’ was here /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:30:1: error: conflicting types for ‘enif_alloc_binary’ /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:30:1: note: previous declaration of ‘enif_alloc_binary’ was here /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:31:1: error: conflicting types for ‘enif_release_binary’ /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:31:1: note: previous declaration of ‘enif_release_binary’ was here /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:35:1: error: conflicting types for ‘enif_make_binary’ /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:35:1: note: previous declaration of ‘enif_make_binary’ was here c_src/decode.c: In function ‘make_error’: c_src/decode.c:42:51: error: ‘ERL_NIF_LATIN1’ undeclared (first use in this function) c_src/decode.c:42:51: note: each undeclared identifier is reported only once for each function it appears in c_src/decode.c:42:9: error: too many arguments to function ‘enif_make_string’ /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:43:1: note: declared here c_src/decode.c:47:9: error: too many arguments to function ‘enif_make_string’ /usr/lib/erlang/erts-5.7.4/include/erl_nif_api_funcs.h:43:1: note: declared here c_src/decode.c:53:13: warning: implicit declaration of function ‘enif_make_uint’ c_src/decode.c: In function ‘reverse_tokens’: c_src/decode.c:241:5: warning: implicit declaration of function ‘enif_make_list_from_array’ c_src/decode.c:243:5: warning: implicit declaration of function ‘enif_inspect_iolist_as_binary’ ERROR: $CC -c $CFLAGS $DRV_CFLAGS c_src/decode.c -o c_src/decode.o failed with error: 1 make: *\ [compile] Error 1

andrewtj commented 13 years ago

Erlang R14B or later is needed to build ejson's NIF. You have R13B03 by the looks of that erts version.

Fix would be to replace: {port_sources, ["csrc/.c", "csrc/yajl/.c"]}. With: {portsources, [{"R14.+-.(darwin|linux|solaris)", "csrc/.c"}, {"R14.+-._(darwin|linux|solaris)", "csrc/yajl/.c"}]}.

In ejson's rebar.config.

abhinavsingh commented 13 years ago

Thanks Andrew, I initially solved the problem by hard fixing encode.c and decode.c (i need that then ;)) Anyways i tried your fix and works like a charm without any fix to *.c code files :)

abhinavsingh commented 13 years ago

Alas for some reason now my couchbeam make has started given error because of ejson rebar.config changes:

==> ejson (get-deps) ==> oauth (get-deps) ==> ibrowse-2.1.3 (get-deps) ==> couchbeam (get-deps) ==> ejson (compile) ERROR: compile failed while processing /home/abhinavsingh/Desktop/couchbeam/deps/ejson: {'EXIT',{function_clause,[{filelib,wildcard, [{"R14.+-.(darwin|linux|solaris)", "c_src/.c"}]}, {rebar_port_compiler,expand_sources,2}, {rebar_port_compiler,compile,2}, {rebar_core,run_modules,4}, {rebar_core,execute,4}, {rebar_core,process_dir,4}, {rebar_core,process_each,5}, {rebar_core,process_dir,4}]}}make: *\ [compile] Error 1

$> cat deps/ejson/rebar.config {port_sources, [{"R14.+-.(darwin|linux|solaris)", "c_src/.c"}, {"R14.+-.(darwin|linux|solaris)", "c_src/yajl/.c"}]}. {so_name, "ejson.so"}.

{port_envs, [ %% Make sure to link -lstdc++ on linux or solaris {"(linux|solaris)", "LDFLAGS", "$LDFLAGS -lstdc++"}

]}.

andrewtj commented 13 years ago

I would suspect that the version of rebar being used predates the addition of that rebar.config option. Unfortunately there is no versioning of rebar so I can't nominate the release this feature was added.

benoitc commented 13 years ago

On Tue, May 3, 2011 at 4:13 AM, andrewtj reply@reply.github.com wrote:

Erlang R14B or later is needed to build ejson's NIF. You have R13B03 by the looks of that erts version.

Fix would be to replace:

{port_sources, ["c_src/*.c", "c_src/yajl/*.c"]}.

With:

{port_sources, [{"R14.+-.*(darwin|linux|solaris)", "c_src/*.c"},
               {"R14.+-.*(darwin|linux|solaris)", "c_src/yajl/*.c"}]}.

In ejson's rebar.config.

Reply to this email directly or view it on GitHub: https://github.com/benoitc/couchbeam/issues/49#comment_1091734

It looks like ejson hve been updated to support erlang rb013. I will port latest changes today, but couchbeam should definitely works on r13b03 :)

  • benoît
abhinavsingh commented 13 years ago

Thanks Benoitc, looking forward for the same.

benoitc commented 13 years ago

fixed in bee8109daf1af4e9d456b34fce815298431f4140 . Thanks to @andrewjt for the tip. I fixed build on ejson, also clean the sources. You need to clean all deps for retry since the ejson repo has been completly renewed.

sharp commented 12 years ago

Dear benoitc sir, got the same error in couchbeam-0.7.1 :(

sharp commented 12 years ago

This is my rebar config

{deps, [
      {pkt, ".*", {git, "git://github.com/msantos/pkt.git", "master"}},
      {ibrowse, "2.1.3", {git, "git://github.com/cmullaparthi/ibrowse.git", {tag, "v2.1.3"}}},
      {couchbeam, "0.7.1", {git, "git://github.com/benoitc/couchbeam.git", {tag, "0.7.1"}}}
    ]}.
benoitc commented 12 years ago

are you using last rebar ?

sharp commented 12 years ago

Thanks! it works with new version rebar