From 1008a184e989134a5a42db727a084d9e6a4a1cb6 Mon Sep 17 00:00:00 2001
From: Dmitry Kalinkin <dkalinkin@bnl.gov>
Date: Tue, 5 Jul 2022 20:31:14 +0000
Subject: [PATCH] fix build on macOS

---
 src/BarrelBarDetectorWithSideFrame_geo.cpp |  1 +
 src/BarrelTrackerWithFrame_geo.cpp         |  1 +
 src/FieldMapBrBz.cpp                       |  2 +-
 src/FileLoaderHelper.h                     | 12 ++++++------
 src/TrapEndcapTracker_geo.cpp              |  1 +
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/BarrelBarDetectorWithSideFrame_geo.cpp b/src/BarrelBarDetectorWithSideFrame_geo.cpp
index d7911bde..7b2adc29 100644
--- a/src/BarrelBarDetectorWithSideFrame_geo.cpp
+++ b/src/BarrelBarDetectorWithSideFrame_geo.cpp
@@ -16,6 +16,7 @@
 #include "DDRec/DetectorData.h"
 #include "DDRec/Surface.h"
 #include "XML/Layering.h"
+#include <array>
 
 using namespace std;
 using namespace dd4hep;
diff --git a/src/BarrelTrackerWithFrame_geo.cpp b/src/BarrelTrackerWithFrame_geo.cpp
index ea0420a0..9470042e 100644
--- a/src/BarrelTrackerWithFrame_geo.cpp
+++ b/src/BarrelTrackerWithFrame_geo.cpp
@@ -13,6 +13,7 @@
 #include "DDRec/DetectorData.h"
 #include "XML/Layering.h"
 #include "XML/Utilities.h"
+#include <array>
 
 #if defined(USE_ACTSDD4HEP)
 #include "ActsDD4hep/ActsExtension.hpp"
diff --git a/src/FieldMapBrBz.cpp b/src/FieldMapBrBz.cpp
index b3c5af11..7215411b 100644
--- a/src/FieldMapBrBz.cpp
+++ b/src/FieldMapBrBz.cpp
@@ -195,7 +195,7 @@ static Ref_t create_field_map_brbz(Detector & /*lcdd*/, xml::Handle_t handle)
     if( !fs::exists(fs::path(field_map_file))  ) {
         printout(ERROR, "FieldMapBrBz", "file " + field_map_file + " does not exist");
         printout(ERROR, "FieldMapBrBz", "use a FileLoader plugin before the field element");
-        std::quick_exit(1);
+        std::_Exit(EXIT_FAILURE);
     }
 
     auto map = new FieldMapBrBz(field_type);
diff --git a/src/FileLoaderHelper.h b/src/FileLoaderHelper.h
index ea310e2f..821350cd 100644
--- a/src/FileLoaderHelper.h
+++ b/src/FileLoaderHelper.h
@@ -54,7 +54,7 @@ EnsureFileFromURLExists(
     if (fs::create_directories(parent_path) == false) {
       printout(ERROR, "FileLoader", "parent path " + parent_path.string() + " cannot be created");
       printout(ERROR, "FileLoader", "check permissions and retry");
-      std::quick_exit(1);
+      std::_Exit(EXIT_FAILURE);
     }
   }
 
@@ -85,7 +85,7 @@ EnsureFileFromURLExists(
           } catch (const fs::filesystem_error&) {
             printout(ERROR, "FileLoader", "unable to link from " + hash_path.string() + " to " + cache_hash_path.string());
             printout(ERROR, "FileLoader", "check permissions and retry");
-            std::quick_exit(1);
+            std::_Exit(EXIT_FAILURE);
           }
           break;
         }
@@ -103,7 +103,7 @@ EnsureFileFromURLExists(
       printout(ERROR, "FileLoader", "unable to run cmd " + cmd);
       printout(ERROR, "FileLoader", "check command and retry");
       printout(ERROR, "FileLoader", "hint: allow insecure connections with -k");
-      std::quick_exit(1);
+      std::_Exit(EXIT_FAILURE);
     }
   }
 
@@ -120,14 +120,14 @@ EnsureFileFromURLExists(
         if (fs::remove(file_path) == false) {
           printout(ERROR, "FileLoader", "unable to remove symlink " + file_path.string());
           printout(ERROR, "FileLoader", "check permissions or remove manually");
-          std::quick_exit(1);
+          std::_Exit(EXIT_FAILURE);
         }
       }
     } else {
       // file exists but not symlink
       printout(ERROR, "FileLoader", "will not remove actual file " + file_path.string());
       printout(ERROR, "FileLoader", "check content, remove manually, and retry");
-      std::quick_exit(1);
+      std::_Exit(EXIT_FAILURE);
     }
   }
   // file_path now does not exist
@@ -139,6 +139,6 @@ EnsureFileFromURLExists(
   } catch (const fs::filesystem_error&) {
     printout(ERROR, "FileLoader", "unable to link from " + file_path.string() + " to " + hash_path.string());
     printout(ERROR, "FileLoader", "check permissions and retry");
-    std::quick_exit(1);
+    std::_Exit(EXIT_FAILURE);
   }
 }
diff --git a/src/TrapEndcapTracker_geo.cpp b/src/TrapEndcapTracker_geo.cpp
index 01ff4ef0..f65d8498 100644
--- a/src/TrapEndcapTracker_geo.cpp
+++ b/src/TrapEndcapTracker_geo.cpp
@@ -6,6 +6,7 @@
  *
  * @{
  */
+#include <array>
 #include <map>
 #include "DD4hep/DetFactoryHelper.h"
 #include "DD4hep/Printout.h"
-- 
GitLab