Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to limit the symbol in libpaddle_fluid.so #9071

Closed
Xreki opened this issue Mar 14, 2018 · 1 comment
Closed

Need to limit the symbol in libpaddle_fluid.so #9071

Xreki opened this issue Mar 14, 2018 · 1 comment
Labels
预测 原名Inference,包含Capi预测问题等

Comments

@Xreki
Copy link
Contributor

Xreki commented Mar 14, 2018

All the dependent third party libraries (protobuf, gflags, glog, etc) are linked to libpaddle_fluid.so, so that in inference codes users only need to link libpaddle_fluid.so. But if users need to link another glog library of different version, the compiling will fail because of conflict of symbols. We need to limit the symbol table of libpaddle_fluid.so as do in capi

set(LINK_FLAGS "-Wl,--version-script ${CMAKE_CURRENT_SOURCE_DIR}/paddle_capi.map")
add_library(paddle_capi_shared SHARED ${CAPI_SOURCES})
set_target_properties(paddle_capi_shared PROPERTIES LINK_FLAGS "${LINK_FLAGS}")

@Xreki Xreki added the 预测 原名Inference,包含Capi预测问题等 label Mar 14, 2018
@wangkuiyi
Copy link
Collaborator

wangkuiyi commented Apr 8, 2018

May I know how doesn paddle_capi.map work, or how to learn more about *.map?

I am working on #9719 to refactorize paddle/fluid/memory. However, the CI always fails at linking tests in paddle/fluid/inference/tests/book/*, complaining symbols being defined multiple times.

I tried to make clean && make -j60 locally, but got the same errors.

[100%] Linking CXX executable test_inference_recommender_system
[100%] Linking CXX executable test_inference_recognize_digits_mlp
[100%] Linking CXX executable test_inference_word2vec
[100%] Linking CXX executable test_inference_recognize_digits_conv
[100%] Linking CXX executable test_inference_label_semantic_roles
[100%] Linking CXX executable test_inference_understand_sentiment_conv
[100%] Linking CXX executable test_inference_image_classification_vgg
[100%] Linking CXX executable test_inference_image_classification_resnet
[100%] Linking CXX executable test_inference_fit_a_line
../../libpaddle_fluid.a(malloc.cc.o): In function `paddle::memory::GetCPUBuddyAllocator()':
/paddle/paddle/fluid/memory/malloc.cc:32: multiple definition of `paddle::memory::GetCPUBuddyAllocator()'
../../libpaddle_fluid.a(memory.cc.o):/paddle/paddle/fluid/string/tinyformat/tinyformat.h:737: first defined here
../../libpaddle_fluid.a(malloc.cc.o): In function `void* paddle::memory::Alloc<paddle::platform::CPUPlace>(paddle::platform::CPUPlace, unsigned long)':
/paddle/paddle/fluid/memory/malloc.cc:41: multiple definition of `void* paddle::memory::Alloc<paddle::platform::CPUPlace>(paddle::platform::CPUPlace, unsigned long)'
../../libpaddle_fluid.a(memory.cc.o):/usr/include/c++/5/bits/basic_ios.h:462: first defined here
../../libpaddle_fluid.a(malloc.cc.o): In function `void paddle::memory::Free<paddle::platform::CPUPlace>(paddle::platform::CPUPlace, void*)':
/paddle/paddle/fluid/memory/malloc.cc:49: multiple definition of `void paddle::memory::Free<paddle::platform::CPUPlace>(paddle::platform::CPUPlace, void*)'
../../libpaddle_fluid.a(memory.cc.o):/usr/include/c++/5/bits/basic_ios.h:372: first defined here
../../libpaddle_fluid.a(malloc.cc.o): In function `unsigned long paddle::memory::Used<paddle::platform::CPUPlace>(paddle::platform::CPUPlace)':
/paddle/paddle/fluid/memory/malloc.cc:55: multiple definition of `unsigned long paddle::memory::Used<paddle::platform::CPUPlace>(paddle::platform::CPUPlace)'
../../libpaddle_fluid.a(memory.cc.o):/paddle/paddle/fluid/string/tinyformat/tinyformat.h:654: first defined here
../../libpaddle_fluid.a(malloc.cc.o): In function `paddle::memory::Usage::operator()(paddle::platform::CPUPlace const&) const':
/paddle/paddle/fluid/memory/malloc.cc:149: multiple definition of `paddle::memory::Usage::operator()(paddle::platform::CPUPlace const&) const'
../../libpaddle_fluid.a(memory.cc.o):/paddle/paddle/fluid/string/tinyformat/tinyformat.h:661: first defined here
../../libpaddle_fluid.a(malloc.cc.o): In function `paddle::memory::Usage::operator()(paddle::platform::CUDAPlace const&) const':
/paddle/paddle/fluid/memory/malloc.cc:153: multiple definition of `paddle::memory::Usage::operator()(paddle::platform::CUDAPlace const&) const'
../../libpaddle_fluid.a(memory.cc.o):/usr/include/c++/5/bits/basic_ios.h:372: first defined here
../../libpaddle_fluid.a(malloc.cc.o): In function `paddle::memory::Usage::operator()(paddle::platform::CUDAPinnedPlace const&) const':
/paddle/paddle/fluid/memory/malloc.cc:161: multiple definition of `paddle::memory::Usage::operator()(paddle::platform::CUDAPinnedPlace const&) const'
../../libpaddle_fluid.a(memory.cc.o):/usr/include/c++/5/bits/basic_ios.h:450: first defined here
../../libpaddle_fluid.a(malloc.cc.o): In function `paddle::memory::memory_usage(boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&)':
/paddle/paddle/fluid/memory/malloc.cc:169: multiple definition of `paddle::memory::memory_usage(boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&)'
../../libpaddle_fluid.a(memory.cc.o):/usr/include/c++/5/bits/basic_string.h:179: first defined here
../../libpaddle_fluid.a(meta_cache.cc.o): In function `paddle::memory::detail::MetadataCache::MetadataCache(bool)':
/paddle/paddle/fluid/memory/detail/meta_cache.cc:23: multiple definition of `paddle::memory::detail::MetadataCache::MetadataCache(bool)'
../../libpaddle_fluid.a(meta_cache.cc.o):/paddle/paddle/fluid/memory/detail/meta_cache.cc:24: first defined here
../../libpaddle_fluid.a(meta_cache.cc.o): In function `paddle::memory::detail::MetadataCache::MetadataCache(bool)':
/paddle/paddle/fluid/memory/detail/meta_cache.cc:23: multiple definition of `paddle::memory::detail::MetadataCache::MetadataCache(bool)'
../../libpaddle_fluid.a(meta_cache.cc.o):/paddle/paddle/fluid/memory/detail/meta_cache.cc:24: first defined here
../../libpaddle_fluid.a(meta_cache.cc.o): In function `paddle::memory::detail::MetadataCache::invalidate(paddle::memory::detail::MemoryBlock*)':
/paddle/paddle/fluid/memory/detail/meta_cache.cc:51: multiple definition of `paddle::memory::detail::MetadataCache::invalidate(paddle::memory::detail::MemoryBlock*)'
../../libpaddle_fluid.a(meta_cache.cc.o):/paddle/paddle/fluid/memory/detail/meta_cache.cc:53: first defined here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
预测 原名Inference,包含Capi预测问题等
Projects
None yet
Development

No branches or pull requests

2 participants