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

Failing to compile #10

Open
elado opened this issue Oct 27, 2012 · 3 comments
Open

Failing to compile #10

elado opened this issue Oct 27, 2012 · 3 comments

Comments

@elado
Copy link

elado commented Oct 27, 2012

(New at this so I might be doing something wrong)

Installed erlang on my mac (w/ brew), downloaded the ejabberd source from github and put it at the same level of mod_restful.

Under mod_restful dir, I typed "make" to run the Makefile, and got this:

$  make
erlc -pa ./ebin -I ./include -I ../ejabberd/src -pa ../ejabberd/src -o ./ebin src/gen_restful_api.erl
src/gen_restful_api.erl:76: variable 'Host' is unbound
src/gen_restful_api.erl:76: variable 'User' is unbound
src/gen_restful_api.erl:76: record jid undefined
make: *** [ebin/gen_restful_api.beam] Error 1

all paths seem valid.

What am I doing wrong?
Is it possible to just put the .beam file and activate the mod in the .cfg or does it require more?

@jadahl
Copy link
Owner

jadahl commented Oct 27, 2012

Could it be that you are using the master branch? You need to use one of the 2.1.x versions or the 2.1.x branch. At least that's the only one I've tested with.

@elado
Copy link
Author

elado commented Oct 27, 2012

Yes, that worked, thanks!

I'm having another problem with configuration:

  1. I took the ebin/*.beam files into ejabberd-2.1.11/lib/ejabberd-2.1.11/ebin folder.
  2. Put this under listen:
  {{8088, {127, 0, 0, 1}}, ejabberd_http,
   [{request_handlers, [{["api"], mod_restful}]}]}

and this under modules:

   {mod_restful, [
    {api,
     [
      {["admin"], mod_restful_admin, [
       {key, "secret"},
       {allowed_commands, [register, unregister]}
      ]},
      {["register"], mod_restful_register, [{key, "secret"}]}
     ]}
   ]}

and ran

✗ ./ejabberdctl live

and got

Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:true]

Eshell V5.8.5  (abort with ^G)
(ejabberd@localhost)1> 
=ERROR REPORT==== 27-Oct-2012::11:34:56 ===
Loading of /usr/local/ejabberd-2.1.11/lib/ejabberd-2.1.11/ebin/mod_restful.beam failed: badfile

=ERROR REPORT==== 27-Oct-2012::11:34:56 ===
beam/beam_load.c(1365): Error loading module mod_restful:
  use of opcode 153; this emulator supports only up to 152


=ERROR REPORT==== 27-Oct-2012::11:34:56 ===
C(<0.41.0>:gen_mod:75) : Problem starting the module mod_restful for host "jabber.local" 
 options: [{api,[{["admin"],
                  mod_restful_admin,
                  [{key,"secret"},{allowed_commands,[register,unregister]}]},
                 {["register"],mod_restful_register,[{key,"secret"}]}]}]
 error: undef

=ERROR REPORT==== 27-Oct-2012::11:34:56 ===
C(<0.41.0>:gen_mod:80) : ejabberd initialization was aborted because a module start failed.

Crash dump was written to: /usr/local/ejabberd-2.1.11/logs/erl_crash_20121027-113455.dump
Problem starting the module mod_restful for host "jabber.local" 
 options: [{api,[{["admin"],
                  mod_restful_admin,
                  [{key,"secret"},{allowed_commands,[register,unregi

What am I missing? How should the {api, [APISpec]} look on the cfg file?

Thanks!

@jadahl
Copy link
Owner

jadahl commented Oct 27, 2012

It looks like you are building mod_restful with compiler from a newer version of OTP than you load ejabberd with:

=ERROR REPORT==== 27-Oct-2012::11:34:56 ===
beam/beam_load.c(1365): Error loading module mod_restful:
use of opcode 153; this emulator supports only up to 152

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

2 participants