compiling Opensips on Clion: missing tap.h, which library is missing? - cmake

I am trying to compile Opensips on Clion as I want to debug and step through the code. I have tried adding environment variables through following lines in CMakeLists.txt:
set(CMAKE_C_FLAGS "-funroll-loops -Wcast-align -Wall -minline-all-stringops -falign-loops -ftree-vectorize -mtune=nocona -Wold-style-definition -Wmissing-field-initializers -Wredundant-decls" )
add_definitions(-DPKG_MALLOC -DSHM_MMAP -DUSE_MCAST -DDISABLE_NAGLE -DSTATISTICS -DHAVE_RESOLV_RES -DF_MALLOC -DF_MALLOC_OPTIMIZATIONS -DNAME='"opensips"' -DVERSION='"2.4.2"' -DARCH='"x86_64"' -DOS='"linux"' -DCOMPILER='"gcc 4.8.5"' -D__CPU_x86_64 -D__OS_linux -D__SMP_yes -DCFG_DIR='"/usr/local//etc/opensips/"' -DVERSIONTYPE='"git"' -DTHISREVISION='"c035556"' -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_EPOLL -DHAVE_SIGIO_RT -DHAVE_SELECT)
===========================================================
I get following errors and I am not sure which package is missing:
-- Build files have been written to: /root/opensips-2.4/cmake-build-debug
[ 0%] Building C object CMakeFiles/opensips_2_4.dir/cachedb/test/test_backends.c.o
[ 0%] Building C object CMakeFiles/opensips_2_4.dir/cachedb/example/example_cachedb.c.o
/root/opensips-2.4/cachedb/test/test_backends.c:21:17: fatal error: tap.h: No such file or directory
include
^
compilation terminated.
gmake[2]: * [CMakeFiles/opensips_2_4.dir/cachedb/test/test_backends.c.o] Error 1
gmake[2]: * Waiting for unfinished jobs....
/root/opensips-2.4/cachedb/example/example_cachedb.c:75:2: warning: character constant too long for its type [enabled by default]
MODULE_VERSION,
^
/root/opensips-2.4/cachedb/example/example_cachedb.c:75:2: warning: initialization makes pointer from integer without a cast [enabled by default]
/root/opensips-2.4/cachedb/example/example_cachedb.c:75:2: warning: (near initialization for ‘exports.version’) [enabled by default]
In file included from /root/opensips-2.4/cachedb/example/../../sr_module.h:52:0,
from /root/opensips-2.4/cachedb/example/example_cachedb.c:32:
/root/opensips-2.4/cachedb/example/../../version.h:26:37: error: expected ‘}’ before string constant
define OPENSIPS_FULL_VERSION NAME " " VERSION " (" ARCH "/" OS ")"
^
/root/opensips-2.4/cachedb/example/../../sr_module.h:102:2: note: in expansion of macro ‘OPENSIPS_FULL_VERSION’
OPENSIPS_FULL_VERSION,
^
/root/opensips-2.4/cachedb/example/example_cachedb.c:75:2: note: in expansion of macro ‘MODULE_VERSION’
MODULE_VERSION,
^
/root/opensips-2.4/cachedb/example/example_cachedb.c:75:2: warning: character constant too long for its type [enabled by default]
/root/opensips-2.4/cachedb/example/example_cachedb.c:75:2: warning: character constant too long for its type [enabled by default]
/root/opensips-2.4/cachedb/example/example_cachedb.c:75:2: warning: character constant too long for its type [enabled by default]
/root/opensips-2.4/cachedb/example/example_cachedb.c:89:1: warning: missing initializer for field ‘compile_flags’ of ‘struct module_exports’ [-Wmissing-field-initializers]
};
^
In file included from /root/opensips-2.4/cachedb/example/example_cachedb.c:32:0:
/root/opensips-2.4/cachedb/example/../../sr_module.h:175:8: note: ‘compile_flags’ declared here
char compile_flags; /!< compile flags used on the module /
^
/root/opensips-2.4/cachedb/example/example_cachedb.c:95:12: warning: ‘mod_init’ defined but not used [-Wunused-function]
static int mod_init(void)
^
/root/opensips-2.4/cachedb/example/example_cachedb.c:137:12: warning: ‘child_init’ defined but not used [-Wunused-function]
static int child_init(int rank)
^
/root/opensips-2.4/cachedb/example/example_cachedb.c:154:13: warning: ‘destroy’ defined but not used [-Wunused-function]
static void destroy(void)
^
/root/opensips-2.4/cachedb/example/example_cachedb.c:59:21: warning: ‘cmds’ defined but not used [-Wunused-variable]
static cmd_export_t cmds[]=
^
/root/opensips-2.4/cachedb/example/example_cachedb.c:65:23: warning: ‘params’ defined but not used [-Wunused-variable]
static param_export_t params[]={
^
gmake[2]: [CMakeFiles/opensips_2_4.dir/cachedb/example/example_cachedb.c.o] Error 1
gmake[1]: * [CMakeFiles/opensips_2_4.dir/all] Error 2
gmake: *** [all] Error 2

The tap.h error is due to the fact that you have enabled unit-testing support in your build, via the -DUNIT_TESTS flag in Makefile.conf. If you still want to go down this route and run the cachedb-related unit tests for MongoDB/Cassandra:
download libtap, from here
make and sudo make install

Related

Why adding a DPRINTF(XXX debug flag fails with "error:'XXX' was not declared in this scope" in gem5?

I want to know the cache information when the replacement algorithm is executed. So I made the following changes in the latest version of gem5. I added a line of DebugFlag('ReplacementInfo') command to the /home/cuiyujie/workspace/workGem5/gem5/src/mem/cache/replacement_policies/SConscript file. Then I added the header file #include "debug/ReplacementInfo.hh" in the /home/cuiyujie/workspace/workGem5/gem5/build/X86/params/RandomRP.cc file. Then I used DPRINTF(ReplacementInfo, "candidates"); command in this file. But an error occurred during compilation.
build/X86/mem/cache/replacement_policies/random_rp.cc: In member function'virtual ReplaceableEntry* RandomRP::getVictim(const ReplacementCandidates&) const':
build/X86/mem/cache/replacement_policies/random_rp.cc:82:13: error:'ReplacementInfo' was not declared in this scope
DPRINTF(ReplacementInfo, "candidates");
^
build/X86/mem/cache/replacement_policies/random_rp.cc:82:13: note: suggested alternative:
In file included from build/X86/mem/cache/replacement_policies/random_rp.cc:44:0:
build/X86/debug/ReplacementInfo.hh:18:19: note:'Debug::ReplacementInfo'
extern SimpleFlag ReplacementInfo;
^
build/X86/mem/cache/replacement_policies/random_rp.cc:82:42: error:'DPRINTF' was not declared in this scope
DPRINTF(ReplacementInfo, "candidates");
^
scons: *** [build/X86/mem/cache/replacement_policies/random_rp.o] Error 1
scons: building terminated because of errors.
The second error was:
build/X86/mem/cache/replacement_policies/random_rp.cc:82:42: error:'DPRINTF' was not declared in this scope
DPRINTF(ReplacementInfo, "candidates");
which means you also need:
#include "base/trace.hh"
which is where DPRINTF is defined.
Error order is a bit messed up because GCC must be assuming that DPRINTF is a function since it did not see the macro definition, so it tries to evaluate arguments first. But DPRINTF is a macro, and adds the missing Debug:: to Debug::ReplacementInfo, which it complained about on the first error:
#define DPRINTF(x, ...) do { \
using namespace Debug; \
if (M5_UNLIKELY(DTRACE(x))) { \
Trace::getDebugLogger()->dprintf_flag( \
curTick(), name(), #x, __VA_ARGS__); \
} \
} while (0)

Error while installation of Apache httpd 2.4.2 on AIX OS

We are getting below error while running the make command to build Apache files.
We are carrying out the installation on AIX 6.1 OS.
The installation is completed upto the configuration step as per the procedure given in the below link:
http://httpd.apache.org/docs/2.4/install.html
The error is :
util_pcre.c:48:18: error: pcre.h: No such file or directory
util_pcre.c: In function 'ap_regfree':
util_pcre.c:103: error: 'pcre_free' undeclared (first use in this function)
util_pcre.c:103: error: (Each undeclared identifier is reported only once
util_pcre.c:103: error: for each function it appears in.)
util_pcre.c: In function 'ap_regcomp':
util_pcre.c:129: error: 'PCRE_CASELESS' undeclared (first use in this function)
util_pcre.c:131: error: 'PCRE_MULTILINE' undeclared (first use in this function)
util_pcre.c:133: error: 'PCRE_DOTALL' undeclared (first use in this function)
util_pcre.c:136: warning: implicit declaration of function 'pcre_compile'
util_pcre.c:136: warning: assignment makes pointer from integer without a cast
util_pcre.c:142: warning: implicit declaration of function 'pcre_fullinfo'
util_pcre.c:142: error: expected ')' before 'pcre'
util_pcre.c:142: warning: type defaults to 'int' in declaration of 'type name'
util_pcre.c:143: error: 'PCRE_INFO_CAPTURECOUNT' undeclared (first use in this function)
util_pcre.c: In function 'ap_regexec_len':
util_pcre.c:180: error: 'PCRE_NOTBOL' undeclared (first use in this function)
util_pcre.c:182: error: 'PCRE_NOTEOL' undeclared (first use in this function)
util_pcre.c:198: warning: implicit declaration of function 'pcre_exec'
util_pcre.c:198: error: expected ')' before 'pcre'
util_pcre.c:198: warning: type defaults to 'int' in declaration of 'type name'
util_pcre.c:221: error: 'PCRE_ERROR_NOMATCH' undeclared (first use in this function)
util_pcre.c:223: error: 'PCRE_ERROR_NULL' undeclared (first use in this function)
util_pcre.c:225: error: 'PCRE_ERROR_BADOPTION' undeclared (first use in this function)
util_pcre.c:227: error: 'PCRE_ERROR_BADMAGIC' undeclared (first use in this function)
util_pcre.c:229: error: 'PCRE_ERROR_UNKNOWN_NODE' undeclared (first use in this function)
util_pcre.c:231: error: 'PCRE_ERROR_NOMEMORY' undeclared (first use in this function)
make: 1254-004 The error code from the last command is 1.
Stop.
make: 1254-004 The error code from the last command is 1.
We have also installed the below version GCC compiler for AIX 6.1:-
libgcc-4.2.0-3.aix6.1.ppc.rpm
libstdcplusplus-4.2.0-3.aix6.1.ppc.rpm
libstdcplusplus-devel-4.2.0-3.aix6.1.ppc.rpm
gcc-cplusplus-4.2.0-3.aix6.1.ppc.rpm
Kindly suggest as to what is missing here that is causing the error.

How to install mod_perl 2.0.10 in Apache 2.4 on OS X El Capitan?

Build problems with a completely new install of mod_perl. Here are the versions of my software.
OS X El Capitan 10.11. Recently upgraded from OS X Yosemite 10.10.
Xcode 7.1. Apache 2.4.16. This is the Apache version that was included with 10.11
mod_perl 2.0.10. Downloaded from SVN.
chrisbtoo's answer to how-to-install-mod-perl-2-0-9-in-apache-2-4-on-os-x-yosemite allowed the build to begin. make fails like this
-c modperl_util.c && mv modperl_util.o modperl_util.lo modperl_util.c:636:20: warning: format specifies type 'int' but the
argument has type 'apr_size_t'
(aka 'unsigned long') [-Wformat]
size, (apr_size_t)r->finfo.size, r->filename);
^~~~ modperl_util.c:636:26: warning: format specifies type 'int' but the argument has type 'apr_size_t'
(aka 'unsigned long') [-Wformat]
size, (apr_size_t)r->finfo.size, r->filename);
^~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. modperl_util.c:636:20: warning: format specifies type 'int'
but the argument has type 'apr_size_t'
(aka 'unsigned long') [-Wformat]
size, (apr_size_t)r->finfo.size, r->filename);
^~~~ modperl_util.c:636:26: warning: format specifies type 'int' but the argument has type 'apr_size_t'
(aka 'unsigned long') [-Wformat]
size, (apr_size_t)r->finfo.size, r->filename);
^~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated.
then again
-c modperl_common_util.c && mv modperl_common_util.o modperl_common_util.lo modperl_common_util.c:57:53: warning:
incompatible pointer types initializing 'int
(*)(PerlInterpreter *, SV *, MAGIC *, SV *, const char *, I32)' with an expression of type
'int (PerlInterpreter *, SV *, MAGIC *, SV *, const char *, int)'
[-Wincompatible-pointer-types]
modperl_table_magic_copy};
^~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated.
then 68 duplicate symbol messages like this brief sample:
duplicate symbol _MP_vtbl_env in:
mod_perl.lo
modperl_interp.lo
duplicate symbol _MP_vtbl_envelem in:
mod_perl.lo
modperl_interp.lo
Here are the final error messages.
make1: * [mod_perl.so] Error 1 make: * [modperl_lib] Error 2
Does this seem like anything in the environment that I might fix?
What worked for me was checking out codes from one of the tagged branches instead of checking out direct from the trunk.
The tagged branch I used: https://svn.apache.org/repos/asf/perl/modperl/tags/2_0_9/
so the first step then becomes:
svn checkout https://svn.apache.org/repos/asf/perl/modperl/tags/2_0_9/ mod_perl-2.0
So just replace this step and then follow the rest of the steps in the link you used (ie How to install mod_perl 2.0.9 in Apache 2.4 on OS X Yosemite?).

How to compile libgit2 without HTTPS

I'm trying to compile a no or limited libgit2 static build but haven't yet succeeded into compiling it without openssl.
So far, my best attempt has been following this suite of commands:
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ -DBUILD_SHARED_LIBS=OFF -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=TRUE
make
But I obtain the following:
[ 11%] Building C object CMakeFiles/git2.dir/src/openssl_stream.c.o
/Users/raphael/src/github.com/libgit2/libgit2/src/openssl_stream.c:369:41: warning: unused parameter 'out' [-Wunused-parameter]
int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
^
/Users/raphael/src/github.com/libgit2/libgit2/src/openssl_stream.c:369:58: warning: unused parameter 'host' [-Wunused-parameter]
int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
^
/Users/raphael/src/github.com/libgit2/libgit2/src/openssl_stream.c:369:76: warning: unused parameter 'port' [-Wunused-parameter]
int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
Then:
[ 23%] Building C object CMakeFiles/git2.dir/src/hash/hash_generic.c.o
In file included from /Users/raphael/src/github.com/libgit2/libgit2/src/hash/hash_generic.c:10:
/Users/raphael/src/github.com/libgit2/libgit2/src/hash/hash_generic.h:13:8: error: redefinition of 'git_hash_ctx'
struct git_hash_ctx {
^
/Users/raphael/src/github.com/libgit2/libgit2/src/hash/hash_common_crypto.h:15:8: note: previous definition is here
struct git_hash_ctx {
^
And many others obviously following.
Environment details:
I'm on MacOS X Yosemite, using either Clang or GCC 4.9 and I'm building statically, I tried with tag v0.22.1 and master from Jan 24, 2015.
I'm looking for a process that would be portable to Linux / FreeBSD as well.
The warnings about the openssl stream are irrelevant; the constructor simply returns an error, so it doesn't use any of the parameters passed. It'd be nice to clean the up, but they don't do anything.
As for the redefinition issue, you can find a workaround in PR 2820.

Error when Make CLucene

I'm using a MBP OSX(10.9) and is new to CLucene and I'm having problem installing it. Despite following the installation guide closely, I still hit these errors while making the file
[ 0%] Building CXX object src/shared/CMakeFiles/clucene-shared.dir/CLucene/SharedHeader.o
In file included from /Users/youhock/Downloads/clucene-core-2.3.3.4/src/shared/CLucene/SharedHeader.cpp:8:
In file included from /Users/youhock/Downloads/clucene-core-2.3.3.4/src/shared/CLucene/_SharedHeader.h:13:
In file included from /Users/youhock/Downloads/clucene-core-2.3.3.4/src/shared/CLucene/SharedHeader.h:201:
In file included from /Users/youhock/Downloads/clucene-core-2.3.3.4/src/core/CLucene/debug/lucenebase.h:10:
/Users/youhock/Downloads/clucene-core-2.3.3.4/src/shared/CLucene/LuceneThreads.h:56:19: error:
unknown type name 'pthread_t'
static _LUCENE_THREADID_TYPE _GetCurrentThreadId();
^
/Users/youhock/Downloads/clucene-core-2.3.3.4/src/shared/CLucene/LuceneThreads.h:40:41: note:
expanded from macro '_LUCENE_THREADID_TYPE'
#define _LUCENE_THREADID_TYPE pthread_t
^
/Users/youhock/Downloads/clucene-core-2.3.3.4/src/shared/CLucene/LuceneThreads.h:57:18: error:
unknown type name 'pthread_t'
static _LUCENE_THREADID_TYPE CreateThread(lucene...
^
/Users/youhock/Downloads/clucene-core-2.3.3.4/src/shared/CLucene/LuceneThreads.h:40:41: note:
expanded from macro '_LUCENE_THREADID_TYPE'
#define _LUCENE_THREADID_TYPE pthread_t
^
/Users/youhock/Downloads/clucene-core-2.3.3.4/src/shared/CLucene/LuceneThreads.h:58:34: error:
unknown type name 'pthread_t'
static void JoinThread(_LUCENE_THREADID_TYPE id);
^
/Users/youhock/Downloads/clucene-core-2.3.3.4/src/shared/CLucene/LuceneThreads.h:40:41: note:
expanded from macro '_LUCENE_THREADID_TYPE'
#define _LUCENE_THREADID_TYPE pthread_t
^
3 errors generated.
make[2]: *** [src/shared/CMakeFiles/clucene-shared.dir/CLucene/SharedHeader.o] Error 1
make[1]: *** [src/shared/CMakeFiles/clucene-shared.dir/all] Error 2
make: *** [all] Error 2
Appreciate if anyone could help me with this? Thanks in advance
Have a look at my other answer.
Bascially you have to patch
src/shared/CLucene/LuceneThreads.h
src/shared/CLucene/config/repl_tchar.h
The other post contains the links as well.