RSPlib Discussions

Text archives Help


Re: [RSPlib-Discusssion] Having trouble compiling applications


Chronological Thread 
  • From: Martin Kirch Dige <mdige AT es.aau.dk>
  • To: rsplib-discussion AT sctp.de
  • Subject: Re: [RSPlib-Discusssion] Having trouble compiling applications
  • Date: Fri, 13 Mar 2009 16:43:34 +0100
  • List-archive: <http://lists.franken.de/pipermail/rsplib-discussion>
  • List-id: RSPlib Discussions <rsplib-discussion.sctp.de>

Hi again Thomas

Well I forgot to link the rsplib in with -lrsplib. It does however not solve the errors i see when compiling my apps.
Source code of my application:

#include <rserpool/rserpool.h>
#include <rserpool/rserpool-internals.h>
#include <rserpool/tagitem.h>

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <sys/types.h>
#include <signal.h>

#include "petestserver.h"

void rsp_initinfo(struct rsp_info* info);

void startServer() {
  // get initial structs
  struct rsp_info     rspInfo;
  struct rsp_loadinfo rspLoadInfo; // used for system load etc.
  struct TagItem      rspTags[8]; // used for the taging system
  double              rspDegradation;
  unsigned int        rspIdentifier;
  unsigned int        rspReRegInterval = 30000;
  unsigned int        rspUnTimeLimit  = 0;
  unsigned int        rspService       = 1; // was SERVICE_ECHO
  const char*         rspPoolHandle    = NULL;
  const char*         rspDaemonPIDFile = NULL;
  bool                rspPolicyChanged = false;
  bool                rspQuiet         = false;
  double              rspUptime        = 0.0;
  double              rspDowntime      = 0.0;

  // now set variables before initialising
  rsp_initinfo(&rspInfo);
  rspTags[0].Tag = TAG_PoolElement_Identifier;
  rspTags[0].Data = "0;   // enable CSP monitoring
  rspInfo.ri_csp_identifier = CID_COMPOUND(CID_GROUP_POOLELEMENT, 0);
}

This code produces the following error during compilation:
petestserver.c:42: warning: implicit declaration of function ‘CID_COMPOUND’
petestserver.c:42: error: ‘CID_GROUP_POOLELEMENT’ undeclared (first use in this function)
petestserver.c:42: error: (Each undeclared identifier is reported only once

This error I was able to circumvent by copying componentstatuspackets.h and tdtypes.h from source into /usr/local/include/rserpool and adding #include <rserpool/componentstatuspackets.h> in my .c file.
Having done this i arrive at the real error which I don't seem to understand:

petestserver.c: In function ‘startServer’:
petestserver.c:35: warning: unused variable ‘rspDowntime’
petestserver.c:34: warning: unused variable ‘rspUptime’
petestserver.c:33: warning: unused variable ‘rspQuiet’
petestserver.c:32: warning: unused variable ‘rspPolicyChanged’
petestserver.c:31: warning: unused variable ‘rspDaemonPIDFile’
petestserver.c:30: warning: unused variable ‘rspPoolHandle’
petestserver.c:29: warning: unused variable ‘rspService’
petestserver.c:28: warning: unused variable ‘rspUnTimeLimit’
petestserver.c:27: warning: unused variable ‘rspReRegInterval’
petestserver.c:26: warning: unused variable ‘rspIdentifier’
petestserver.c:25: warning: unused variable ‘rspDegradation’
petestserver.c:23: warning: unused variable ‘rspLoadInfo’
/tmp/cc6n41Ek.o: In function `startServer':
petestserver.c:(.text+0x45): undefined reference to `rsp_initinfo'
collect2: ld returned 1 exit status

It is the undefined reference to rsp_initinfo error. (nevermind the unused variable messages) This still occurs although compiled with the following command:
gcc -lrsplib -Wall -o petestserver main.c petestserver.c

What am I doing wrong?

One more thing. Was its the rsp_info struct actually used for ?

Once again - thanks for helping me out.

Best regards

Martin, Aalborg University, Denmark

Thomas Dreibholz skrev:
Dear Martin,

see my comments inline.


On Freitag 13 März 2009, Martin Kirch Dige wrote:
  
Hi everyone

I am having some troubles using RSPlib for a VoIP project. I have only
recently started using RSPlib and is so far having troubles when
compiling applications which utilises RSPlib.

OS: Debian
RSPlib: v.2.6.0  (using kernel-sctp)

I have installed RSPlib without problems. It was configured with the
following options:
./configure --enable-qt --disable-hsmgtveridy --disable-maintainer-mode
--enable-shared --disable-static --enable-csp
followed by
make
make install (as root)
which copied various  header files has been  placed in
/usr/local/include/rserpool/ during make install.

The troubles arises when I try to develop my own applications which
utilises RSPlib. These applications are not positioned where the rsplib
files were extracted during the installation since I prefer having these
application located separately.
My applications include "rserpool.h", "rserpool-internals.h" etc. and
they are based on the sample applications (e.g. server) which was
supplied with rsplib 2.6.0. Now for the actual questions:

1. I receive this error when compiling my application:
undefined reference to `rsp_initinfo'

The app includes rserpool.h which defines

void rsp_initinfo(struct rsp_info* info);

however it seems that the function is never defined. Have been browsing
the source code and can see that the function is defined in
rsputilities.c in the rsplib source files. There is however no
rsputilities.h header file in /usr/local/include/rserpool/. Is this due
to en error or am I simply not using rsplib correctly?
I have read through the /High Availability using Reliable Server
Pooling/ paper as suggested elsewhere on the mailing list - but I still
find it a bit difficult to understand the RSPlib API, since there
documentation as a bit limited.
    
rsp_initinfo() is defined in rsputilities.c, which is compiled into the rsplib 
library. Including "rserpool.h" and linkling -lrsplib should work. Could you 
provide us the complete errors and warnings of the compile run?


  
2. All need to design both a PE and PU applications. Which examples from
the rsplib source files would you recommend as the best examples of how
to develop a PE and a PU application?
    
For the PE, have a look at server.cc. It is a starter for different services 
(e.g. Echo or Discard - the are implemented in standardservices.cc). To make 
programming of these example services easier, I wrote two C++ API wrappers: 
tcplikeserver.cc (which starts a new thread to handle each session; like 
common TCP-based services) and udplikeserver.cc (which handles messages from 
all sessions; i.e. request -> response). The examples in standardservices.cc 
should - hopefully - make the idea clearer. For a more complex service, have 
a look into fractalgeneratorservice.cc (this is the service for the Fractal 
Generator example).

On the PU side, have a look into terminal.c (which can be used with Echo, 
Discard, etc.). This example is quite simple and should - hopefully - be easy 
to understand. Again, a more complex example - using multiple sessions in 
different threads - is fractalpooluser.cc.


  
Any help will be greatly appreciated - thanks in advance
    
If you have more questions, just write them on the mailing list.


Best regards
  

_______________________________________________ rsplib-discussion mailing list rsplib-discussion AT sctp.de http://www.sctp.de/mailman/listinfo/rsplib-discussion



Archive powered by MHonArc 2.6.19+.

Top of page