changeset 5067:6ad2bea0e07e

upgrade to DCMTK 3.6.7
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Aug 2022 15:34:02 +0200
parents 956a9fed0aa8
children 02fae039a15d
files NEWS OrthancFramework/Resources/CMake/DcmtkConfiguration.cmake OrthancFramework/Resources/CMake/DcmtkConfigurationStatic-3.6.7.cmake OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake OrthancFramework/Resources/Patches/dcmtk-3.6.7.patch OrthancFramework/Resources/Patches/dcmtk.txt OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake OrthancServer/CMakeLists.txt OrthancServer/UnitTestsSources/VersionsTests.cpp
diffstat 9 files changed, 374 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Aug 15 14:22:50 2022 +0200
+++ b/NEWS	Mon Aug 15 15:34:02 2022 +0200
@@ -25,6 +25,7 @@
 * Fix static compilation of boost 1.69 on Ubuntu 22.04
 * Upgraded dependencies for static builds:
   - boost 1.80.0
+  - dcmtk 3.6.7
 
 
 Version 1.11.1 (2022-06-30)
--- a/OrthancFramework/Resources/CMake/DcmtkConfiguration.cmake	Mon Aug 15 14:22:50 2022 +0200
+++ b/OrthancFramework/Resources/CMake/DcmtkConfiguration.cmake	Mon Aug 15 15:34:02 2022 +0200
@@ -34,6 +34,8 @@
     include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.5.cmake)
   elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.6")
     include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.6.cmake)
+  elseif (DCMTK_STATIC_VERSION STREQUAL "3.6.7")
+    include(${CMAKE_CURRENT_LIST_DIR}/DcmtkConfigurationStatic-3.6.7.cmake)
   else()
     message(FATAL_ERROR "Unsupported version of DCMTK: ${DCMTK_STATIC_VERSION}")
   endif()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Resources/CMake/DcmtkConfigurationStatic-3.6.7.cmake	Mon Aug 15 15:34:02 2022 +0200
@@ -0,0 +1,240 @@
+# Orthanc - A Lightweight, RESTful DICOM Store
+# Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+# Department, University Hospital of Liege, Belgium
+# Copyright (C) 2017-2022 Osimis S.A., Belgium
+# Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+
+SET(DCMTK_VERSION_NUMBER 367)
+SET(DCMTK_PACKAGE_VERSION "3.6.7")
+SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.7)
+SET(DCMTK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/dcmtk-3.6.7.tar.gz")
+SET(DCMTK_MD5 "e4d519bb315ec3944f3f1d61df465cbd")
+
+macro(DCMTK_UNSET)
+endmacro()
+
+macro(DCMTK_UNSET_CACHE)
+endmacro()
+
+set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/)
+set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/)
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+  set(DCMTK_WITH_THREADS OFF)  # Disable thread support in wasm/asm.js
+else()
+  set(DCMTK_WITH_THREADS ON)
+endif()
+
+add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1)
+
+if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
+  set(FirstRun OFF)
+else()
+  set(FirstRun ON)
+endif()
+
+DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
+
+
+if (FirstRun)
+  # Apply the patches
+  execute_process(
+    COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
+    ${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.7.patch
+    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+    RESULT_VARIABLE Failure
+    )
+
+  if (Failure)
+    message(FATAL_ERROR "Error while patching a file")
+  endif()
+
+  configure_file(
+    ${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-dcdict_orthanc.cc
+    ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc
+    COPYONLY)
+else()
+  message("The patches for DCMTK have already been applied")
+endif()
+
+
+include_directories(
+  ${DCMTK_SOURCES_DIR}/dcmiod/include
+  )
+
+
+# C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake"
+IF (CMAKE_CROSSCOMPILING)
+  if (CMAKE_COMPILER_IS_GNUCXX AND
+      CMAKE_SYSTEM_NAME STREQUAL "Windows")  # MinGW
+    SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
+
+  elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")  # WebAssembly or asm.js
+
+    # Check out "../WebAssembly/ArithmeticTests/" to regenerate the
+    # "arith.h" file
+    configure_file(
+      ${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h
+      ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h
+      COPYONLY)
+
+    UNSET(C_CHAR_UNSIGNED CACHE)
+    SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "")
+
+  else()
+    message(FATAL_ERROR "Support your platform here")
+  endif()
+ENDIF()
+
+
+if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
+  SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "")
+  SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "")
+endif()
+
+
+SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR})
+include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
+include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
+
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")  # WebAssembly or
+  # asm.js The macros below are not properly discovered by DCMTK
+  # when using WebAssembly. Check out "../WebAssembly/arith.h" for
+  # how we produced these values. This step MUST be after
+  # "GenerateDCMTKConfigure" and before the generation of
+  # "osconfig.h".
+  UNSET(SIZEOF_VOID_P   CACHE)
+  UNSET(SIZEOF_CHAR     CACHE)
+  UNSET(SIZEOF_DOUBLE   CACHE)
+  UNSET(SIZEOF_FLOAT    CACHE)
+  UNSET(SIZEOF_INT      CACHE)
+  UNSET(SIZEOF_LONG     CACHE)
+  UNSET(SIZEOF_SHORT    CACHE)
+  UNSET(SIZEOF_VOID_P   CACHE)
+
+  SET(SIZEOF_VOID_P 4   CACHE INTERNAL "")
+  SET(SIZEOF_CHAR 1     CACHE INTERNAL "")
+  SET(SIZEOF_DOUBLE 8   CACHE INTERNAL "")
+  SET(SIZEOF_FLOAT 4    CACHE INTERNAL "")
+  SET(SIZEOF_INT 4      CACHE INTERNAL "")
+  SET(SIZEOF_LONG 4     CACHE INTERNAL "")
+  SET(SIZEOF_SHORT 2    CACHE INTERNAL "")
+  SET(SIZEOF_VOID_P 4   CACHE INTERNAL "")
+endif()
+
+
+set(DCMTK_PACKAGE_VERSION_SUFFIX "")
+set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER})
+
+
+# For the dcmtls module, necessary since DCMTK 3.6.7 (cf. file
+# "dcmtls/libsrc/tlslayer.cc"). This must be done before the
+# invokation of "configure_file()"!
+CHECK_FUNCTIONWITHHEADER_EXISTS("DH_bits" "openssl/dh.h" HAVE_OPENSSL_PROTOTYPE_DH_BITS)
+CHECK_FUNCTIONWITHHEADER_EXISTS("EVP_PKEY_base_id" "openssl/evp.h" HAVE_OPENSSL_PROTOTYPE_EVP_PKEY_BASE_ID)
+CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get0_param" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET0_PARAM)
+CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_cert_store" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CERT_STORE)
+CHECK_FUNCTIONWITHHEADER_EXISTS("SSL_CTX_get_ciphers" "openssl/ssl.h" HAVE_OPENSSL_PROTOTYPE_SSL_CTX_GET_CIPHERS)
+CHECK_FUNCTIONWITHHEADER_EXISTS("X509_STORE_get0_param" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_STORE_GET0_PARAM)
+CHECK_FUNCTIONWITHHEADER_EXISTS("X509_get_signature_nid" "openssl/x509.h" HAVE_OPENSSL_PROTOTYPE_X509_GET_SIGNATURE_NID)
+
+
+CONFIGURE_FILE(
+  ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
+  ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
+
+
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  link_libraries(netapi32)  # For NetWkstaUserGetInfo@12
+  link_libraries(iphlpapi)  # For GetAdaptersInfo@8
+
+  # Configure Wine if cross-compiling for Windows
+  if (CMAKE_COMPILER_IS_GNUCXX)
+    include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake)
+    FIND_PROGRAM(WINE_WINE_PROGRAM wine)
+    FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath)
+    list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static")
+  endif()
+endif()
+
+# This step must be after the generation of "osconfig.h"
+if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+  INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES()
+endif()
+
+
+# Source for the logging facility of DCMTK
+AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
+    ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
+    ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
+    ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
+    ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
+    ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
+  list(REMOVE_ITEM DCMTK_SOURCES 
+    ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
+    ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
+    ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
+    )
+
+elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  list(REMOVE_ITEM DCMTK_SOURCES 
+    ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
+    ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
+    )
+endif()
+
+
+# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
+# default since this does not seem to be appropriate (anymore) for
+# most modern operating systems. In order to change this default, the
+# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
+# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
+# be defined to change this setting at compilation time (see
+# macros.txt for details).
+# https://forum.dcmtk.org/viewtopic.php?t=4632
+add_definitions(
+  -DDISABLE_NAGLE_ALGORITHM=1
+  )
+
+
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  # For compatibility with Windows XP, avoid using fiber-local-storage
+  # in log4cplus, but use thread-local-storage instead. Otherwise,
+  # Windows XP complains about missing "FlsGetValue()" in KERNEL32.dll
+  add_definitions(
+    -DDCMTK_LOG4CPLUS_AVOID_WIN32_FLS
+    )
+
+  if (CMAKE_COMPILER_IS_GNUCXX OR             # MinGW
+      "${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")  # MSVC for 32bit (*)
+
+    # (*) With multithreaded logging enabled, Visual Studio 2008 fails
+    # with error: ".\dcmtk-3.6.7\oflog\libsrc\globinit.cc(422) : error
+    # C2664: 'dcmtk::log4cplus::thread::impl::tls_init' : cannot
+    # convert parameter 1 from 'void (__stdcall *)(void *)' to
+    # 'dcmtk::log4cplus::thread::impl::tls_init_cleanup_func_type'"
+    #   None of the functions with this name in scope match the target type
+
+    add_definitions(
+      -DDCMTK_LOG4CPLUS_SINGLE_THREADED
+      )
+  endif()
+endif()
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake	Mon Aug 15 14:22:50 2022 +0200
+++ b/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake	Mon Aug 15 15:34:02 2022 +0200
@@ -77,7 +77,7 @@
 
 # Parameters specific to DCMTK
 set(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)")
-set(DCMTK_STATIC_VERSION "3.6.6" CACHE STRING "Version of DCMTK to be used in static builds (can be \"3.6.0\", \"3.6.2\", \"3.6.4\", \"3.6.5\", or \"3.6.6\")")
+set(DCMTK_STATIC_VERSION "3.6.7" CACHE STRING "Version of DCMTK to be used in static builds (can be \"3.6.0\", \"3.6.2\", \"3.6.4\", \"3.6.5\", \"3.6.6\", or \"3.6.7\")")
 set(USE_DCMTK_362_PRIVATE_DIC ON CACHE BOOL "Use the dictionary of private tags from DCMTK 3.6.2 if using DCMTK 3.6.0")
 set(USE_SYSTEM_DCMTK ON CACHE BOOL "Use the system version of DCMTK")
 set(ENABLE_DCMTK_LOG ON CACHE BOOL "Enable logging internal to DCMTK")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Resources/Patches/dcmtk-3.6.7.patch	Mon Aug 15 15:34:02 2022 +0200
@@ -0,0 +1,123 @@
+diff -urEb dcmtk-3.6.7.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.7/CMake/GenerateDCMTKConfigure.cmake
+--- dcmtk-3.6.7.orig/CMake/GenerateDCMTKConfigure.cmake	2022-08-15 14:28:32.373922631 +0200
++++ dcmtk-3.6.7/CMake/GenerateDCMTKConfigure.cmake	2022-08-15 14:29:43.341136298 +0200
+@@ -183,6 +183,8 @@
+ 
+ # Check the sizes of various types
+ include (CheckTypeSize)
++if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
++  # This doesn't work for wasm, Orthanc defines the macros manually
+ CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
+ CHECK_TYPE_SIZE("double" SIZEOF_DOUBLE)
+ CHECK_TYPE_SIZE("float" SIZEOF_FLOAT)
+@@ -190,6 +192,7 @@
+ CHECK_TYPE_SIZE("long" SIZEOF_LONG)
+ CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
+ CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P)
++endif()
+ 
+ # Check for include files, libraries, and functions
+ include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake")
+diff -urEb dcmtk-3.6.7.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.7/dcmdata/include/dcmtk/dcmdata/dcdict.h
+--- dcmtk-3.6.7.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h	2022-08-15 14:28:32.421922100 +0200
++++ dcmtk-3.6.7/dcmdata/include/dcmtk/dcmdata/dcdict.h	2022-08-15 14:30:16.224771418 +0200
+@@ -162,6 +162,12 @@
+     /// returns an iterator to the end of the repeating tag dictionary
+     DcmDictEntryListIterator repeatingEnd() { return repDict.end(); }
+ 
++    // Function by the Orthanc project to load a dictionary from a
++    // memory buffer, which is necessary in sandboxed
++    // environments. This is an adapted version of
++    // DcmDataDictionary::loadDictionary().
++    OFBool loadFromMemory(const std::string& content, OFBool errorIfAbsent = OFTrue);
++
+ private:
+ 
+     /** private undefined assignment operator
+diff -urEb dcmtk-3.6.7.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.7/dcmdata/libsrc/dcdict.cc
+--- dcmtk-3.6.7.orig/dcmdata/libsrc/dcdict.cc	2022-08-15 14:28:32.421922100 +0200
++++ dcmtk-3.6.7/dcmdata/libsrc/dcdict.cc	2022-08-15 14:31:15.220116058 +0200
+@@ -892,3 +892,5 @@
+   wrlock().clear();
+   wrunlock();
+ }
++
++#include "dcdict_orthanc.cc"
+diff -urEb dcmtk-3.6.7.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.7/dcmdata/libsrc/dcpxitem.cc
+--- dcmtk-3.6.7.orig/dcmdata/libsrc/dcpxitem.cc	2022-08-15 14:28:32.425922056 +0200
++++ dcmtk-3.6.7/dcmdata/libsrc/dcpxitem.cc	2022-08-15 14:31:28.887964099 +0200
+@@ -31,6 +31,9 @@
+ #include "dcmtk/dcmdata/dcostrma.h"    /* for class DcmOutputStream */
+ #include "dcmtk/dcmdata/dcwcache.h"    /* for class DcmWriteCache */
+ 
++#undef max
++#include "dcmtk/ofstd/oflimits.h"
++
+ 
+ // ********************************
+ 
+diff -urEb dcmtk-3.6.7.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.7/oflog/include/dcmtk/oflog/thread/syncpub.h
+--- dcmtk-3.6.7.orig/oflog/include/dcmtk/oflog/thread/syncpub.h	2022-08-15 14:28:32.401922322 +0200
++++ dcmtk-3.6.7/oflog/include/dcmtk/oflog/thread/syncpub.h	2022-08-15 14:31:52.415702413 +0200
+@@ -63,7 +63,7 @@
+ 
+ DCMTK_LOG4CPLUS_INLINE_EXPORT
+ Mutex::Mutex (Mutex::Type t)
+-    : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t) + 0))
++    : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)))
+ { }
+ 
+ 
+@@ -106,7 +106,7 @@
+ DCMTK_LOG4CPLUS_INLINE_EXPORT
+ Semaphore::Semaphore (unsigned DCMTK_LOG4CPLUS_THREADED (max),
+     unsigned DCMTK_LOG4CPLUS_THREADED (initial))
+-    : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial) + 0))
++    : sem (DCMTK_LOG4CPLUS_THREADED (new impl::Semaphore (max, initial)))
+ { }
+ 
+ 
+@@ -190,7 +190,7 @@
+ 
+ DCMTK_LOG4CPLUS_INLINE_EXPORT
+ ManualResetEvent::ManualResetEvent (bool DCMTK_LOG4CPLUS_THREADED (sig))
+-    : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig) + 0))
++    : ev (DCMTK_LOG4CPLUS_THREADED (new impl::ManualResetEvent (sig)))
+ { }
+ 
+ 
+@@ -252,7 +252,7 @@
+ 
+ DCMTK_LOG4CPLUS_INLINE_EXPORT
+ SharedMutex::SharedMutex ()
+-    : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex + 0))
++    : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex))
+ { }
+ 
+ 
+diff -urEb dcmtk-3.6.7.orig/oflog/libsrc/oflog.cc dcmtk-3.6.7/oflog/libsrc/oflog.cc
+--- dcmtk-3.6.7.orig/oflog/libsrc/oflog.cc	2022-08-15 14:28:32.405922278 +0200
++++ dcmtk-3.6.7/oflog/libsrc/oflog.cc	2022-08-15 14:32:16.815430896 +0200
+@@ -19,6 +19,10 @@
+  *
+  */
+ 
++#if defined(_WIN32)
++#  include <winsock2.h>
++#endif
++
+ #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
+ #include "dcmtk/oflog/oflog.h"
+ 
+diff -urEb dcmtk-3.6.7.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.7/ofstd/include/dcmtk/ofstd/offile.h
+--- dcmtk-3.6.7.orig/ofstd/include/dcmtk/ofstd/offile.h	2022-08-15 14:28:32.425922056 +0200
++++ dcmtk-3.6.7/ofstd/include/dcmtk/ofstd/offile.h	2022-08-15 14:32:41.471156396 +0200
+@@ -570,7 +570,7 @@
+    */
+   void setlinebuf()
+   {
+-#if defined(_WIN32) || defined(__hpux)
++#if defined(_WIN32) || defined(__hpux) || defined(__LSB_VERSION__)
+     this->setvbuf(NULL, _IOLBF, 0);
+ #else
+     :: setlinebuf(file_);
--- a/OrthancFramework/Resources/Patches/dcmtk.txt	Mon Aug 15 14:22:50 2022 +0200
+++ b/OrthancFramework/Resources/Patches/dcmtk.txt	Mon Aug 15 15:34:02 2022 +0200
@@ -6,6 +6,7 @@
 diff -urEb dcmtk-3.6.4.orig/ dcmtk-3.6.4
 diff -urEb dcmtk-3.6.5.orig/ dcmtk-3.6.5
 diff -urEb dcmtk-3.6.6.orig/ dcmtk-3.6.6
+diff -urEb dcmtk-3.6.7.orig/ dcmtk-3.6.7
 
 
 For "dcmtk-3.6.2-private.dic" (only used with DCMTK 3.6.0)
--- a/OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake	Mon Aug 15 14:22:50 2022 +0200
+++ b/OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake	Mon Aug 15 15:34:02 2022 +0200
@@ -22,11 +22,11 @@
 #
 # Full build, as used on the BuildBot CIS:
 #
-#   $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake ../OrthancServer/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_LIBICU=ON -DBOOST_LOCALE_BACKEND=icu -DENABLE_PKCS11=ON -G Ninja
+#   $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake ../OrthancServer/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_LIBICU=ON -DUSE_LEGACY_BOOST=ON -DBOOST_LOCALE_BACKEND=icu -DENABLE_PKCS11=ON -G Ninja
 #
 # Or, more lightweight version (without libp11 and ICU):
 #
-#   $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake ../OrthancServer/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -G Ninja
+#   $ LSB_CC=gcc-4.8 LSB_CXX=g++-4.8 cmake ../OrthancServer/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../OrthancFramework/Resources/Toolchains/LinuxStandardBaseToolchain.cmake -DUSE_LEGACY_JSONCPP=ON -DUSE_LEGACY_BOOST=ON -G Ninja
 #
 
 INCLUDE(CMakeForceCompiler)
--- a/OrthancServer/CMakeLists.txt	Mon Aug 15 14:22:50 2022 +0200
+++ b/OrthancServer/CMakeLists.txt	Mon Aug 15 15:34:02 2022 +0200
@@ -582,6 +582,7 @@
     -DALLOW_DOWNLOADS=${ALLOW_DOWNLOADS}
     -DUSE_SYSTEM_BOOST=${USE_SYSTEM_BOOST}
     -DUSE_LEGACY_JSONCPP=${USE_LEGACY_JSONCPP}
+    -DUSE_LEGACY_BOOST=${USE_LEGACY_BOOST}
     ${ConnectivityChecksFlags}
 
     -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
@@ -652,6 +653,7 @@
     -DALLOW_DOWNLOADS=${ALLOW_DOWNLOADS}
     -DUSE_SYSTEM_BOOST=${USE_SYSTEM_BOOST}
     -DUSE_LEGACY_JSONCPP=${USE_LEGACY_JSONCPP}
+    -DUSE_LEGACY_BOOST=${USE_LEGACY_BOOST}
     ${DelayedDeletionFlags}
 
     -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
--- a/OrthancServer/UnitTestsSources/VersionsTests.cpp	Mon Aug 15 14:22:50 2022 +0200
+++ b/OrthancServer/UnitTestsSources/VersionsTests.cpp	Mon Aug 15 15:34:02 2022 +0200
@@ -112,7 +112,8 @@
 
 TEST(Versions, BoostStatic)
 {
-  ASSERT_STREQ("1_80", BOOST_LIB_VERSION);
+  ASSERT_TRUE(std::string(BOOST_LIB_VERSION) == "1_80" ||
+              std::string(BOOST_LIB_VERSION) == "1_69" /* if USE_LEGACY_BOOST */);
 }
 
 TEST(Versions, CurlStatic)