Hi, Sorry, I do not know how to control Bazel's linker command line order. Maybe it would help to define three separate cc_library rules for the three libraries, with the dependencies between them specified -- maybe Bazel will then recognize the dependency relationship and do the ordering correctly. But I don't know.
-Kenton On Fri, Oct 11, 2019 at 8:48 AM 张小 <[email protected]> wrote: > bazel link *.a in Lexicographic order,how can I change it > > > bazel-out/k8-fastbuild/bin/_objs/test_capn/demo/test_capn_serialize_performance.pic.o > bazel-out/k8-fastbuild/bin/_objs/test_capn/demo/full_info.capnp.pic.o > capnp/lib/libcapnp.a > capnp/lib/libcapnpc.a > capnp/lib/libkj.a > -lstdc++ > -lm > > > > 在 2019年10月11日星期五 UTC+8下午7:12:26,张小写道: >> >> >> nm -C libcapnpc.a |grep SchemaLoader|grep 'get(' >> U capnp::SchemaLoader::get(unsigned long, >> capnp::schema::Brand::Reader, capnp::Schema) const >> >> nm -C libcapnp.a |grep SchemaLoader|grep 'get(' >> 0000000000004250 T capnp::SchemaLoader::get(unsigned long, >> capnp::schema::Brand::Reader, capnp::Schema) const >> >> >> it seems SchemaLoader::get Symbol in libcapnp.a , and in my bazel build >> file like this >> >> cc_library( >> name = 'capnp', >> visibility = ["//visibility:public"], >> hdrs = glob([ >> "include/capnp/*.h", >> "include/capnp/compat/*.h", >> "include/kj/*.h", >> "include/kj/**/*.h", >> ]), >> srcs = glob([ >> "lib/libcapnpc.a", >> "lib/libcapnp.a", >> "lib/libkj.a", >> ]), >> >> strip_include_prefix = "include", >> ) >> >> >> >> >> >> >> >> >> 在 2019年10月11日星期五 UTC+8下午3:47:39,张小写道: >>> >>> Hi,Kenton: >>> I like capnp, I use Capn ,Link with static libraries( use .a) >>> Failed ,Error Like this >>> >>> ERROR: xxxxx/BUILD:6:1: Linking of rule '//:test_capn' failed (Exit 1) >>> capnp/lib/libcapnpc.a(schema-parser.o):schema-parser.c++:function >>> capnp::ParsedSchema::findNested(kj::StringPtr) const: error: undefined >>> reference to 'capnp::SchemaLoader::get(unsigned long, >>> capnp::schema::Brand::Reader, capnp::Schema) const' >>> >>> >>> but the libcapnpc.a has the “SchemaLoader::get” Symbol like this: >>> nm capnp/lib/libcapnpc.a |grep SchemaLoader|grep get >>> nm -C lib/libcapnpc.a |grep SchemaLoader|grep get >>> U capnp::SchemaLoader::get(unsigned long, >>> capnp::schema::Brand::Reader, capnp::Schema) const >>> U >>> capnp::SchemaLoader::getType(capnp::schema::Type::Reader, capnp::Schema) >>> const >>> U capnp::SchemaLoader::get(unsigned long, >>> capnp::schema::Brand::Reader, capnp::Schema) const >>> >>> >>> capnp/lib$ ll -rth >>> 总用量 8.4M >>> -rw-r--r-- 1 mulou mulou 1.1M 9月 27 15:08 libcapnp.a >>> -rw-r--r-- 1 mulou mulou 1.4M 9月 27 15:08 libcapnpc.a >>> -rw-r--r-- 1 mulou mulou 330K 9月 27 15:08 libcapnp-json.a >>> -rw-r--r-- 1 mulou mulou 2.0M 9月 27 15:08 libcapnp-rpc.a >>> -rw-r--r-- 1 mulou mulou 941K 9月 27 15:08 libkj.a >>> -rw-r--r-- 1 mulou mulou 1.2M 9月 27 15:08 libkj-async.a >>> -rw-r--r-- 1 mulou mulou 70K 9月 27 15:08 libkj-test.a >>> -rw-r--r-- 1 mulou mulou 1.5M 9月 27 15:08 libkj-http.a >>> >>> *I try to link it with dynamic libraries,it works * >>> >>> *nm -C lib-old/libcapnpc.so |grep SchemaLoader|grep get* >>> * U capnp::SchemaLoader::get(unsigned long, >>> capnp::schema::Brand::Reader, capnp::Schema) const* >>> * U >>> capnp::SchemaLoader::getType(capnp::schema::Type::Reader, capnp::Schema) >>> const* >>> >>> *But I want to use static libraries instead of dynamic libraries because >>> dynamic libraries are a little cumbersome to deploy. * >>> >>> *I install the capn **libraries** like this :* >>> >>> curl -O https://capnproto.org/capnproto-c++-0.7.0.tar.gz tar zxf >>> capnproto-c++-0.7.0.tar.gz cd capnproto-c++-0.7.0 ./configure make -j6 >>> check sudo make install >>> >>> All the best >>> whutbd >>> >>> >>> >>> -- > You received this message because you are subscribed to the Google Groups > "Cap'n Proto" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/capnproto/ae657a42-78cf-4903-8f76-00e186d9a256%40googlegroups.com > <https://groups.google.com/d/msgid/capnproto/ae657a42-78cf-4903-8f76-00e186d9a256%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/CAJouXQkCrdJam-pbTWKk7HZWtndXTjtzpLcEBBJhk8k%2B3Dz3HA%40mail.gmail.com.
