ejabberd module compilation error - windows

I am new to ejabberd, trying to add new module for offline_message_posturl, on a Windows server. I couldn't find any blog post specifically for Windows other than the below. I am using ejabberd version 15.07.
I have been following this blog post:
http://jasonrowe.com/2011/12/30/ejabberd-offline-messages/
Right now I am not able to create a .beam file from the module file. I get this error:
> c(mod_http_offline).
mod_http_offline.erl:21: undefined macro 'INFO_MSG/2'
mod_http_offline.erl:27: undefined macro 'INFO_MSG/2'
mod_http_offline.erl:44: undefined macro 'INFO_MSG/2'
mod_http_offline.erl:11: function start/2 undefined
mod_http_offline.erl:11: function stop/1 undefined
mod_http_offline.erl:38: function post_offline_message/3 undefined
error
How can I fix this error?

The INFO_MSG macro used to be defined in the header file ejabberd.hrl, but it was moved to logger.hrl in ejabberd 13.06, which was released after that blog post was written. Include logger.hrl as well as ejabberd.hrl, and your file should compile:
-include("ejabberd.hrl").
-include("logger.hrl").

You are not pointing to ejabberd include .hrl file. Simplest approach is probably to add you module to ejabberd src directory and recompile everything.
Otherwise, you can compile your module with erlc using -I to point to ejabberd include dirs (use as many -I directive as needed). For example:
erlc -I ../ejabberd/include mod_http_offline.erl

Related

Writing .cargo/config.toml to allow rust code to be imported by python

I'm using rust-cpython to make a python module in rust. I've run my code on a linux os and it runs just fine but I get the familiar "linking with cc failed:exit code 1 error". I've gathered from this that I need to add the .cargo/config file to my project as suggested at the bottom of this:
https://github.com/dgrunwald/rust-cpython
I've copied and pasted their code into a file, config.toml, and place there in a directory, .cargo. I've tried nesting this in my src directory and my project directory with no success, what am I missing?
Solution found: Thought I'd post it as this gave me grief.
Everything with this setup is fine except the config file can't have the extension .toml despite being written in a toml format

How to link .cma files to my own Frama_C plugin?

I created my own Frama-C plugin by following the instructions of the Frama-C Development Guide (https://frama-c.com/download/frama-c-plugin-development-guide.pdf).
However, I need to use the Mutex module provided by the Ocaml manual (http://caml.inria.fr/pub/docs/manual-ocaml/libref/Mutex.html) in my .ml files. To use this module, I need a particular command line:
ocamlc -thread unix.cma threads.cma myfiles.ml
(as explained here: OCaml Mutex module cannot be found).
To compile my files I use the Makefile that builds the plugin (Plugin Development Guide page 33). So I'm trying to link these .cma files and the -thread option to this Makefile...and I did not succeed. How can I load this Mutex module?
What I tried:
I looked in the file automatically generated by Frama-C: .Makefile.plugin.generated if there was a variable to call and modify in my Makefile (the same kind as the variable PLUGIN_CMO to call my .ml files) but I did not find such a variable.
I tried with some variables that are defined in the generated .Makefile.plugin.generated this way:
I wrote the following lines in my Makefile:
PLUBIN_EXTRA_BYTE = unix.cma threads.cma
or TARGET_TOP_CMA = unix.cma threads.cma
and for the thread option:
PLUGIN_OFLAGS = -thread
or PLUGIN_LINK_BFLAGS= -thread
or PLUGIN_BFLAGS= -thread
But never was the Mutex module recognized and I don't know exactly if it is a good solution...
Finally, I tested using the Olddynlink module provided by Frama-C (http://arvidj.eu/frama/frama-c-Aluminium-20160501_api/frama-c-api/html/FCDynlink.OldDynlink.html#VALloadfile) with the value loadfile or using the Dynlink module (http://caml.inria.fr/pub/docs/manual-ocaml/libref/Dynlink.html#VALloadfile) and his value loadfile, but it did not work either:
I wrote:
open Dynlink
loadfile "unix.cma";;
loadfile "threads.cma";;
in the .ml file concerned.
But always the same error: Unbound module Mutex.
Section 5.2.3 of the plugin development guide gives the list of variables that can be used to customize the Makefile. Notably, if you want to link against an external library, you can use PLUGIN_EXTRA_BYTE and PLUGIN_EXTRA_OPT, as well as PLUGIN_LINK_BFLAGS and PLUGIN_LINK_OFLAGS to add the -thread option. Here is a Makefile that should work (of course, you need to complete it depending on your actual source files).
ifndef FRAMAC_SHARE
FRAMAC_SHARE:=$(shell frama-c-config -print-share-path)
endif
PLUGIN_NAME:=Test_mutex
PLUGIN_BFLAGS:=-thread
PLUGIN_OFLAGS:=-thread
PLUGIN_EXTRA_BYTE:=$(shell ocamlfind query threads)/threads/threads.cma
PLUGIN_EXTRA_OPT:=$(shell ocamlfind query threads)/threads/threads.cmxa
PLUGIN_LINK_BFLAGS:=-thread
PLUGIN_LINK_OFLAGS:=-thread
PLUGIN_CMO:= # list of modules of the plugin
include $(FRAMAC_SHARE)/Makefile.dynamic
Note that in theory, you should only have to use the PLUGIN_REQUIRES variable, and let ocamlfind take care of everything but threads seems to be a bit peculiar in this respect.

Undefined reference for a specific library: FastNoiseSIMD

I'm new to C++ and I'm trying to include a header file from this library, https://github.com/Auburns/FastNoiseSIMD
When I write this line, FastNoiseSIMD* myNoise = FastNoiseSIMD::NewFastNoiseSIMD(); I get the error: main.cpp:36: undefined reference to FastNoiseSIMD::NewFastNoiseSIMD(int)
Here is how I'm including the header:
#include "FastNoiseSIMD/FastNoiseSIMD/FastNoiseSIMD.h"
As you can see, the files are in folders that are located in the working directory of my program. I'm working on Linux using c++11 and g++. I don't see any library files that I need to link so I'm stuck here.
Any help is greatly appreciated. Thank you.
Check this undefined-reference-to-pow-and-floor

Adding and compiling new code in the linux kernel

This may sound like a very noob question.
I'm trying to implement a UDP-based protocol in the linux kernel. I was following the UDPLite protocol implementation as a reference.
Step 1
I created a new_protocol.c in net/ipv4/
This file has a function
void _init protocol_init(void){*Code here*}
I also used
#include "udp_impl.h"
in this file as I was using some functions from the UDP protocol
Step 2
I modified the file net/ipv4/udp_impl.h to include net/new_protocol.h
Step 3
I created the file include/net/new_protocol.h where I defined the function
void protocol_init(void);
Step 4
Finally, I called the function in net/ipv4/af_inet.c. Also, I gave an include statement in this file for net/new_protocol.h
Now when I try to build the kernel, I get an error saying
undefined reference to `protocol_init()'
What am I missing here? Is my way of including header files incorrect? Do I need to include some info in the makefile to pick up the new net/ipv4/protocol.c?
Do I need to include some info in the makefile to pick up the new net/ipv4/protocol.c?
Yes, you need. Kernel build system doesn't autodetect source files, all of them should be listed explicitely in appropriate Makefile. In you case you need to modify net/ipv4/Makefile.
Makefiles used for kernel build are described in file Documentation/kbuild/makefiles.txt.
I just needed to add protocol.o in the makefile in net/ipv4/

phpdoc web interface: Undefined offset: 1 in <PHPDOCDIR>\src\phpDocumentor\Console\Input\ArgvInput.php

I've installed phpdoc using the installer.php file, and when I open phpdoc.php from wamp (localhost/phpDocumentor/bin/phpdoc.php) I get this error:
Notice: Undefined offset: 1 in D:\Tools\Programming\WebsiteBuilding\WAMP\wamp2.2e\www\phpDocumentor\src\phpDocumentor\Console\Input\ArgvInput.php on line 52
I set register argc argv to true in my WAMP php - settings, but I still get this.
What am I doing wrong?
Snapshot of the error:
PHPDoc is intended for command line usage. The error you get means that you didn't provide an argument. This means you can't call PHPDoc via webserver, you can only view the generated docs.
A typical call to phpdoc under Windows looks like that (on the command line):
phpdoc.bat -d src -t docs
Where src is the directory that your sources are and docs the directory where the documentation should be generated.
For more instructions see the PHPDoc installer documentation.

Resources