From a28b42a42cab28c1292b6e7862aaa8ef499f1784 Mon Sep 17 00:00:00 2001 From: Tao Qin <48697806+TaoQinMS@users.noreply.github.com> Date: Tue, 26 Mar 2019 13:15:59 -0700 Subject: [PATCH] Fix path_lib.h for Mac and refine #include in InferenceSesssion.h (#711) * Fix path_lib.h for macox py build * don't have to include path_lib.h for model path in InferenceSession --- onnxruntime/core/framework/path_lib.h | 2 +- onnxruntime/core/session/inference_session.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/onnxruntime/core/framework/path_lib.h b/onnxruntime/core/framework/path_lib.h index d28e678901..7845bbf535 100644 --- a/onnxruntime/core/framework/path_lib.h +++ b/onnxruntime/core/framework/path_lib.h @@ -236,7 +236,7 @@ void LoopDir(const std::string& dir_name, T func) { auto e = errno; char buf[1024]; char* msg; -#ifdef _GNU_SOURCE +#if defined(_GNU_SOURCE) && !defined(__APPLE__) msg = strerror_r(e, buf, sizeof(buf)); #else // for Mac OS X diff --git a/onnxruntime/core/session/inference_session.h b/onnxruntime/core/session/inference_session.h index d9b6b6d9e3..9dd21f04e8 100644 --- a/onnxruntime/core/session/inference_session.h +++ b/onnxruntime/core/session/inference_session.h @@ -14,7 +14,6 @@ #include "core/framework/framework_common.h" #include "core/framework/iexecutor.h" #include "core/framework/kernel_registry_manager.h" -#include "core/framework/path_lib.h" #include "core/framework/session_state.h" #include "core/graph/basic_types.h" #include "core/optimizer/graph_transformer_level.h" @@ -313,7 +312,7 @@ class InferenceSession { std::unordered_set model_output_names_; // The file path of where the model was loaded. e.g. /tmp/test_squeezenet/model.onnx - std::basic_string model_location_; + std::basic_string model_location_; private: ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(InferenceSession);