Compiling code with libconfd.so

I am experimenting with libconfd.so on basic version… I have my sample code which uses this libconfd.so. It compiles successfully however gives error at runtime…

Following is the error:

… undefined symbol: confd_init_vsn_sz

Which is present in

confd/include/confd_lib.h:986:extern void confd_init_vsn_sz(const char *name, FILE *estream,
confd/include/confd_lib.h:991: confd_init_vsn_sz((name), (estream), (debug), \

Could you please suggest some alternative/resolution…

Dear Tushar,
While running binary did you exported LD_LIBRARY_PATH?

You should source confdrc when you open a new shell:
$ source <confd directory>/confdrc

confdrc sets up PATH, LD_LIBRARY_PATH, and other necessary environment variables.

Thanks!

Setting up Load library path is basic and an an obvious step, I have done that…

Did you also get this error when linking .so dynamically during compile time… ? And were you able to resolve this using suggested approach ?

Dear Sudanshu,

This linking is an obvious step and yes it has been done… Problem is after linking step… I have also tried reinitializing the libraries also still got this error… However static linking with application does not give these kind of errors.
I might be missing a small part in this puzzel… : )

I’d need more information to be able to say what’s going on, if you include full build and startup logs I might be able to help.

Also, does one of the examples that come with ConfD work? For example:

$ cd <covfd dir>/examples.confd/intro/1-2-3-start-query-model
$ make all start
/home/jojohans/confd-6.4.1/bin/confdc --fail-on-warnings  -c -o dhcpd.fxs  dhcpd.yang
/home/jojohans/confd-6.4.1/bin/confdc -c commands-j.cli
/home/jojohans/confd-6.4.1/bin/confdc -c commands-c.cli
mkdir -p ./confd-cdb
cp /home/jojohans/confd-6.4.1/var/confd/cdb/aaa_init.xml ./confd-cdb
ln -s /home/jojohans/confd-6.4.1/etc/confd/ssh ssh-keydir
/home/jojohans/confd-6.4.1/bin/confdc --emit-h dhcpd.h dhcpd.fxs
cc -c -o dhcpd_conf.o dhcpd_conf.c -Wall -g -I/home/jojohans/confd-6.4.1/include
cc -o dhcpd_conf dhcpd_conf.o /home/jojohans/confd-6.4.1/lib/libconfd.a -lpthread -lm
C build complete
Build complete
### Killing any confd daemon or DHCP confd agents
/home/jojohans/confd-6.4.1/bin/confd --stop    || true
connection refused (stop)
killall dhcpd_conf || true
/bin/sh: 1: killall: not found
/home/jojohans/confd-6.4.1/bin/confd -c confd.conf --addloadpath /home/jojohans/confd-6.4.1/etc/confd
### * In one terminal window, run: tail -f ./confd.log
### * In another terminal window, run queries
###   (try 'make query' for an example)
### * In this window, the DHCP confd daemon now starts:
###   (hit Enter to exit)
./dhcpd_conf
TRACE Connected (cdb) to ConfD
TRACE CDB_SUBSCRIBE /dhcp --> CONFD_OK
TRACE CDB_SUBSCRIBE_DONE  --> CONFD_OK
Subscription point = 6
TRACE Connected (cdb) to ConfD
TRACE CDB_NEW_SESSION  --> CONFD_OK
TRACE Established new CDB session to ConfD
TRACE CDB_SET_NAMESPACE  --> CONFD_OK
TRACE CDB_GET /dhcp/defaultLeaseTime --> CONFD_OK
TRACE CDB_GET /dhcp/maxLeaseTime --> CONFD_OK
TRACE CDB_GET /dhcp/logFacility --> CONFD_OK
TRACE CDB_NUM_INSTANCES /dhcp/SubNets/subNet --> CONFD_OK
TRACE CDB_NUM_INSTANCES /dhcp/SharedNetworks/sharedNetwork --> CONFD_OK

Thanks jjohansson!

Problem was related to version mismatch…

I was able to ressolve it by recompiling my apps and server for my platform…

Regards

Tushar