[chord] How to use chord as a library ?

=?GB2312?Q?=CE=E4=D1=DE=BE=FC?= wuyanjun at mprc.pku.edu.cn
Fri May 6 00:09:57 EDT 2005


hi,every one :
	 I've tried to use chord as a library guided by "/hack.html". The example in the webpage was embeded into my test, and compiled successfully. But the error occured in the link stage.

	the following is from my test makefile:
test_dht : $(OBJS)
        $(CC) -o test_dht $(CFLAGS) $(OBJS) -L/usr/local/lib -lsfs -L/usr/local/lib/sfs -lasync -lsvc -larpc -lsfscrypt -lsfsmisc -L/home/wuyj/sfsnet/dhash -ldhashclient -dhash -L/home/wuyj/sfsnet/utils -lutil -L/home/wuyj/sfsnet/merkle -lmerkle -L/home/wuyj/sfsnet/dhc -ldhc -L/home/wuyj/sfsnet/sfsrodb -lsfsrodb -L/usr/lib -lgmp
	
	And the following is the error information when linked :

ot at pku-mprc siphone]# make
g++ -o test_dht -g -Wall -O0 -mcpu=i486 test_dht.o siphone_dht.o -L/usr/local/lib -lsfs -L/usr/local/lib/sfs -lasync -lsvc -larpc -lsfscrypt -lsfsmisc -L/home/wuyj/sfsnet/dhash -ldhashclient -dhash -L/home/wuyj/sfsnet/utils -lutil -L/home/wuyj/sfsnet/merkle -lmerkle -L/home/wuyj/sfsnet/dhc -ldhc -L/home/wuyj/sfsnet/sfsrodb -lsfsrodb -L/usr/lib -lgmp
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x51): In function `dhashclient::dhashclient[not-in-charge](str)':
/usr/local/include/sfs/rpctypes.h:146: undefined reference to `axprt_unix::alloc(int, unsigned)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x69): In function `dhashclient::dhashclient[not-in-charge](str)':
/usr/local/include/sfs/vec.h:85: undefined reference to `dhashgateway_program_1'/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x70):/usr/local/include/sfs/vec.h:101: undefined reference to `aclnt::alloc(ref<axprt>, rpc_program const&, sockaddr const*, callbase* (*)(ref<aclnt>, xdrsuio&, ref<callback<void, clnt_stat, void, void> >, void*, int (*)(XDR*, void*), sockaddr*))'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x22d): In function `dhashclient::dhashclient[in-charge](str)':
/usr/local/include/sfs/refcnt.h:431: undefined reference to `axprt_unix::alloc(int, unsigned)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x245):/usr/local/include/sfs/refcnt.h:175: undefined reference to `dhashgateway_program_1'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x24c):/usr/local/include/sfs/refcnt.h:175: undefined reference to `aclnt::alloc(ref<axprt>, rpc_program const&, sockaddr const*, callbase* (*)(ref<aclnt>, xdrsuio&, ref<callback<void, clnt_stat, void, void> >, void*, int (*)(XDR*, void*), sockaddr*))'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x3e6): In function `dhashclient::dhashclient[not-in-charge](ptr<axprt_stream>)':
/usr/local/include/sfs/refcnt.h:175: undefined reference to `dhashgateway_program_1'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x3f3):/usr/local/include/sfs/refcnt.h:175: undefined reference to `aclnt::alloc(ref<axprt>, rpc_program const&, sockaddr const*, callbase* (*)(ref<aclnt>, xdrsuio&, ref<callback<void, clnt_stat, void, void> >, void*, int (*)(XDR*, void*), sockaddr*))'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x506): In function `dhashclient::dhashclient[in-charge](ptr<axprt_stream>)':
/usr/local/include/sfs/refcnt.h:175: undefined reference to `dhashgateway_program_1'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x513):/usr/local/include/sfs/refcnt.h:175: undefined reference to `aclnt::alloc(ref<axprt>, rpc_program const&, sockaddr const*, callbase* (*)(ref<aclnt>, xdrsuio&, ref<callback<void, clnt_stat, void, void> >, void*, int (*)(XDR*, void*), sockaddr*))'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x60e): In function `dhashclient::append(bigint, char const*, unsigned, ref<callback<void, dhash_stat, ptr<insert_info>, void> >)':
/usr/local/include/sfs/xdrmisc.h:396: undefined reference to `xdrsuio_create'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x63c): In function `dhashclient::append(bigint, char const*, unsigned, ref<callback<void, dhash_stat, ptr<insert_info>, void> >)':
/usr/local/include/sfs/suio++.h:119: undefined reference to `xdrsuio::uio()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x64a): In function `dhashclient::append(bigint, char const*, unsigned, ref<callback<void, dhash_stat, ptr<insert_info>, void> >)':
/home/wuyj/sfsnet/dhash/dhashclient.C:83: undefined reference to `xdrsuio::uio()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x7f6): In function `dhashclient::insert(bigint, char const*, unsigned, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, ptr<option_block>, dhash_ctype)':
/usr/local/include/sfs/xdrmisc.h:396: undefined reference to `xdrsuio_create'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x824): In function `dhashclient::insert(bigint, char const*, unsigned, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, ptr<option_block>, dhash_ctype)':
/usr/local/include/sfs/suio++.h:119: undefined reference to `xdrsuio::uio()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x832): In function `dhashclient::insert(bigint, char const*, unsigned, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, ptr<option_block>, dhash_ctype)':
/home/wuyj/sfsnet/dhash/dhashclient.C:114: undefined reference to `xdrsuio::uio()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0xb69): In function `dhashclient::insert(bigint, sfs_pubkey2, sfs_sig2, keyhash_payload&, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, ptr<option_block>)':
/usr/local/include/sfs/xdrmisc.h:396: undefined reference to `xdrsuio_create'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0xb80): In function `dhashclient::insert(bigint, sfs_pubkey2, sfs_sig2, keyhash_payload&, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, ptr<option_block>)':
/home/wuyj/sfsnet/dhash/dhashclient.C:149: undefined reference to `xdr_sfs_pubkey2(XDR*, void*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0xb93):/home/wuyj/sfsnet/dhash/dhashclient.C:149: undefined reference to `xdr_sfs_sig2(XDR*, void*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0xdff): In function `dhashclient::insert(bigint, sfs_pubkey2, sfs_sig2, keyhash_payload&, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, ptr<option_block>)':
/usr/local/include/sfs/suio++.h:119: undefined reference to `xdrsuio::uio()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0xe10): In function `dhashclient::insert(bigint, sfs_pubkey2, sfs_sig2, keyhash_payload&, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, ptr<option_block>)':
/home/wuyj/sfsnet/dhash/dhashclient.C:160: undefined reference to `xdrsuio::uio()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0xe3c): In function `dhashclient::insert(bigint, sfs_pubkey2, sfs_sig2, keyhash_payload&, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, ptr<option_block>)':
/usr/local/include/sfs/suio++.h:119: undefined reference to `xdrsuio::uio()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x1259): In function `dhashclient::insert_togateway(bigint, char const*, unsigned, ref<callback<void, dhash_stat, ptr<insert_info>, void> >, dhash_ctype, unsigned, ptr<option_block>)':
/usr/local/include/sfs/refcnt.h:393: undefined reference to `aclnt::call(unsigned, void const*, void*, ref<callback<void, clnt_stat, void, void> >, AUTH*, int (*)(XDR*, void*), int (*)(XDR*, void*), unsigned, unsigned, sockaddr*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x19b3): In function `dhashclient::insertcb(ref<callback<void, dhash_stat, ptr<insert_info>, void> >, bigint, ptr<dhash_insert_res>, clnt_stat)':
/usr/local/include/sfs/refcnt.h:182: undefined reference to `rpc_print(strbuf const&, dhash_stat const&, int, char const*, char const*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x21d8): In function `dhashclient::retrieve(bigint, dhash_ctype, ptr<callback<void, dhash_stat, ptr<dhash_block>, vec<bigint, (unsigned)0> > >, ptr<option_block>)':
/usr/local/include/sfs/refcnt.h:393: undefined reference to `aclnt::call(unsigned, void const*, void*, ref<callback<void, clnt_stat, void, void> >, AUTH*, int (*)(XDR*, void*), int (*)(XDR*, void*), unsigned, unsigned, sockaddr*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(dhashclient.o)(.text+0x23e8): In function `dhashclient::retrievecb(ptr<callback<void, dhash_stat, ptr<dhash_block>, vec<bigint, (unsigned)0> > >, bigint, ref<dhash_retrieve_res>, clnt_stat)':
/usr/local/include/sfs/refcnt.h:182: undefined reference to `rpc_print(strbuf const&, dhash_stat const&, int, char const*, char const*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x45): In function `compute_hash(void const*, unsigned)':
/usr/local/include/sfs/refcnt.h:330: undefined reference to `sha1::newstate(unsigned*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x54): In function `compute_hash(void const*, unsigned)':
/usr/local/include/sfs/bigint.h:103: undefined reference to `mdblock::update(void const*, unsigned)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x5c): In function `compute_hash(void const*, unsigned)':
/usr/include/c++/3.2.2/new:93: undefined reference to `mdblock::finish_be()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x65): In function `compute_hash(void const*, unsigned)':
/usr/local/include/sfs/bigint.h:117: undefined reference to `sha1::state2bytes(void*, unsigned const*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x91): In function `compute_hash(void const*, unsigned)':
/usr/local/include/sfs/vec.h:105: undefined reference to `mpz_set_rawmag_be'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x210): In function `verify_content_hash(bigint, char const*, int)':
/usr/local/include/sfs/sha1.h:49: undefined reference to `sha1::newstate(unsigned*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x21f):/usr/local/include/sfs/sha1.h:65: undefined reference to `mdblock::update(void const*, unsigned)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x227):/usr/local/include/sfs/sha1.h:36: undefined reference to `mdblock::finish_be()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x230):/usr/local/include/sfs/sha1.h:53: undefined reference to `sha1::state2bytes(void*, unsigned const*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x259): In function `verify_content_hash(bigint, char const*, int)':
/home/wuyj/sfsnet/dhash/verify.C:51: undefined reference to `mpz_set_rawmag_be'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x2ff): In function `verify_keyhash(bigint, char const*, int)':
/home/wuyj/sfsnet/dhash/verify.C:64: undefined reference to `xdr_sfs_pubkey2(XDR*, void*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x36e):/home/wuyj/sfsnet/dhash/verify.C:66: undefined reference to `xdr_sfs_sig2(XDR*, void*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0xa15): In function `get_block_contents(char const*, unsigned, dhash_ctype)':
/home/wuyj/sfsnet/dhash/verify.C:118: undefined reference to `xdr_sfs_pubkey2(XDR*, void*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0xa87): In function `get_block_contents(char const*, unsigned, dhash_ctype)':
/usr/local/include/sfs/stllike.h:50: undefined reference to `xdr_sfs_sig2(XDR*,
void*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0xc48): In function `keyhash_version(char const*, unsigned)':
/home/wuyj/sfsnet/dhash/verify.C:175: undefined reference to `xdr_sfs_pubkey2(XDR*, void*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0xcbe):/home/wuyj/sfsnet/dhash/verify.C:186: undefined reference to `xdr_sfs_sig2(XDR*, void*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x141b): In function `keyhash_payload::id(sfs_pubkey2) const':
/home/wuyj/sfsnet/dhash/verify.C:225: undefined reference to `sfscrypt'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x1421):/home/wuyj/sfsnet/dhash/verify.C:225: undefined reference to `sfscrypt_t::alloc(sfs_pubkey2 const&, unsigned char) const'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x148a): In function `keyhash_payload::id(sfs_pubkey2) const':
/usr/local/include/sfs/sha1.h:49: undefined reference to `sha1::newstate(unsigned*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x14a9): In function `keyhash_payload::id(sfs_pubkey2) const':
/usr/local/include/sfs/str.h:135: undefined reference to `mdblock::update(void const*, unsigned)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x14b7): In function `keyhash_payload::id(sfs_pubkey2) const':
/home/wuyj/sfsnet/dhash/verify.C:231: undefined reference to `mdblock::update(void const*, unsigned)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x14bf): In function `keyhash_payload::id(sfs_pubkey2) const':
/usr/local/include/sfs/sha1.h:36: undefined reference to `mdblock::finish_be()'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x14cb):/usr/local/include/sfs/sha1.h:53: undefined reference to `sha1::state2bytes(void*, unsigned const*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x14f3): In function `keyhash_payload::id(sfs_pubkey2) const':
/home/wuyj/sfsnet/dhash/verify.C:235: undefined reference to `mpz_set_rawmag_be'/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x150b): In function `keyhash_payload::id(sfs_pubkey2) const':
/usr/local/include/sfs/crypthash.h:49: undefined reference to `vtable for mdblock'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x1648):/usr/local/include/sfs/crypthash.h:49: undefined reference to `vtable for mdblock'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x177e): In function `keyhash_payload::verify(sfs_pubkey2, sfs_sig2) const':
/home/wuyj/sfsnet/dhash/verify.C:272: undefined reference to `sfscrypt'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.text+0x1787):/home/wuyj/sfsnet/dhash/verify.C:272: undefined reference to `sfscrypt_t::alloc(sfs_pubkey2 const&, unsigned char) const'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.gnu.linkonce.d._ZTV7sha1ctx+0x8):/usr/local/include/sfs/union.h:127: undefined reference to `mdblock::update(void const*, unsigned)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.gnu.linkonce.t._ZN4sha1D2Ev+0x9): In function `sha1::~sha1 [not-in-charge]()':
/usr/local/include/sfs/str.h:69: undefined reference to `vtable for mdblock'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.gnu.linkonce.t._ZN7sha1ctx7consumeEPKh+0xe): In function `sha1ctx::consume(unsigned char const*)':
/usr/include/c++/3.2.2/typeinfo:104: undefined reference to `sha1::transform(unsigned*, unsigned char const*)'
/home/wuyj/sfsnet/dhash/libdhashclient.a(verify.o)(.gnu.linkonce.d._ZTI4sha1+0x8):/usr/local/include/sfs/union.h:127: undefined reference to `typeinfo for mdblock'
collect2: ld returned 1 exit status
make: *** [test_dht] Error 1

	The libraries in the makefile certainly can be found, but many symbols and functions can't be found. 
	Some questions confuse me : what and how many libraries are necessary to use the dhashclient interface ? my test directory is outside the sfsnet/ , can makefile only cover the test/ directory ? Why the functions such as "xdr_sfs_pubkey2(XDR*, void*)" can't be found ?   
	I hope to get your help, thank you !

				Wu Yanjun
 ¡¡¡¡¡¡¡¡¡¡¡¡¡¡wuyanjun at mprc.pku.edu.cn
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2005-05-06





More information about the chord mailing list