【问题标题】:compiling / linking blender for windows为 Windows 编译/链接搅拌机
【发布时间】:2014-09-21 06:23:43
【问题描述】:

我在为 windows 链接搅拌机时遇到问题。我正在使用 CMake 并使用 mimgw 编译器(mingw32-g++.exe c++ 编译器)和(mingw32-gcc.exe c 编译器)创建我的 makefile。

我从
https://svn.blender.org/svnroot/bf-blender/trunk/blender
https://svn.blender.org/svnroot/bf-blender/trunk/lib/windows获取源代码

http://wiki.blender.org/index.php/Dev:2.5/Doc/Building_Blender/Windows/MinGW/CMake

中指定

所有链接错误都与lib\windows\gcc有关
以下是其中一些:

lib\windows\gcc\tiff\lib/libtiff.a(tif_pixarlog.o):(.text+0x172d): 对 `deflateInit_' 的未定义引用

lib\windows\gcc\openimageio\lib/libOpenImageIO.a(sysutil.cpp.obj):sysutil.cpp:(.text+0x32): 对 `GetProcessMemoryInfo@12' 的未定义引用

lib\windows\gcc\openimageio\lib/libOpenImageIO.a(socketinput.cpp.obj):socketinput.cpp:(.text+0x45c2): 对 `WSASetLastError@4' 的未定义引用

在我的 lib\windows\gcc\openimageio 中有一个批处理文件 (oiio-build.bat) 我猜这是由 CMake 生成的

cmake ..\oiio\src\ -G "MinGW Makefiles" ^
    -DBUILDSTATIC=1 ^
    -DBOOST_CUSTOM=0 ^
    -DBOOST_ROOT=..\lib\windows\gcc\boost\ ^
    -DBoost_USE_STATIC_RUNTIME=ON ^
    -DLINKSTATIC=ON ^
    -DILMBASE_HALF_LIBRARIES=..\lib\windows\gcc\openexr\lib\libHalf.a ^
    -DILMBASE_IMATH_LIBRARIES=..\lib\windows\gcc\openexr\lib\libImath.a ^
    -DILMBASE_ILMTHREAD_LIBRARIES=..\lib\windows\gcc\openexr\lib\libIlmThread.a ^
    -DILMBASE_IEX_LIBRARIES=..\lib\windows\gcc\openexr\lib\libIex.a ^
    -DOPENEXR_ILMIMF_LIBRARIES=..\lib\windows\gcc\openexr\lib\libIlmImf.a ^
    -DILMBASE_INCLUDE_DIR=..\lib\windows\gcc\openexr\include ^
    -DOPENEXR_INCLUDE_DIR=..\lib\windows\gcc\openexr\include ^
    -DZLIB_INCLUDE_DIR=..\lib\windows\zlib\include ^
    -DZLIB_LIBRARY=..\lib\windows\zlib\lib\libz.a ^
    -DPNG_LIBRARY=..\lib\windows\png\lib\libpng.a ^
    -DPNG_PNG_INCLUDE_DIR=..\lib\windows\png\include ^
    -DJPEG_LIBRARY=..\lib\windows\jpeg\lib\libjpeg.lib ^
    -DJPEG_INCLUDE_DIR=..\lib\windows\jpeg\include ^
    -DTIFF_LIBRARY=..\lib\windows\tiff\lib\libtiff.lib ^
    -DTIFF_INCLUDE_DIR=..\lib\windows\tiff\include ^
    -DCMAKE_INSTALL_PREFIX=..\lib\windows\gcc\openimageio ^
    -DUSE_OPENGL=OFF ^
    -DUSE_TBB=OFF ^
    -DUSE_FIELD3D=OFF ^
    -DUSE_QT=OFF ^
    -DUSE_PYTHON=OFF ^
    -DCMAKE_BUILD_TYPE=Release
mingw32-make install

原来 lib\windows\gcc\oiio 不存在。

编辑:尝试用 scons 编译 blender 2.71,我发现如果我不从 blender 文件夹运行 python,我会得到 * No SContruct 文件。错误

所以

用 python26\python.exe scons/scons.py 我明白了

ValueError: zero length field name in format:
  File "D:\blender-source\blender\SConstruct", line 54:
    EnsureSConsVersion(1,0,0)
  File "D:\blender-source\blender\scons\scons-local\SCons\Script\SConscript.py", line 607:
    env = self.factory()
  File "D:\blender-source\blender\scons\scons-local\SCons\Script\SConscript.py", line 587:
    default_env = SCons.Defaults.DefaultEnvironment()
  File "D:\blender-source\blender\scons\scons-local\SCons\Defaults.py", line 88:
    _default_env = SCons.Environment.Environment(*args, **kw)
  File "D:\blender-source\blender\scons\scons-local\SCons\Environment.py", line 1003:
    apply_tools(self, tools, toolpath)
  File "D:\blender-source\blender\scons\scons-local\SCons\Environment.py", line 107:
    env.Tool(tool)
  File "D:\blender-source\blender\scons\scons-local\SCons\Environment.py", line 1787:
    tool(self)
  File "D:\blender-source\blender\scons\scons-local\SCons\Tool\__init__.py", line 183:
    self.generate(env, *args, **kw)
  File "D:\blender-source\blender\scons\scons-local\SCons\Tool\default.py", line 41:
    SCons.Tool.Tool(t)(env)
  File "D:\blender-source\blender\scons\scons-local\SCons\Tool\__init__.py", line 183:
    self.generate(env, *args, **kw)
  File "D:\blender-source\blender\scons\scons-local\SCons\Tool\dmd.py", line 131:
    env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '')

使用 python27\python.exe scons/scons.py 我得到了

scons: warning: VC version 12.0 not installed.  C/C++ compilers are most likely not set correctly.
 Installed versions are: ['9.0']
File "D:\blender-source\blender\SConstruct", line 143, in <module>
WindowsError: [Error 2] The system cannot find the file specified:
  File "D:\blender-source\blender\SConstruct", line 207:
    opts.Update(env)
  File "D:\blender-source\blender\scons\scons-local\SCons\Variables\__init__.py", line 173:
    exec open(filename, 'rU').read() in {}, values
  File "<string>", line 3:
    None
  File "c:\python27\lib\subprocess.py", line 710:
    errread, errwrite)
  File "c:\python27\lib\subprocess.py", line 958:
    startupinfo)

【问题讨论】:

    标签: open-source blender


    【解决方案1】:

    CMake + Mingw32 已经很久没有测试过了,但是 SCons + Mingw64 确实可以工作,因为 Blender 构建机器人也使用它进行夜间构建:http://builder.blender.org/buildslaves/mingw64_scons_anthony

    从 build slave 列表中你可以看到没有 mingw32 slave,我不确定近期是否会有。

    无论如何,使用 SCons 和 Mingw64,您应该有一种直接的方式来运行编译过程。只需确保安装了 Mingw64 和 Python 2.6 或 Python 2.7。然后查看搅拌机源代码和 lib/mingw64。在 Blender 源代码根目录中使用 C:\Python27\python.exe scons\scons.py 开始编译过程。这应该开箱即用。

    【讨论】:

    • scons.py 脚本给了我一个错误:scons: *** No SConstruct found。产生错误消息的代码行是:raise SCons.Errors.UserError("No SConstruct file found.")
    猜你喜欢
    • 1970-01-01
    • 2020-01-06
    • 2021-09-27
    • 2016-01-19
    • 2012-11-15
    • 2020-06-07
    • 2016-09-12
    • 2013-01-09
    • 2019-12-29
    相关资源
    最近更新 更多