Hi,
First, I'd like to say that Inline is a terrific tool. What you can
accomplish with it is amazing.
Having had things working well with it for a while, I just hit something I
couldn't solve.
perl: error while loading shared libraries:
/mnt/view/dt_0.2.0_merge2/vobs/srdfa/src/ccm/cli_perl/_Inline/lib/auto/srdfa
_nwconfig_pl_8fe5/srdfa_nwconfig_pl_8fe5.so: undefined symbol:
xmlSubstituteEntitiesDefault
I adjusted the LIBS to point to the library's directory with
use Inline (CPP => Config =>
LIBS => '-L/usr/lib -lxml2
I confirmed that xmlSubstituteEntitiesDefault is in libxml2 with nm.
nm /usr/lib/libxml2 | grep xmlSubstituteEntitiesDefault
0007afb0 T __xmlSubstituteEntitiesDefaultValue
00021c10 T xmlSubstituteEntitiesDefault
0009b95c D xmlSubstituteEntitiesDefaultValue
The symbol is not unresolved.
I also defined both LD_LIBRARY_PATH and LD_RUN_PATH to point to /usr/lib.
LD_RUN_PATH=/usr/lib
LD_LIBRARY_PATH=/usr/lib
Here is a stripped down version of the code.
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
# can't help but exceed the line length in the coding guidelines on this
line.
# Otherwise, Inline gives an error.
use Inline (CPP => Config =>
LIBS => '-L/usr/lib -L../../../../util
-L../../../../../itac/lib
-L../../..../servercpp -L../../../../srdfa
-lxml2 -lutil -litac -lservercpp -lsrdfa -lpthread',
INC => '-I../../../../include
-I../../../../../include
-I../../../../../../contrib/libxml2-2.4.13-src/include');
use Inline CPP => 'DATA';
main();
sub main {
my ($opts) = {};
if (! GetOptions
($opts,
"--add", ("--source=s", "--destination=s"),
"--change", ("--source=s", "--destination=s"),
"--remove", ("--capi=s", "--pipe=s"),
"--list",
"--show",
"--verbose",
"--help"))
{
&srdfaClientNwConfigDisplayUsage;
exit 255;
}
my $sourceIP = $opts->{source};
my $destIP = $opts->{destination};
my $processRequestRetVal = 0;
my $taskAction = 0;
my $initRetVal = initCli();
if ($initRetVal == -1)
{
die "Error initializing client: $!";
}
if ( $opts -> {add} )
{
$taskAction = 1;
}
$processRequestRetVal = process($taskAction, $itacPem, $sourceSwitch,
$destSwitch, $sourceIP, $destIP);
if ($processRequestRetVal == -1)
{
die "Error processing request: $!";
}
}
#include <string>
using namespace std;
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <libxml/xmlmemory.h>
#include <libxml/debugXML.h>
#include <libxml/HTMLtree.h>
#include <libxml/xmlIO.h>
#include <libxml/DOCBparser.h>
#include <libxml/xinclude.h>
#include <libxml/catalog.h>
#include <libxml/parser.h>
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include "ccm.h"
#include "ccm_retCodes.h"
#include "Cccm_log.h"
#include "ccm_config.h"
#include "Cccm_server.h"
#include "Cccm_startEndFunc.h"
extern "C"
{
#include "itac_pub.h"
}
/* function prototypes */
int initCli();
int process( int, int, string, string, string, string );
CCM_RET_CODES_T sendMsg( ccm_msg_t *);
CCM_RET_CODES_T receiveMsg( ccm_msg_t *);
CCM_RET_CODES_T displayMsg( ccm_msg_t *);
/*========================================================================*/
/* receive a reply message back from ITAC */
CCM_RET_CODES_T receiveMsg( ccm_msg_t *pMsg )
{
CCM_RET_CODES_T ret=CCM_SUCCESS;
if (pMsg == 0)
{
pLog->Error("Empty pointer passed to receiveMsg\n");
delete pLog;
delete pIpc;
return CCM_GEN_INTERNAL_ERR;
}
memset(pMsg,0,sizeof(ccm_msg_t));
ret = pIpc->ReceiveMsg( pMsg );
if (ret != CCM_SUCCESS)
{
pLog->FatalError("Failed to receive message in CasaCLI\n");
delete pLog;
delete pIpc;
return CCM_GEN_INTERNAL_ERR;
}
ret = displayMsg( pMsg );
if (ret != CCM_SUCCESS)
{
pLog->FatalError("Failed to display message in CasaCLI\n");
delete pLog;
delete pIpc;
return CCM_GEN_INTERNAL_ERR;
}
return CCM_SUCCESS;
}
/*========================================================================*/
/* display a message received from receiveMsg */
CCM_RET_CODES_T displayMsg( ccm_msg_t *pMsg )
{
CCM_RET_CODES_T ret=CCM_SUCCESS;
if (pMsg == 0)
{
pLog->Error("Empty pointer passed to displayMsg\n");
delete pLog;
delete pIpc;
return CCM_GEN_INTERNAL_ERR;
}
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
xsltStylesheetPtr cur = NULL;
xmlDocPtr doc, res;
const char *params[16 + 1];
char *style = "/emc/ttobin/srdfaConfig.xsl";
cur = xsltParseStylesheetFile((const xmlChar *)style);
doc = xmlParseFile((const char *)pMsg);
res = xsltApplyStylesheet(cur, doc, params);
xsltSaveResultToFile(stdout, res, cur);
xsltFreeStylesheet(cur);
xmlFreeDoc(res);
xmlFreeDoc(doc);
xsltCleanupGlobals();
xmlCleanupParser();
return ret;
}
/*========================================================================*/
/* create the C struct which is the request, and populate it.
Send the message, receive the reply, and display the response
switch2 contains the component to be removed. On add or change, it is
ignored */
int process(int action, int serverPemId, char *switch2, char *switch3,
char *sourceIP, char *destIP)
{
ret = receiveMsg(&ccmRecvMsg);
}
Thanks!
Tom Tobin
EMC Corporation
450 Fortune Boulevard, Milford, MA
Voice: (508) 346-8387
Pager: 877-950-8337 pager email [EMAIL PROTECTED]
email: [EMAIL PROTECTED]