[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57192] trunk/blender: Fix #35587: Cycles: image movie to single image crashing

Jürgen Herrmann shadowrom at me.com
Mon Jun 3 07:08:43 CEST 2013


Hi,

VS 2012 x86 an x64 work fine with this now ;)

I removed the dynamic libs for zlib from the vs2012 libs too.

Shall we do this for VS2008 too?
This should prevent accidental linking to libz.lib

/Jürgen

Am 02.06.2013 um 17:02 schrieb Sergey Sharybin <sergey.vfx at gmail.com>:

> Revision: 57192
>          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57192
> Author:   nazgul
> Date:     2013-06-02 15:02:17 +0000 (Sun, 02 Jun 2013)
> Log Message:
> -----------
> Fix #35587: Cycles: image movie to single image crashing
> 
> Crash was happening on windows platforms only and was caused
> by some specifics about how CRT works.
> 
> Basically, blender and all of the .dll are compiled with /MT
> flag, which means blender.exe and all .dll are using separate
> environments. This makes it impossible to pass file descriptors
> from blender to other dll, because it becomes invalid in the dll.
> 
> And this is exactly what was happening: OIIO was trying to open
> movie file with all known plugins and one of them was zlib. And
> the way OIIO was using zlib API is opening the file using Boost
> and passing a file descriptor to zlib. And since zlib was a
> dynamic library this lead to general issues using this descriptor
> in zlib code.
> 
> Solved by linking to zlib statically. This allows to safely pass
> file descriptor to zlib API. Alternative would be to compile all
> the stuff with /MD flag, but that's much bigger and less robust
> way to fix the issue.
> 
> Tested on windows using msvc2008, scons plus cmake both 32 and 64
> bit versions. Seems to be working fine.
> 
> Further tweaks for mingw and msvc2012 could be needed tho.
> 
> Modified Paths:
> --------------
>    trunk/blender/CMakeLists.txt
>    trunk/blender/SConstruct
>    trunk/blender/build_files/scons/config/linuxcross-config.py
>    trunk/blender/build_files/scons/config/win32-mingw-config.py
>    trunk/blender/build_files/scons/config/win32-vc-config.py
>    trunk/blender/build_files/scons/config/win64-vc-config.py
>    trunk/blender/build_files/scons/tools/Blender.py
>    trunk/blender/source/creator/CMakeLists.txt
> 
> Modified: trunk/blender/CMakeLists.txt
> ===================================================================
> --- trunk/blender/CMakeLists.txt    2013-06-02 14:56:04 UTC (rev 57191)
> +++ trunk/blender/CMakeLists.txt    2013-06-02 15:02:17 UTC (rev 57192)
> @@ -1088,11 +1088,7 @@
>        set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
> 
>        set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
> -        if(CMAKE_CL_64)
> -            set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz.lib)
> -        else()
> -            set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/zlib.lib)
> -        endif()
> +        set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz_st.lib)
> 
>        set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
>        set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
> 
> Modified: trunk/blender/SConstruct
> ===================================================================
> --- trunk/blender/SConstruct    2013-06-02 14:56:04 UTC (rev 57191)
> +++ trunk/blender/SConstruct    2013-06-02 15:02:17 UTC (rev 57192)
> @@ -910,7 +910,6 @@
> if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
>     dllsources = []
> 
> -    dllsources += ['${BF_ZLIB_LIBPATH}/zlib.dll']
>     # Used when linking to libtiff was dynamic
>     # keep it here until compilation on all platform would be ok
>     # dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
> 
> Modified: trunk/blender/build_files/scons/config/linuxcross-config.py
> ===================================================================
> --- trunk/blender/build_files/scons/config/linuxcross-config.py    2013-06-02 14:56:04 UTC (rev 57191)
> +++ trunk/blender/build_files/scons/config/linuxcross-config.py    2013-06-02 15:02:17 UTC (rev 57192)
> @@ -78,7 +78,7 @@
> WITH_BF_ZLIB = True
> BF_ZLIB = LIBDIR + '/zlib'
> BF_ZLIB_INC = '${BF_ZLIB}/include'
> -BF_ZLIB_LIB = 'libz'
> +BF_ZLIB_LIB = 'libz_st'
> BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
> 
> WITH_BF_INTERNATIONAL = True
> 
> Modified: trunk/blender/build_files/scons/config/win32-mingw-config.py
> ===================================================================
> --- trunk/blender/build_files/scons/config/win32-mingw-config.py    2013-06-02 14:56:04 UTC (rev 57191)
> +++ trunk/blender/build_files/scons/config/win32-mingw-config.py    2013-06-02 15:02:17 UTC (rev 57192)
> @@ -78,7 +78,7 @@
> WITH_BF_ZLIB = True
> BF_ZLIB = LIBDIR + '/zlib'
> BF_ZLIB_INC = '${BF_ZLIB}/include'
> -BF_ZLIB_LIB = 'libz'
> +BF_ZLIB_LIB = 'libz_st'
> BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
> 
> WITH_BF_INTERNATIONAL = True
> 
> Modified: trunk/blender/build_files/scons/config/win32-vc-config.py
> ===================================================================
> --- trunk/blender/build_files/scons/config/win32-vc-config.py    2013-06-02 14:56:04 UTC (rev 57191)
> +++ trunk/blender/build_files/scons/config/win32-vc-config.py    2013-06-02 15:02:17 UTC (rev 57192)
> @@ -82,7 +82,7 @@
> WITH_BF_ZLIB = True
> BF_ZLIB = LIBDIR + '/zlib'
> BF_ZLIB_INC = '${BF_ZLIB}/include'
> -BF_ZLIB_LIB = 'libz'
> +BF_ZLIB_LIB = 'libz_st'
> BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
> 
> WITH_BF_INTERNATIONAL = True
> 
> Modified: trunk/blender/build_files/scons/config/win64-vc-config.py
> ===================================================================
> --- trunk/blender/build_files/scons/config/win64-vc-config.py    2013-06-02 14:56:04 UTC (rev 57191)
> +++ trunk/blender/build_files/scons/config/win64-vc-config.py    2013-06-02 15:02:17 UTC (rev 57192)
> @@ -78,7 +78,7 @@
> WITH_BF_ZLIB = True
> BF_ZLIB = LIBDIR + '/zlib'
> BF_ZLIB_INC = '${BF_ZLIB}/include'
> -BF_ZLIB_LIB = 'libz'
> +BF_ZLIB_LIB = 'libz_st'
> BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
> 
> WITH_BF_INTERNATIONAL = True
> 
> Modified: trunk/blender/build_files/scons/tools/Blender.py
> ===================================================================
> --- trunk/blender/build_files/scons/tools/Blender.py    2013-06-02 14:56:04 UTC (rev 57191)
> +++ trunk/blender/build_files/scons/tools/Blender.py    2013-06-02 15:02:17 UTC (rev 57192)
> @@ -155,12 +155,12 @@
>         libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
>         if lenv['WITH_BF_STATICOPENEXR']:
>             statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
> +    if lenv['WITH_BF_ZLIB'] and lenv['WITH_BF_STATICZLIB']:
> +        statlibs += Split(lenv['BF_ZLIB_LIB_STATIC'])
>     if lenv['WITH_BF_TIFF']:
>         libincs += Split(lenv['BF_TIFF_LIBPATH'])
>         if lenv['WITH_BF_STATICTIFF']:
>             statlibs += Split(lenv['BF_TIFF_LIB_STATIC'])
> -    if lenv['WITH_BF_ZLIB'] and lenv['WITH_BF_STATICZLIB']:
> -        statlibs += Split(lenv['BF_ZLIB_LIB_STATIC'])
>     if lenv['WITH_BF_FFTW3']:
>         libincs += Split(lenv['BF_FFTW3_LIBPATH'])
>         if lenv['WITH_BF_STATICFFTW3']:
> @@ -282,10 +282,10 @@
> 
>     if lenv['WITH_BF_OPENEXR'] and not lenv['WITH_BF_STATICOPENEXR']:
>         syslibs += Split(lenv['BF_OPENEXR_LIB'])
> +    if lenv['WITH_BF_ZLIB'] and not lenv['WITH_BF_STATICZLIB']:
> +        syslibs += Split(lenv['BF_ZLIB_LIB'])
>     if lenv['WITH_BF_TIFF'] and not lenv['WITH_BF_STATICTIFF']:
>         syslibs += Split(lenv['BF_TIFF_LIB'])
> -    if lenv['WITH_BF_ZLIB'] and not lenv['WITH_BF_STATICZLIB']:
> -        syslibs += Split(lenv['BF_ZLIB_LIB'])
>     if lenv['WITH_BF_FFMPEG'] and not lenv['WITH_BF_STATICFFMPEG']:
>         syslibs += Split(lenv['BF_FFMPEG_LIB'])
>         if lenv['WITH_BF_OGG']:
> 
> Modified: trunk/blender/source/creator/CMakeLists.txt
> ===================================================================
> --- trunk/blender/source/creator/CMakeLists.txt    2013-06-02 14:56:04 UTC (rev 57191)
> +++ trunk/blender/source/creator/CMakeLists.txt    2013-06-02 15:02:17 UTC (rev 57192)
> @@ -538,23 +538,6 @@
>        unset(_PYTHON_VERSION_NO_DOTS)
>    endif()
> 
> -    if(CMAKE_CL_64)
> -        # png is statically linked on win64
> -        install(
> -            FILES ${LIBDIR}/zlib/lib/zlib.dll
> -            DESTINATION ${TARGETDIR}
> -        )
> -    else()
> -        #not needed since we link statically, maybe also unneeded for MinGW?
> -        if(NOT WITH_MINGW64)
> -            install(
> -                FILES
> -                    ${LIBDIR}/zlib/lib/zlib.dll
> -                DESTINATION ${TARGETDIR}
> -            )
> -        endif()
> -    endif()
> -
>    if(MSVC)
>        install(
>            FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
> 
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs


More information about the Bf-committers mailing list