I have downloaded ejabberd and even done a :
sudo port install ejabberd
After this, I am trying to install the ejabberd-websocket module from here : https://github.com/superfeedr/ejabberd-websockets
However, try as I might I am not able to install it by issuing :
./build.sh
This is the error that I am getting :
Recompile: src/mod_websocket
src/mod_websocket.erl:22: can't find include file "ejabberd.hrl"
src/mod_websocket.erl:23: can't find include file "jlib.hrl"
src/mod_websocket.erl:36: undefined macro 'DEBUG/2'
src/mod_websocket.erl:16: function process/2 undefined
src/mod_websocket.erl:14: Warning: behaviour gen_mod undefined
src/mod_websocket.erl:95: Warning: function validate_origin/1 is unused
src/mod_websocket.erl:171: Warning: function build_stream_end/0 is unused
I even have erlang as I installed it via macports. However, I am not able to install the module.
I am using Mac OSX Mountain Lion.
Any help would be great.
I can help you get around some of your issues. At least in my case, ejabber installed into a different location than this project expects. If you open Emakefile you will see it tries to include /usr/lib/ejabber/include, but in my case I had to remove the /usr part so it is just /lib/ejabberd/include. It may not be exactly the same in your case, but you just need to find your ejabber installation and make sure those directory paths match.
My Emakefile for reference
{'src/mod_websocket', [{outdir, "ebin"},{i,"/lib/ejabberd/include"},{i,"/lib/ejabberd/include/web","src"}]}.
{'src/ejabberd_xmpp_websocket', [{outdir, "ebin"},{i,"/lib/ejabberd/include"},{i,"/lib/ejabberd/include/web","src"}]}.
{'src/ejabberd_websocket', [{outdir, "ebin"},{i,"/lib/ejabberd/include"},{i,"/lib/ejabberd/include/web","src"}]}.
I also had to modify the build.sh script, but I don't think it solved any of my problems
#!/bin/sh
erl -pa /lib/ejabberd /lib/ejabberd/include /lib/ejabberd/ebin -pz ebin -make
Related
When writing luarocks install gumbo
In the location/directory of my luarocks file in cmd, I am getting the following error
Warning: Could not find Lua 5.3 in PATH.
Modules may not install with the correct configurations. You may want to specify the path prefix to your build of Lua 5.3 using --lua-dir
Installing https://luarocks.org/gumbo-0.5-1.src.rock
Error: Failed finding Lua library. You may need to configure LUA_LIBDIR.
I've added lua53.exe to the same directory, and added the file both to my user variables and system variables in control panel.
Not sure if worth mentioning, but when running lua53.exe and trying to use luarocks install gumbo from there,
the lua53 cmd-like window responds with stdin:1: syntax error near 'install'
I was hoping to do some web scraping with lua, and later on building a World of Warcraft addon that utilizes gumbo to show certain helpful information within the WoW client, but I can't seem to even get the most basic stuff to work...
Setting up LuaRocks on Windows is annoying and I'm not familiar with it myself. If you added both the LuaRocks and Lua 5.3 Windows binaries (Executables and Includes) to your Path system variable:
luarocks path prints the commands for setting up the LUA_PATH and LUA_CPATH system variables.
The config.lua file tells you what your variables.LUA_LIBDIR value is. You can check it with luarocks config. For me that file would be in:
C:/Users/Ketho/AppData/Roaming/luarocks/config-5.3.lua
otherwise you can create an empty file there and put in this line to point it to wherever your Lua folder is:
variables.LUA_LIBDIR = "C:/lua-5.3.5_Win32_bin"
variables.LUA_INCDIR = "C:/lua-5.3.5_Win32_bin/include"
As for using gumbo to show information within WoW, the addon environment is sandboxed. Unless you meant you just want to get the data to hardcode into your addon.
I'm trying to install a redis client for Lua5.1, any client will do.
I installed redis-lua(https://github.com/nrk/redis-lua)
and
LuaSocket(http://w3.impa.br/~diego/software/luasocket/),
But when I try to get a "redis.connect" in my lua script, it says "could not find module "socket.core" .
And I find that there is no core.lua under /usr/local/share/lua/5.1/socket directory, how should I solve this?
p.s. I'v tried many redis clients for lua, and because I'm not familia with lua and luarocks, non of them works, always missing some dependencies that I cannot find, or got error when compiling with gcc.
I am new to Erlang, I have been trying to install Erlang and ejabberd on EC2 ubuntu machine, everything went well till I started compiling some external modules in ejabberd. It started throwing error undefined parse transform 'lager_transform'.
I tried everything which is as below:
Did rebar get-deps, make clean, make deps, make install. After this I am able to see that lager_transform.beam is made and present in /lib/ folder.
Checked rebar.config file, it had lager deps on top, which is widely suggested, no help even after that.
Added -compile[{parse_tranform},{lager_transform}] on top of module, even then their is no luck.
I am really blocked on this, and not able to complete the installation. I have done this before on fedora with ejabberd 15.11 and otp 18.2, at that time it was using p1_logger instead of lager. But now when I am installing fresh with otp 18.2 and ejabberd 16.0 or 15.11, I am getting lager_transform undefined error.
Please make sure you compile ejabberd as described in documentation: http://docs.ejabberd.im/admin/guide/installation/#installing-ejabberd-from-source-code
For example, you can compile it with:
./configure --enable-lager --enable-mysql
make
You need to run configure and make to set properly the build chain.
Compiled and installed ejabberd version 15.10 on ubuntu 14.04 machine in /opt/ejabberd directory.
In the older version the module can be compiled directly with erlc command and then pasted to ejabberd module dir(or symbolic linked) which was very efficent way to develop the modules.
But after upgrading to newer ejabberd version when using the INFO_MSG()/2 from logger.hrl the ejabberd fails to load the module.
When compiled by placing the module file inside the ejabberd src directory and running make in ejabberd directory as suggested at https://www.ejabberd.im/ejabberd-13.10 and ejabberd how to compile new module the module works.
But this is very inefficient compared to the older method of compiling and running the modules with elrc command directly.
Is the latter approach the right method, if so why was it changed and where are the official docs that explain compiling with latter approach.
you can compile ejabberd module like this
erlc -I /lib/ejabberd/include -o /lib/ejabberd/ebin /home/sunil/Documents/ejabberd_custom_modules/mod_profile.erl
In this example /lib/ejabberd/include is header file (.hrl) path , /lib/ejabberd/ebin* is binary file path of ejabberd and '/home/sunil/Documents/ejabberd_custom_modules/mod_profile.erl is source file path.
Right way to compile your custom ejabberd module (suggested by process-one) is :-
put your module into ejabberd/src folder.
come to ejabberd directory in terminal and run command $ sudo make
it will show you that your module is compiled. You can check ebin directory for .beam file that is result of your compilation.
Now to run your module
$ sudo make install
Add your module into config file at /etc/ejabberd/ejabberd.yml
restart your ejabberd and your custom module will be running.
Another way of compiling with erlang shell is :-
start your erlang to load all included files required by ejabberd module from ebin directory.
> erl -pa <your path to ejabberd/ebin>
You can also give multiple paths separated by space if you are including files from multiple places. Like
> erl -pa <path1/ebin> <path2/ebin>
This will start erlang shell. Next things you need to do are :-
do
> cd("<path to your module.erl file>").
compile your module
> c(your module).
Your module.beam file will be generated as a result of your compilation.
I am trying to require a module I downloaded using luarocks using
require "lualogging"
but lua (and I!) cannot find where this module was downloaded to. Here is what I did
I have used apt-get to install luarocks, and then I ran
sudo luarocks install lualogging
I then ran
luarocks list
and received the following output
Installed rocks:
lualogging
1.3.0-1 (installed) - /usr/local/lib/luarocks/rocks
luasocket
3.0rc1-1 (installed) - /usr/local/lib/luarocks/rocks
Natural this led me to believe that lualogging was located in /usr/local/lib/luarocks/rocks, but running this command
find /usr/local/lib/luarocks/rocks "lualogging.lua"
returned nothing. What am I doing wrong here? This may be related, but I cannot find what my LUA_PATH environment variable is so it may be that it was never set? I'd like to be able to run require "lualogging" from any file regardless of where it is located in the filesystem, and then log to my heart's content. But I can't even find where lualogging.lua exists...
Run luarocks show lualogging. It will list all modules and where they are.
It should be
require "logging"
not
require "lualogging"