build_environment: osl work around shutdown issues.
authorRay Molenkamp <github@lazydodo.com>
Sun, 26 Aug 2018 01:35:45 +0000 (19:35 -0600)
committerRay Molenkamp <github@lazydodo.com>
Sun, 26 Aug 2018 01:35:45 +0000 (19:35 -0600)
there is an issue with objects destructing in a non deterministic way during process shutdown, temporary work around this until osl has a fix in place.

build_files/build_environment/cmake/osl.cmake
build_files/build_environment/patches/osl.diff

index e73a4041405322f8e1b5d9bf3afa385a55810959..ad679449f360c93d8c8e8fda3fdba9f893f5a3a4 100644 (file)
@@ -83,7 +83,7 @@ ExternalProject_Add(external_osl
        LIST_SEPARATOR ^^
        URL_HASH MD5=${OSL_HASH}
        PREFIX ${BUILD_DIR}/osl
-       PATCH_COMMAND ${PATCH_CMD} -p 3 -d ${BUILD_DIR}/osl/src/external_osl < ${PATCH_DIR}/osl.diff
+       PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/osl/src/external_osl < ${PATCH_DIR}/osl.diff
        #       ${PATCH_CMD} -p 0 -d ${BUILD_DIR}/osl/src/external_osl < ${PATCH_DIR}/osl_simd_oiio.diff
        CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/osl -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${DEFAULT_CMAKE_FLAGS} ${OSL_EXTRA_ARGS}
        INSTALL_DIR ${LIBDIR}/osl
index fcb5ec4165fd40085e4035fb3a935a121e7f8b73..36cda06f394826d9a0e418e0d5ff89ea513a1b4d 100644 (file)
@@ -1,6 +1,6 @@
-diff -Naur osl/src/external_osl/src/cmake/flexbison.cmake osl_bak/src/external_osl/src/cmake/flexbison.cmake
---- osl/src/external_osl//src/cmake/flexbison.cmake    2016-01-29 11:15:22 -0700
-+++ osl_bak/src/external_osl/src/cmake/flexbison.cmake 2016-02-29 21:26:26 -0700
+diff -Naur OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake external_osl/src/cmake/flexbison.cmake
+--- OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake        2018-05-01 16:39:02 -0600
++++ external_osl/src/cmake/flexbison.cmake     2018-08-23 15:42:27 -0600
 @@ -77,7 +77,7 @@
            DEPENDS ${${compiler_headers}}
            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
@@ -10,3 +10,65 @@ diff -Naur osl/src/external_osl/src/cmake/flexbison.cmake osl_bak/src/external_o
            MAIN_DEPENDENCY ${flexsrc}
            DEPENDS ${${compiler_headers}}
            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
+diff -Naur OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej external_osl/src/cmake/flexbison.cmake.rej
+--- OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej    1969-12-31 17:00:00 -0700
++++ external_osl/src/cmake/flexbison.cmake.rej 2018-08-24 17:42:11 -0600
+@@ -0,0 +1,11 @@
++--- src/cmake/flexbison.cmake 2018-05-01 16:39:02 -0600
+++++ src/cmake/flexbison.cmake 2018-08-24 10:24:03 -0600
++@@ -77,7 +77,7 @@
++           DEPENDS ${${compiler_headers}}
++           WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
++         ADD_CUSTOM_COMMAND ( OUTPUT ${flexoutputcxx} 
++-          COMMAND ${FLEX_EXECUTABLE} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
+++          COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXTRA_OPTIONS} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
++           MAIN_DEPENDENCY ${flexsrc}
++           DEPENDS ${${compiler_headers}}
++           WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
+diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h
+--- OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h      2018-05-01 16:39:02 -0600
++++ external_osl/src/include/OSL/llvm_util.h   2018-08-25 14:05:00 -0600
+@@ -33,6 +33,8 @@
+ #include <vector>
++#define OSL_HAS_BLENDER_CLEANUP_FIX
++
+ #ifdef LLVM_NAMESPACE
+ namespace llvm = LLVM_NAMESPACE;
+ #endif
+@@ -487,6 +489,7 @@
+     std::string func_name (llvm::Function *f);
+     static size_t total_jit_memory_held ();
++    static void Cleanup ();
+ private:
+     class MemoryManager;
+diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/oslnoise.h external_osl/src/include/OSL/oslnoise.h
+--- OpenShadingLanguage-Release-1.9.9/src/include/OSL/oslnoise.h       2018-05-01 16:39:02 -0600
++++ external_osl/src/include/OSL/oslnoise.h    2018-08-24 17:42:11 -0600
+@@ -762,7 +762,7 @@
+ // packed into a float4. We assume T is float and VECTYPE is float4,
+ // but it also works if T is Dual2<float> and VECTYPE is Dual2<float4>.
+ template<typename T, typename VECTYPE>
+-OIIO_FORCEINLINE T bilerp (VECTYPE abcd, T u, T v) {
++OIIO_FORCEINLINE T bilerp (VECTYPE& abcd, T u, T v) {
+     VECTYPE xx = OIIO::lerp (abcd, OIIO::simd::shuffle<1,1,3,3>(abcd), u);
+     return OIIO::simd::extract<0>(OIIO::lerp (xx,OIIO::simd::shuffle<2>(xx), v));
+ }
+diff -Naur OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp external_osl/src/liboslexec/llvm_util.cpp
+--- OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp     2018-05-01 16:39:02 -0600
++++ external_osl/src/liboslexec/llvm_util.cpp  2018-08-25 14:04:27 -0600
+@@ -140,7 +140,10 @@
+ };
+-
++void LLVM_Util::Cleanup ()
++{
++       jitmm_hold.clear();
++}
+ size_t
+ LLVM_Util::total_jit_memory_held ()