changeset 3461:7fc9dd4882ec

merge
author Alain Mazy <alain@mazy.be>
date Tue, 09 Jul 2019 10:30:44 +0200
parents fbe22748cd9c (current diff) cbbe0bb80bd4 (diff)
children 7d72e43f4a2d
files
diffstat 3 files changed, 51 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Tue Jul 09 10:30:30 2019 +0200
+++ b/Core/Toolbox.cpp	Tue Jul 09 10:30:44 2019 +0200
@@ -144,6 +144,10 @@
  
 
 
+#if defined(__unix__) && ORTHANC_SANDBOXED != 1
+#  include "SystemToolbox.h"  // Check out "InitializeGlobalLocale()"
+#endif
+
 
 
 namespace Orthanc
@@ -1416,8 +1420,6 @@
 
   static bool SetGlobalLocale(const char* locale)
   {
-    globalLocale_.reset(NULL);
-
     try
     {
       if (locale == NULL)
@@ -1431,8 +1433,12 @@
         globalLocale_.reset(new std::locale(locale));
       }
     }
-    catch (std::runtime_error&)
+    catch (std::runtime_error& e)
     {
+      LOG(ERROR) << "Cannot set globale locale to "
+                 << (locale ? std::string(locale) : "(null)")
+                 << ": " << e.what();
+      globalLocale_.reset(NULL);
     }
 
     return (globalLocale_.get() != NULL);
@@ -1538,6 +1544,23 @@
   {
     InitializeIcu();
 
+#if defined(__unix__) && ORTHANC_SANDBOXED != 1
+    static const char* LOCALTIME = "/etc/localtime";
+    
+    if (!SystemToolbox::IsExistingFile(LOCALTIME))
+    {
+      // Check out file
+      // "boost_1_69_0/libs/locale/src/icu/time_zone.cpp": Direct
+      // access is made to this file if ICU is not used. Crash arises
+      // in Boost if the file is a symbolic link to a non-existing
+      // file (such as in Ubuntu 16.04 base Docker image).
+      throw OrthancException(
+        ErrorCode_InternalError,
+        "On UNIX-like systems, the file " + std::string(LOCALTIME) +
+        " must be present on the filesystem (install \"tzdata\" package on Debian)");
+    }
+#endif
+
     // Make Orthanc use English, United States locale
     // Linux: use "en_US.UTF-8"
     // Windows: use ""
--- a/LinuxCompilation.txt	Tue Jul 09 10:30:30 2019 +0200
+++ b/LinuxCompilation.txt	Tue Jul 09 10:30:44 2019 +0200
@@ -145,6 +145,30 @@
 # ninja
 
 
+SUPPORTED - Ubuntu 18.04 LTS
+----------------------------
+
+# sudo apt-get install build-essential unzip cmake mercurial \
+       	       	       uuid-dev libcurl4-openssl-dev liblua5.3-0-dev \
+       	       	       libgtest-dev libpng-dev libsqlite3-dev libssl-dev libjpeg-dev \
+		       zlib1g-dev libdcmtk2-dev libboost-all-dev libwrap0-dev \
+                       libcharls-dev libjsoncpp-dev libpugixml-dev locales
+
+# cmake -DALLOW_DOWNLOADS=ON \
+        -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON \
+        -DUSE_SYSTEM_CIVETWEB=OFF \
+        -DDCMTK_LIBRARIES=dcmjpls \
+        -DCMAKE_BUILD_TYPE=Release \
+        ~/Orthanc
+# make
+
+
+NB: A suitable environment for locales can be setup as follows:
+
+# echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
+# locale-gen
+
+
 
 SUPPORTED - Fedora 20-22
 ------------------------
--- a/Resources/CMake/Compiler.cmake	Tue Jul 09 10:30:30 2019 +0200
+++ b/Resources/CMake/Compiler.cmake	Tue Jul 09 10:30:44 2019 +0200
@@ -164,7 +164,7 @@
     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MINGW_NO_WARNINGS}")
 
     # This is a patch for MinGW64
-    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
+    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
     SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
 
     CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD)