summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO30
-rw-r--r--PKGBUILD75
-rw-r--r--build-fixes.patch87
-rw-r--r--gcc10.diff12
-rw-r--r--protobuf-debundle.patch308
5 files changed, 401 insertions, 111 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0f5e4785f48d..cd8bdd3cab21 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,49 +1,39 @@
pkgbase = python-onnxruntime
pkgdesc = Cross-platform, high performance scoring engine for ML models
- pkgver = 1.2.0
- pkgrel = 5
+ pkgver = 1.3.0
+ pkgrel = 2
url = https://github.com/microsoft/onnxruntime
arch = x86_64
license = MIT
makedepends = git
makedepends = cmake
- makedepends = cuda
- makedepends = cudnn
- makedepends = gtest
- makedepends = gmock
makedepends = pybind11
makedepends = python-setuptools
- makedepends = cub
makedepends = nlohmann-json
makedepends = chrono-date
depends = protobuf
depends = re2
depends = python-numpy
- source = git+https://github.com/microsoft/onnxruntime#tag=v1.2.0
+ source = git+https://github.com/microsoft/onnxruntime#tag=v1.3.0
source = git+https://gitlab.com/libeigen/eigen.git
source = git+https://github.com/google/gemmlowp.git
source = git+https://github.com/google/nsync.git
source = git+https://github.com/onnx/onnx.git
source = git+https://github.com/dcleblanc/SafeInt.git
+ source = git+https://github.com/microsoft/wil.git
source = build-fixes.patch
- source = cmake-3.17.patch::https://github.com/microsoft/onnxruntime/commit/355f39ddee885237bf6fde9b587c7a5f80d22c53.patch
+ source = gcc10.diff
+ source = protobuf-debundle.patch
sha512sums = SKIP
sha512sums = SKIP
sha512sums = SKIP
sha512sums = SKIP
sha512sums = SKIP
sha512sums = SKIP
- sha512sums = 4457e19e3e91195ea2976a70e31a70d07b1b5e2279f1493a537c7d128aef5695e317cfdb84a87a0ca8d2d53ba15d72edf0f95905ecff7fbfb250e3a97944313c
- sha512sums = 8804a5ecda6c5b2a341a723e918fc06f1e64a4500ea8fef835e76cca99ba4aba91465f2ddde8aac99ddf759bfa022a9b18641f9ec17c8592ec9e82eac69edef1
+ sha512sums = SKIP
+ sha512sums = 8ece04a7f2ffc89aa9da0a34db1febf31a0516dc2271f2fa711e8160577b2195ba746c150ed76506ce378e913be2888947e21d5745e52fe6d248b1d5aa7f2a83
+ sha512sums = cc4fe39dba1d1565ebea51c90fa81ea18975d12db60468d6508b386d1423e5500b3579bce7c5d633a5504163248f5278aaaca6374b90c282344575b911dd852a
+ sha512sums = a147afdd18d68f7aa5ba06f69993d06876e9c80bfe42dedf7e279576a2fc19a177f6441122cde905771b57fc747a561d215df8729cd0ca6289cf1fbc398efd30
pkgname = python-onnxruntime
-pkgname = python-onnxruntime-cuda
- depends = protobuf
- depends = re2
- depends = python-numpy
- depends = cuda
- depends = cudnn
- provides = python-onnxruntime=1.2.0
- conflicts = python-onnxruntime
-
diff --git a/PKGBUILD b/PKGBUILD
index 2ce18ae78fb4..da9341c6b00a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,15 +1,14 @@
# Maintainer: Chih-Hsuan Yen <yan12125@gmail.com>
-pkgbase=python-onnxruntime
-pkgname=(python-onnxruntime python-onnxruntime-cuda)
-pkgver=1.2.0
+pkgname=python-onnxruntime
+pkgver=1.3.0
pkgdesc='Cross-platform, high performance scoring engine for ML models'
-pkgrel=5
+pkgrel=2
arch=(x86_64)
url='https://github.com/microsoft/onnxruntime'
license=(MIT)
depends=(protobuf re2 python-numpy)
-makedepends=(git cmake cuda cudnn gtest gmock pybind11 python-setuptools cub nlohmann-json chrono-date)
+makedepends=(git cmake pybind11 python-setuptools nlohmann-json chrono-date)
# not de-vendored libraries
# eigen: API changes a lot since extra/eigen 3.3.7 to the commit onnxruntime uses
# onnx: onnxruntime uses different protobuf files than upstream onnx
@@ -20,68 +19,54 @@ source=("git+https://github.com/microsoft/onnxruntime#tag=v$pkgver"
"git+https://github.com/google/nsync.git"
"git+https://github.com/onnx/onnx.git"
"git+https://github.com/dcleblanc/SafeInt.git"
+ "git+https://github.com/microsoft/wil.git"
build-fixes.patch
- cmake-3.17.patch::https://github.com/microsoft/onnxruntime/commit/355f39ddee885237bf6fde9b587c7a5f80d22c53.patch)
+ gcc10.diff
+ protobuf-debundle.patch)
sha512sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
- '4457e19e3e91195ea2976a70e31a70d07b1b5e2279f1493a537c7d128aef5695e317cfdb84a87a0ca8d2d53ba15d72edf0f95905ecff7fbfb250e3a97944313c'
- '8804a5ecda6c5b2a341a723e918fc06f1e64a4500ea8fef835e76cca99ba4aba91465f2ddde8aac99ddf759bfa022a9b18641f9ec17c8592ec9e82eac69edef1')
+ 'SKIP'
+ '8ece04a7f2ffc89aa9da0a34db1febf31a0516dc2271f2fa711e8160577b2195ba746c150ed76506ce378e913be2888947e21d5745e52fe6d248b1d5aa7f2a83'
+ 'cc4fe39dba1d1565ebea51c90fa81ea18975d12db60468d6508b386d1423e5500b3579bce7c5d633a5504163248f5278aaaca6374b90c282344575b911dd852a'
+ 'a147afdd18d68f7aa5ba06f69993d06876e9c80bfe42dedf7e279576a2fc19a177f6441122cde905771b57fc747a561d215df8729cd0ca6289cf1fbc398efd30')
prepare() {
cd onnxruntime
- # More protobuf debundling; inspired by https://github.com/microsoft/onnxruntime/pull/1928
- rm -v onnxruntime/core/util/protobuf_parsing_utils.h
- echo "#include <google/protobuf/io/zero_copy_stream_impl.h>" >> onnxruntime/core/util/protobuf_parsing_utils.h
patch -Np1 -i ../build-fixes.patch
- patch -Np1 -i ../cmake-3.17.patch
+ # part of https://github.com/microsoft/onnxruntime/commit/e86214e5c00ffbb95b85478c111c8eb21de94fe9
+ patch -Np1 -i ../gcc10.diff
+ patch -Np1 -i ../protobuf-debundle.patch
git submodule init
- for mod in eigen gemmlowp nsync onnx SafeInt; do
+ for mod in eigen gemmlowp nsync onnx SafeInt wil; do
git config submodule.cmake/external/$mod.url "$srcdir"/$mod
git submodule update cmake/external/$mod
done
-
- mkdir build build-cuda
}
-_build() {
+build() {
+ cd "$srcdir"/onnxruntime
# Use protobuf-lite instead of full protobuf to workaround symbol conflicts
# with onnx; see https://github.com/onnx/onnx/issues/1277 for details.
- cmake ../cmake \
+ cmake -B build -S cmake \
-Donnxruntime_ENABLE_PYTHON=ON \
-DONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc \
-Donnxruntime_PREFER_SYSTEM_LIB=ON \
-Donnxruntime_USE_FULL_PROTOBUF=OFF \
- $@
+ -Donnxruntime_BUILD_UNIT_TESTS=OFF
+
+ cd build
make
python ../setup.py build
}
-build() {
- cd "$srcdir"/onnxruntime/build
- _build
-
- cd "$srcdir"/onnxruntime/build-cuda
- # Uses the same compiler as CUDA, or there will be linker errors due to
- # attempts on linking object files with libstdc++ from older GCC
- CC=/opt/cuda/bin/gcc CXX=/opt/cuda/bin/g++ \
- _build -Donnxruntime_USE_CUDA=ON -Donnxruntime_CUDNN_HOME=/usr
-}
-
-check() {
- cd "$srcdir"/onnxruntime/build
- make test
-
- cd "$srcdir"/onnxruntime/build-cuda
- # make test # requires machines with CUDA-compatible devices
-}
-
-_package() {
+package() {
+ cd onnxruntime/build
python ../setup.py install --root="$pkgdir" --skip-build --optimize=1
PY_SITE_DIR="$(python -c 'import site; print(site.getsitepackages()[0])')"
@@ -90,17 +75,3 @@ _package() {
ln -s "$PY_SITE_DIR/onnxruntime/$f" "$pkgdir"/usr/share/licenses/$pkgname/$f
done
}
-
-package_python-onnxruntime() {
- cd onnxruntime/build
- _package
-}
-
-package_python-onnxruntime-cuda() {
- depends+=(cuda cudnn)
- conflicts=(python-onnxruntime)
- provides=("python-onnxruntime=$pkgver")
-
- cd onnxruntime/build-cuda
- _package
-}
diff --git a/build-fixes.patch b/build-fixes.patch
index f228eb8aec6e..dc1e234dcdab 100644
--- a/build-fixes.patch
+++ b/build-fixes.patch
@@ -29,6 +29,32 @@ index 3cee60f3..3328fc06 100644
if(onnxruntime_PREFER_SYSTEM_LIB)
find_package(re2)
+@@ -1009,18 +1009,19 @@
+ # some of the tests rely on the shared libs to be
+ # built; hence the ordering
+ if (onnxruntime_BUILD_UNIT_TESTS)
+- if (onnxruntime_ENABLE_PYTHON)
+- if(UNIX)
+- set(CMAKE_SKIP_BUILD_RPATH ON)
+- endif()
+- include(onnxruntime_python.cmake)
+- endif()
+ # we need to make sure this is turned off since it
+ # turned ON by the previous step when building a shared lib
+ set(CMAKE_SKIP_BUILD_RPATH OFF)
+ include(onnxruntime_unittests.cmake)
+ endif()
+
++if (onnxruntime_ENABLE_PYTHON)
++ if(UNIX)
++ set(CMAKE_SKIP_BUILD_RPATH ON)
++ endif()
++ include(onnxruntime_python.cmake)
++endif()
++
+ if (onnxruntime_ENABLE_TRAINING)
+ include(onnxruntime_training.cmake)
+ if (onnxruntime_ENABLE_TRAINING_E2E_TESTS)
diff --git a/cmake/external/Findre2.cmake b/cmake/external/Findre2.cmake
new file mode 100644
index 00000000..4c91696c
@@ -46,11 +72,11 @@ index d33e9e14..5770e818 100644
endif()
endif()
--onnxruntime_add_include_to_target(onnxruntime_common date_interface safeint_interface)
-+onnxruntime_add_include_to_target(onnxruntime_common date::date safeint_interface)
- target_include_directories(onnxruntime_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT}
- PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public")
-
+-onnxruntime_add_include_to_target(onnxruntime_common date_interface wil)
++onnxruntime_add_include_to_target(onnxruntime_common date::date wil)
+ target_include_directories(onnxruntime_common
+ PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS}
+ # safeint is part of onnxruntime_common public interface, so we want to propagate its includes
diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake
index 7dce1309..7102975b 100644
--- a/cmake/onnxruntime_python.cmake
@@ -71,6 +97,15 @@ index 7dce1309..7102975b 100644
)
set_property(TARGET onnxruntime_pybind11_state APPEND_STRING PROPERTY LINK_FLAGS ${ONNXRUNTIME_SO_LINK_FLAG} ${onnxruntime_DELAYLOAD_FLAGS})
add_dependencies(onnxruntime_pybind11_state ${onnxruntime_pybind11_state_dependencies})
+@@ -192,7 +190,7 @@
+ "${ONNXRUNTIME_ROOT}/python/datasets/*.onnx"
+ )
+
+-set(test_data_target onnxruntime_test_all)
++set(test_data_target onnxruntime_pybind11_state)
+
+ add_custom_command(
+ TARGET onnxruntime_pybind11_state POST_BUILD
diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake
index d1bd347c..0c4b81e4 100644
--- a/cmake/onnxruntime_unittests.cmake
@@ -79,8 +114,8 @@ index d1bd347c..0c4b81e4 100644
else()
target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} GTest::gtest GTest::gmock ${onnxruntime_EXTERNAL_LIBRARIES})
endif()
-- onnxruntime_add_include_to_target(${_UT_TARGET} date_interface safeint_interface)
-+ onnxruntime_add_include_to_target(${_UT_TARGET} date::date safeint_interface)
+- onnxruntime_add_include_to_target(${_UT_TARGET} date_interface)
++ onnxruntime_add_include_to_target(${_UT_TARGET} date::date)
target_include_directories(${_UT_TARGET} PRIVATE ${TEST_INC_DIR})
if (onnxruntime_USE_CUDA)
target_include_directories(${_UT_TARGET} PRIVATE ${CUDA_INCLUDE_DIRS} ${onnxruntime_CUDNN_HOME}/include)
@@ -89,37 +124,11 @@ index 57159083..9fa7dce0 100644
--- a/onnxruntime/core/session/inference_session_utils.h
+++ b/onnxruntime/core/session/inference_session_utils.h
@@ -6,7 +6,7 @@
- #include "core/session/inference_session.h"
- #include "core/framework/session_options.h"
- #include "core/common/common.h"
+ #pragma warning(push)
+ #pragma warning(disable : 28020)
+ #endif
-#include "single_include/nlohmann/json.hpp"
+#include <nlohmann/json.hpp>
-
- using json = nlohmann::json;
-
-diff --git a/onnxruntime/test/providers/cpu/ml/linearregressor_test.cc b/onnxruntime/test/providers/cpu/ml/linearregressor_test.cc
-index c6eb3f5f..2b6dff61 100644
---- a/onnxruntime/test/providers/cpu/ml/linearregressor_test.cc
-+++ b/onnxruntime/test/providers/cpu/ml/linearregressor_test.cc
-@@ -73,7 +73,7 @@ TEST_P(LinearRegressorTest, LinearRegressorUniTarget) {
- }
-
- // For PROBIT, all the output values are NaN.
--INSTANTIATE_TEST_SUITE_P(
-+INSTANTIATE_TEST_CASE_P(
- LinearRegressorTest, LinearRegressorTest,
- testing::Values(LinearRegressorParam("NONE", {32.0f, 14.0f, -166.0f}, 1),
- LinearRegressorParam("SOFTMAX", {32.0f, 14.0f, -166.0f}, 1),
-diff --git a/onnxruntime/test/shared_lib/test_inference.cc b/onnxruntime/test/shared_lib/test_inference.cc
-index 4b5b6731..08726f8b 100644
---- a/onnxruntime/test/shared_lib/test_inference.cc
-+++ b/onnxruntime/test/shared_lib/test_inference.cc
-@@ -184,7 +184,7 @@ TEST(CApiTest, dim_param) {
- ASSERT_EQ(strcmp(dim_param, ""), 0);
- }
-
--INSTANTIATE_TEST_SUITE_P(CApiTestWithProviders,
-+INSTANTIATE_TEST_CASE_P(CApiTestWithProviders,
- CApiTestWithProvider,
- ::testing::Values(0, 1, 2, 3, 4));
-
+ #ifdef _WIN32
+ #pragma warning(pop)
+ #endif
diff --git a/gcc10.diff b/gcc10.diff
new file mode 100644
index 000000000000..cfa85fa05f49
--- /dev/null
+++ b/gcc10.diff
@@ -0,0 +1,12 @@
+diff --git a/onnxruntime/test/onnx/heap_buffer.h b/onnxruntime/test/onnx/heap_buffer.h
+index b4abf131b1..380a65b5aa 100644
+--- a/onnxruntime/test/onnx/heap_buffer.h
++++ b/onnxruntime/test/onnx/heap_buffer.h
+@@ -4,6 +4,7 @@
+ #pragma once
+ #include <vector>
+ #include <memory>
++#include <stdlib.h>
+
+ namespace onnxruntime {
+ namespace test {
diff --git a/protobuf-debundle.patch b/protobuf-debundle.patch
new file mode 100644
index 000000000000..5a957e960bde
--- /dev/null
+++ b/protobuf-debundle.patch
@@ -0,0 +1,308 @@
+From a859dc422c17c71bf147e7dde1648e1c6bcfbaae Mon Sep 17 00:00:00 2001
+From: Changming Sun <chasun@microsoft.com>
+Date: Thu, 28 May 2020 10:05:47 -0700
+Subject: [PATCH] Delete google::protobuf::io::FileInputStream class from our
+ source code (#4067)
+
+This class is already part of the protobuf-lite library. We don't need a copy here.
+And if we do, we must ensure the signature of every function is exactly the same as the original. However, the upstream code may get changed over time. For example, recently protobuf added a "const" modifier to the FileInputStream::GetErrno(), which may break the build if a user want to use the latest protobuf.
+---
+ .../core/util/protobuf_parsing_utils.h | 288 +-----------------
+ 1 file changed, 5 insertions(+), 283 deletions(-)
+
+diff --git a/onnxruntime/core/util/protobuf_parsing_utils.h b/onnxruntime/core/util/protobuf_parsing_utils.h
+index 4c97562653..f09857d107 100644
+--- a/onnxruntime/core/util/protobuf_parsing_utils.h
++++ b/onnxruntime/core/util/protobuf_parsing_utils.h
+@@ -1,286 +1,8 @@
++// Copyright (c) Microsoft Corporation. All rights reserved.
++// Licensed under the MIT License.
+
+ #pragma once
+
+-#include <string>
+-#include <iosfwd>
+-#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
+-#include <google/protobuf/stubs/common.h>
+-
+-namespace google {
+-namespace protobuf {
+-namespace io {
+-
+-// ===================================================================
+-
+-// A ZeroCopyInputStream which reads from a file descriptor.
+-//
+-// FileInputStream is preferred over using an ifstream with IstreamInputStream.
+-// The latter will introduce an extra layer of buffering, harming performance.
+-// Also, it's conceivable that FileInputStream could someday be enhanced
+-// to use zero-copy file descriptors on OSs which support them.
+-class LIBPROTOBUF_EXPORT FileInputStream : public ZeroCopyInputStream {
+- public:
+- // Creates a stream that reads from the given Unix file descriptor.
+- // If a block_size is given, it specifies the number of bytes that
+- // should be read and returned with each call to Next(). Otherwise,
+- // a reasonable default is used.
+- explicit FileInputStream(int file_descriptor, int block_size = -1);
+-
+- // Flushes any buffers and closes the underlying file. Returns false if
+- // an error occurs during the process; use GetErrno() to examine the error.
+- // Even if an error occurs, the file descriptor is closed when this returns.
+- bool Close();
+-
+- // By default, the file descriptor is not closed when the stream is
+- // destroyed. Call SetCloseOnDelete(true) to change that. WARNING:
+- // This leaves no way for the caller to detect if close() fails. If
+- // detecting close() errors is important to you, you should arrange
+- // to close the descriptor yourself.
+- void SetCloseOnDelete(bool value) { copying_input_.SetCloseOnDelete(value); }
+-
+- // If an I/O error has occurred on this file descriptor, this is the
+- // errno from that error. Otherwise, this is zero. Once an error
+- // occurs, the stream is broken and all subsequent operations will
+- // fail.
+- int GetErrno() { return copying_input_.GetErrno(); }
+-
+- // implements ZeroCopyInputStream ----------------------------------
+- bool Next(const void** data, int* size) override;
+- void BackUp(int count) override;
+- bool Skip(int count) override;
+- int64 ByteCount() const override;
+-
+- private:
+- class LIBPROTOBUF_EXPORT CopyingFileInputStream : public CopyingInputStream {
+- public:
+- CopyingFileInputStream(int file_descriptor);
+- ~CopyingFileInputStream() override;
+-
+- bool Close();
+- void SetCloseOnDelete(bool value) { close_on_delete_ = value; }
+- int GetErrno() { return errno_; }
+-
+- // implements CopyingInputStream ---------------------------------
+- int Read(void* buffer, int size) override;
+- int Skip(int count) override;
+-
+- private:
+- // The file descriptor.
+- const int file_;
+- bool close_on_delete_;
+- bool is_closed_;
+-
+- // The errno of the I/O error, if one has occurred. Otherwise, zero.
+- int errno_;
+-
+- // Did we try to seek once and fail? If so, we assume this file descriptor
+- // doesn't support seeking and won't try again.
+- bool previous_seek_failed_;
+-
+- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CopyingFileInputStream);
+- };
+-
+- CopyingFileInputStream copying_input_;
+- CopyingInputStreamAdaptor impl_;
+-
+- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileInputStream);
+-};
+-
+-// ===================================================================
+-
+-// A ZeroCopyOutputStream which writes to a file descriptor.
+-//
+-// FileOutputStream is preferred over using an ofstream with
+-// OstreamOutputStream. The latter will introduce an extra layer of buffering,
+-// harming performance. Also, it's conceivable that FileOutputStream could
+-// someday be enhanced to use zero-copy file descriptors on OSs which
+-// support them.
+-class LIBPROTOBUF_EXPORT FileOutputStream : public ZeroCopyOutputStream {
+- public:
+- // Creates a stream that writes to the given Unix file descriptor.
+- // If a block_size is given, it specifies the size of the buffers
+- // that should be returned by Next(). Otherwise, a reasonable default
+- // is used.
+- explicit FileOutputStream(int file_descriptor, int block_size = -1);
+- ~FileOutputStream() override;
+-
+- // Flushes any buffers and closes the underlying file. Returns false if
+- // an error occurs during the process; use GetErrno() to examine the error.
+- // Even if an error occurs, the file descriptor is closed when this returns.
+- bool Close();
+-
+- // Flushes FileOutputStream's buffers but does not close the
+- // underlying file. No special measures are taken to ensure that
+- // underlying operating system file object is synchronized to disk.
+- bool Flush();
+-
+- // By default, the file descriptor is not closed when the stream is
+- // destroyed. Call SetCloseOnDelete(true) to change that. WARNING:
+- // This leaves no way for the caller to detect if close() fails. If
+- // detecting close() errors is important to you, you should arrange
+- // to close the descriptor yourself.
+- void SetCloseOnDelete(bool value) { copying_output_.SetCloseOnDelete(value); }
+-
+- // If an I/O error has occurred on this file descriptor, this is the
+- // errno from that error. Otherwise, this is zero. Once an error
+- // occurs, the stream is broken and all subsequent operations will
+- // fail.
+- int GetErrno() { return copying_output_.GetErrno(); }
+-
+- // implements ZeroCopyOutputStream ---------------------------------
+- bool Next(void** data, int* size) override;
+- void BackUp(int count) override;
+- int64 ByteCount() const override;
+-
+- private:
+- class LIBPROTOBUF_EXPORT CopyingFileOutputStream : public CopyingOutputStream {
+- public:
+- CopyingFileOutputStream(int file_descriptor);
+- ~CopyingFileOutputStream() override;
+-
+- bool Close();
+- void SetCloseOnDelete(bool value) { close_on_delete_ = value; }
+- int GetErrno() { return errno_; }
+-
+- // implements CopyingOutputStream --------------------------------
+- bool Write(const void* buffer, int size) override;
+-
+- private:
+- // The file descriptor.
+- const int file_;
+- bool close_on_delete_;
+- bool is_closed_;
+-
+- // The errno of the I/O error, if one has occurred. Otherwise, zero.
+- int errno_;
+-
+- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CopyingFileOutputStream);
+- };
+-
+- CopyingFileOutputStream copying_output_;
+- CopyingOutputStreamAdaptor impl_;
+-
+- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileOutputStream);
+-};
+-
+-// ===================================================================
+-
+-// A ZeroCopyInputStream which reads from a C++ istream.
+-//
+-// Note that for reading files (or anything represented by a file descriptor),
+-// FileInputStream is more efficient.
+-class LIBPROTOBUF_EXPORT IstreamInputStream : public ZeroCopyInputStream {
+- public:
+- // Creates a stream that reads from the given C++ istream.
+- // If a block_size is given, it specifies the number of bytes that
+- // should be read and returned with each call to Next(). Otherwise,
+- // a reasonable default is used.
+- explicit IstreamInputStream(std::istream* stream, int block_size = -1);
+-
+- // implements ZeroCopyInputStream ----------------------------------
+- bool Next(const void** data, int* size) override;
+- void BackUp(int count) override;
+- bool Skip(int count) override;
+- int64 ByteCount() const override;
+-
+- private:
+- class LIBPROTOBUF_EXPORT CopyingIstreamInputStream : public CopyingInputStream {
+- public:
+- CopyingIstreamInputStream(std::istream* input);
+- ~CopyingIstreamInputStream() override;
+-
+- // implements CopyingInputStream ---------------------------------
+- int Read(void* buffer, int size) override;
+- // (We use the default implementation of Skip().)
+-
+- private:
+- // The stream.
+- std::istream* input_;
+-
+- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CopyingIstreamInputStream);
+- };
+-
+- CopyingIstreamInputStream copying_input_;
+- CopyingInputStreamAdaptor impl_;
+-
+- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(IstreamInputStream);
+-};
+-
+-// ===================================================================
+-
+-// A ZeroCopyOutputStream which writes to a C++ ostream.
+-//
+-// Note that for writing files (or anything represented by a file descriptor),
+-// FileOutputStream is more efficient.
+-class LIBPROTOBUF_EXPORT OstreamOutputStream : public ZeroCopyOutputStream {
+- public:
+- // Creates a stream that writes to the given C++ ostream.
+- // If a block_size is given, it specifies the size of the buffers
+- // that should be returned by Next(). Otherwise, a reasonable default
+- // is used.
+- explicit OstreamOutputStream(std::ostream* stream, int block_size = -1);
+- ~OstreamOutputStream() override;
+-
+- // implements ZeroCopyOutputStream ---------------------------------
+- bool Next(void** data, int* size) override;
+- void BackUp(int count) override;
+- int64 ByteCount() const override;
+-
+- private:
+- class LIBPROTOBUF_EXPORT CopyingOstreamOutputStream : public CopyingOutputStream {
+- public:
+- CopyingOstreamOutputStream(std::ostream* output);
+- ~CopyingOstreamOutputStream() override;
+-
+- // implements CopyingOutputStream --------------------------------
+- bool Write(const void* buffer, int size) override;
+-
+- private:
+- // The stream.
+- std::ostream* output_;
+-
+- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CopyingOstreamOutputStream);
+- };
+-
+- CopyingOstreamOutputStream copying_output_;
+- CopyingOutputStreamAdaptor impl_;
+-
+- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OstreamOutputStream);
+-};
+-
+-// ===================================================================
+-
+-// A ZeroCopyInputStream which reads from several other streams in sequence.
+-// ConcatenatingInputStream is unable to distinguish between end-of-stream
+-// and read errors in the underlying streams, so it assumes any errors mean
+-// end-of-stream. So, if the underlying streams fail for any other reason,
+-// ConcatenatingInputStream may do odd things. It is suggested that you do
+-// not use ConcatenatingInputStream on streams that might produce read errors
+-// other than end-of-stream.
+-class LIBPROTOBUF_EXPORT ConcatenatingInputStream : public ZeroCopyInputStream {
+- public:
+- // All streams passed in as well as the array itself must remain valid
+- // until the ConcatenatingInputStream is destroyed.
+- ConcatenatingInputStream(ZeroCopyInputStream* const streams[], int count);
+-
+- // implements ZeroCopyInputStream ----------------------------------
+- bool Next(const void** data, int* size) override;
+- void BackUp(int count) override;
+- bool Skip(int count) override;
+- int64 ByteCount() const override;
+-
+- private:
+- // As streams are retired, streams_ is incremented and count_ is
+- // decremented.
+- ZeroCopyInputStream* const* streams_;
+- int stream_count_;
+- int64 bytes_retired_; // Bytes read from previous streams.
+-
+- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ConcatenatingInputStream);
+-};
+-
+-
+-} // namespace io
+-} // namespace protobuf
+-
+-} // namespace google
++#include <google/protobuf/io/zero_copy_stream_impl.h>
++
++