diff --git a/onnxruntime/core/graph/graph.cc b/onnxruntime/core/graph/graph.cc index 95e66aa4c8..3670224764 100644 --- a/onnxruntime/core/graph/graph.cc +++ b/onnxruntime/core/graph/graph.cc @@ -581,7 +581,7 @@ Status Node::LoadFromOrtFormat(const onnxruntime::experimental::fbs::Node& fbs_n bool check_parent_graph = false) -> Status { ORT_RETURN_IF(nullptr == fbs_node_arg_names, "fbs_node_arg_names cannot be null"); node_args.reserve(fbs_node_arg_names->size()); - for (const auto& node_arg_name : *fbs_node_arg_names) { + for (const auto* node_arg_name : *fbs_node_arg_names) { ORT_RETURN_IF(nullptr == node_arg_name, "node_arg_name cannot be null"); auto* node_arg = check_parent_graph ? graph_->GetNodeArgIncludingParentGraphs(node_arg_name->str()) : graph_->GetNodeArg(node_arg_name->str()); diff --git a/onnxruntime/core/graph/graph_flatbuffers_utils.cc b/onnxruntime/core/graph/graph_flatbuffers_utils.cc index f97f7b39e0..871432b8c4 100644 --- a/onnxruntime/core/graph/graph_flatbuffers_utils.cc +++ b/onnxruntime/core/graph/graph_flatbuffers_utils.cc @@ -292,7 +292,7 @@ Status LoadInitializerOrtFormat(const fbs::Tensor& fbs_tensor, ORT_RETURN_IF(nullptr == fbs_str_data, "Missing string data for initializer. Invalid ORT format model."); auto mutable_str_data = initializer.mutable_string_data(); mutable_str_data->Reserve(fbs_str_data->size()); - for (const auto& fbs_str : *fbs_str_data) { + for (const auto* fbs_str : *fbs_str_data) { mutable_str_data->Add(fbs_str->str()); } } else { diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 51a5f2c16c..84f9fd1370 100755 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -1547,6 +1547,12 @@ def build_protoc_for_host(cmake_path, source_dir, build_dir, args): elif is_macOS(): if args.use_xcode: cmd_args += ['-G', 'Xcode'] + # CMake < 3.18 has a bug setting system arch to arm64 (if not specified) for Xcode 12, + # protoc for host should be built using host architecture + # Explicitly specify the CMAKE_OSX_ARCHITECTURES for x86_64 Mac. + import platform + if platform.machine() == 'x86_64': + cmd_args += ['-DCMAKE_OSX_ARCHITECTURES=x86_64'] run_subprocess(cmd_args, cwd=protoc_build_dir) # Build step