Closed wubo2018 closed 3 years ago
Hi,
It would be better to upgrade to 3.7.6 from this repo, then you can either use the C++11 mapping
CONFIGS=cpp11-shared make
See https://github.com/zeroc-ice/ice/tree/3.7/cpp#c11-mapping
And you need to link with the C++11 libraries
This is preferred for new applications, if you want to use the C++98 mapping and build with C++11 mode, you can set CPPFLAGS as
make CPPFLAGS=--std=c++11 V=1 -j8 srcs
See also https://doc.zeroc.com/ice/3.7/language-mappings/c++11-mapping/selecting-the-c++11-mapping
I use gcc -v 9.4.0 and cmd "make CPPFLAGS=--std=c++11 V=1 -j8 srcs" to compile ICE lib , this success; I write a plugin server with ice publish link the ice lib;
when I link the plugin go wrong error message :+1:
I know this is ABI progrom but I not kown how to resolve it
undefined reference to IceProxy::IceStorm::Topic::_iceI_begin_subscribeAndGetPublisher(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, IceInternal::ProxyHandle<IceProxy::Ice::Object> const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, IceUtil::Handle<IceInternal::CallbackBase> const&, IceInternal::Handle<Ice::LocalObject> const&, bool)' undefined reference to
Ice::Object::ice_id[abi:cxx11](Ice::Current const&) const'
undefined reference to Ice::Object::ice_isA(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ice::Current const&) const' undefined reference to
IceProxy::IceStorm::TopicManager::_iceI_begin_create(std::cxx11::basic_string<char, std::char_traitsIceInternal::OutgoingAsyncBase::getOperation[abi:cxx11]() const' undefined reference to
Ice::Object::ice_operationAttributes(std::cxx11::basic_string<char, std::char_traitsIceProxy::IceStorm::Topic::_iceI_begin_unsubscribe(IceInternal::ProxyHandle<IceProxy::Ice::Object> const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, IceUtil::Handle<IceInternal::CallbackBase> const&, IceInternal::Handle<Ice::LocalObject> const&, bool)' undefined reference to
Ice::noExplicitContext[abi:cxx11]'
undefined reference to IceInternal::OutgoingAsync::invoke(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' undefined reference to
Ice::Object::ice_ids[abi:cxx11](Ice::Current const&) const'
undefined reference to IceUtil::SyscallException::ice_id[abi:cxx11]() const' undefined reference to
IceProxy::IceStorm::TopicManager::_iceI_begin_retrieve(std::IceProxy::IceStorm::Topic::_iceI_begin_getPublisher(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, IceUtil::Handle<IceInternal::CallbackBase> const&, IceInternal::Handle<Ice::LocalObject> const&, bool)' undefined reference to
IceProxy::Ice::Object::_iceI_begin_ice_isA(std::cxx11::basic_string<char, std::char_traitsIce::OperationNotExistException::OperationNotExistException(char const*, int, Ice::Identity const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' undefined reference to
IceInternal::OutgoingAsync::prepare(std::cxx11::basic_string<char, std::char_traitsIceProxy::IceStorm::TopicManager::ice_staticId[abi:cxx11]()' undefined reference to
IceProxy::Ice::Object::_end(IceInternal::Handle
can you show the compile and link commands that you use to build your program?
CC =g++ -std=c++11 dirs:=$(shell find . -maxdepth 10 -type d) files:=$(foreach dir,$(dirs),$(wildcard $(dir)/.cpp)) sources :=$(wildcard .c) $(wildcard *.cpp) objects :=$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(files))) dependence :=$(object:.o=.d) object_dir = obj output_dir = bin CPPFLAGS=-g -shared -fPIC RM =rm -rf INCLUDE =-I /opt/Ice-3.7.5/include LIB_PATH=-L /opt/Ice-3.7.5/lib64 LIB =-lIce -lIceStorm -lGlacier2 -lpthread RPath :=-Wl,-rpath TARGET =libIceSub.so $(TARGET):$(objects) $(CC) $(CPPFLAGS) $^ -o $@ $(LIB_PATH) $(LIB) $(RPath) %.o:%.cpp $(CC) $(CPPFLAGS) -c $< -o $@ $(INCLUDE) clean: $(RM) $(objects) $(dependence) $(TARGET)
CC =g++ -std=c++11 sources :=$(wildcard .c) $(wildcard .cpp) objects :=$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(sources))) dependence :=$(object:.o=.d) RM =rm -rf INCLUDE =-I /. LIB_PATH=-L /. LIB =-lIceSub RPath :=-Wl,-rpath TARGET =IceSub $(TARGET):$(objects) $(CC) $(CPPFLAGS) $^ -o $@ $(LIB_PATH) $(LIB) $(RPath) %.o:%.cpp $(CC) $(CPPFLAGS) -c $< -o $@ $(INCLUDE) clean: $(RM) $(objects) $(dependence)
Do you get the errors when building IceSub
or libIceSub
? seems you are not linking IceSub with Ice libraries
no error when I use CC =g++ -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 it can link
![Uploading image.png…]()
It is not clear to me why you get this ABI issue after rebuilding Ice with -std=c++11
I maybe resove it
I can build cpp using gcc9.4.0 and build success,but when Link IceStrom.so occur error
like this : undefined reference to `sssp(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, char)
so How Can I enable C++11 in Makefile