onnxruntime
onnxruntime copied to clipboard
Duplicate define operater<<
Describe the bug There is a duplicate define to: namespace ONNX_NAMESPACE { std::ostream& operator<<(std::ostream& os, const TensorShapeProto& shape);} in both: onnxruntime/cmake/external/onnx/onnx/defs/printer.h and: onnxruntime/onnxruntime/core/framework/utils.h
after: ./build.sh --android ... It generates libonnx.a and libonnxruntime_framework.a without any problem. But when I try to load these generated libraries into an android ndk project, the linker will report an error like this:
ld: error: duplicate symbol: onnx::operator<<(std::__ndk1::basic_ostream<char, std::__ndk1::char_traits
defined at printer.cc printer.cc.o:(onnx::operator<<(std::__ndk1::basic_ostream<char, std::__ndk1::char_traits
>&, onnx::TensorShapeProto const&)) in archive /xxx/onnxruntime/build/Android/Release/external/onnx/libonnx.a defined at utils.cc utils.cc.o:(.text._ZN4onnxlsERNSt6__ndk113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_16TensorShapeProtoE+0x1) in archive /xxx/onnxruntime/build/Android/Release/libonnxruntime_framework.a
This is most likely due to a recent addition of printer.h/cc to the ONNX library: https://github.com/onnx/onnx/pull/4246
@gramalingam does the ORT version of the ostream operator<< for TensorShapeProto need to be removed or is there a way for the two versions to co-exist when the static onnx and ORT libraries are used?
Should be addressed by #12651 which will be included in the next ORT release.