zoukankan      html  css  js  c++  java
  • 怎样在Windows下编译OpenVRML

    参考原文:https://sourceforge.net/apps/trac/openvrml/wiki/BuildOpenvrmlOnWindows

    Original version copyright (C) Zack Smith 2008

    今天花了一整天的时候配置编译环境并编译,尽管仍未编译成功,但已将错误减少至两处,而且这剩下的两处也应该是我对VC不了解而出现的,希望能很快解决。 注:build在文中被译作构建,可能有点别扭。。。

    1. 获取OpenVRML

    http://openvrml.org/download 获取OpenVRML 分发 (发行包或Subversion处最新源码) 。

    2. 下载Visual C++ Express

    如果你还没有微软的编译器,你可以使用免费版 Visual C++ Express

    3. 安装预编译的 Boost C++ 库

    BoostPro Computing freely available installer 来构建Windows下的Boost。

    至少要为最新版本的Microsoft Visual C++ 编译器(当前为9.0)安装"Multithread" 和 "Multithread Debug"变体的库。注:这个工具可以根据需要下载源文件和预编译的库文件,根据后面编译的情况来看,应该还要选date_time、system、thread等。

    The installers for versions 1.37.0 and 1.38.0 appear to have a glitch such that checking the boxes to install the variants globally for all libraries may not actually result in that selection propagating to the individual libraries. Make sure that you expand the tree of available variants to install and specifically check the "Multithread" and "Multithread Debug" variants.

    4. 打开解决方案文件

    Visual C++ 9.0 的解决方案文件可以在OpenVRML的如下目录找到

    ide-projects/Windows/VisualC9_0/OpenVRML/OpenVRML.sln
    

    5. 将Boost头文件和库目录添加到编译器的路径列表

    OpenVRML 依赖于很多库 - 每一个都要单独下载,并且必须要将它们的include和library目录添加到Visual C++路径列表中。下面的步骤阐明了如何添加到路径列表。

    1. 选择工具 -> 选项下拉菜单
    2. 在"项目和解决方案"中,选择"VC++目录",然后"包含文件"
    3. 点击文件夹图标,添加带版本号的boost目录到路径中。它应该类似于这样:
      C:/Program Files/boost/boost_1_38_0
      
      vc_boost.jpg
    4. 现在再选择"库文件"
    5. vc_boost_lib.jpg
    6. 点击文件夹图标添加路径,看起来应该像这样:
      C:/Program Files/boost/boost_1_38_0/lib
      

    6. 构建 FreeType

    1. 下载zip文件格式的FreeType分发,从 the FreeType SourceForge project's file releases
    2. 在Visual C++中打开解决方案文件。可以在FreeType的builds/win32/vc2008 目录下找到。
    3. 选择freetype项目中的"LIB Release Multithreaded" 与 "LIB Debug Multithreaded"配置进行构建。
    4. FreeType解决方案会输出所有的库到同样的目录下,objs/win32/vc2008 .(提一下,个别的路径可能根据所用的编译版本而有所不同) 。将该目录添加到VS的库目录下。形式如下:
      C:/Users/Joe/freetype-2.3.9/objs/win32/vc2008
      
    5. 将FreeType的include子目录添加到VS的包含文件目录。形式如下:
      C:/Users/Joe/freetype-2.3.9/include
      

    7. 构建 libpng

    1. libpng SourceForge project's file releases 下载最新版本的libpng及zlib分发的zip文件。
    2. 解压libpng后,将zlib的内容解压到与libpng同一级目录下的"zlib"文件夹。利润,如果你的libpng放在C:/Users/Joe/lpng1235 ,你的zlib就应该放在C:/Users/Joe/zlib 。注意尽管libpng的zip文件包含了顶级目录,但zlib到目前1.2.3版本为止未包括。
    3. 在Visual C++中打开libpng解决方案文件。可以在libpng的projects/visualc71/libpng.sln 找到。
    4. 按照 libpng 项目的"LIB Debug" 和 "LIB Release"配置进行构建。zlib会自动作为依赖被构建。
    5. 将libpng的输出目录添加到Visual C++的库目录列表。形式如下:
      C:/Users/Joe/lpng1235/projects/visualc71/Win32_LIB_Debug
      C:/Users/Joe/lpng1235/projects/visualc71/Win32_LIB_Release
      
    6. 将zlib和libpng的源码目录添加到Visual C++的包含文件目录。形式如下:
      C:/Users/Joe/zlib
      C:/Users/Joe/lpng1235
      

    8. 获取 SpiderMonkey (Mozilla JavaScript 运行时环境)

    最简单的是从Mozilla下载预编译形式的代码XULRunner:ftp://ftp.mozilla.org/pub/xulrunner/releases/

    获取SDK版本,提取出来。将的lib目录添加到Visual C++的库文件目录列表。形式如下:

    C:/Users/Joe/xulrunner-sdk/lib
    

    将的 SpiderMonkey? include目录添加到Visual C++的包含文件目录列表。形式如下:

    C:/Users/Joe/xulrunner-sdk/include/js
    

    9. 安装 SDL

    你有两个选择:下载预编译的DLL文件加上include文件,或者自己来构建 。预编译的可以去http://www.libsdl.org/download-1.2.php 下载。所包含的DLL文件将会被放到OpenVRML的二进制目录。

    10. 将SDL的头文件和库目录添加到VC++路径列表

    注:直接用DLL文件似乎不行,它调用的静态链接文件,需要下载源码编译为lib文件。

    11. 在调试器中运行 sdl-viewer

    我们需要添加一个命令行参数来浏览文件,如为了测试可执行文件。右键单击sdl-viewer项目,点击属性,调试,命令参数。添加内容类似如下:

    file:///c:/users/YOURNAME/desktop/openvrml/models/snoman.wrl
    

    12. 构建解决方案

    生成的唯一可执行文件为 sdl-viewer.exe。

    13. 设置环境变量

    将openvrml/data目录的完整路径设置到环境变量 OPENVRML_DATA。在Vista下形式如:

    c:/users/YOURNAME/desktop/openvrml/data
    

    或在XP下:

    c:/docume~1/YOURNAME/desktop/openvrml/data
    

    14. 将sdl-viewer设置为缺省的应用程序来进行调试

    在sdl-viewer项目上右键单击,然后选择"设置为启动项目"

    15. 运行脚本

    如果你希望运行带有Javascript的VRML/X3D文件,你需要做两件事:首先,设置OPENVRML_SCRIPT_PATH 环境变量;然后,复制 JSAPI's js2350.dll 与 nspr4.dll 到OpenVRML的二进制目录。

    16. 按F5在调试模式下运行程序


    问题解决

    • If you get an error during the loading of DLLs, and the error code is hexadecimal, such as:
      The application failed to initialize property (0xE06D7363)
      
      this may indicate that your OPENVRML_DATADIR environment variable is unset or incorrectly set. In an ideal world, this problem would result in a MessageBox() call; but presently it doesn't.
    • To do a proper "clean solution", you may not want to rely on VC++. It's not as deterministic as make under Unix. Use Cygwin carefully thus:
      rm `find . -name "*.obj"`
      rm `find . -name "*.lib"`
      rm `find . -name "*.dll"`
      rm `find . -name "*.exe"`
      
      Don't forget the "-name" part! Forgetting it will remove everything.
    • If there is a problem with manifest files not being produced, note that VC++ normally produces them itself. To repair a manifest file problem, you may need to do a proper clean (above). It may help if you have /NODEFAULTLIB:MSVCRT.LIB in your linker command-line arguments for all projects.

    下面贴出错误代码,有高手请指点一下:

    1>正在链接...
    1> 正在创建库 E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

    /OpenVRML/Release/lib/openvrml.lib 和对象 E:/X3D/Soft/openvrml-0.18.3/ide-

    projects/Windows/VisualC9_0/OpenVRML/Release/lib/openvrml.exp
    1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "struct HINSTANCE__ *

    __cdecl openvrml::local::dl::open(class std::basic_string<char,struct

    std::char_traits<char>,class std::allocator<char> > const &)" (?

    open@dl@local@openvrml@@YAPAUHINSTANCE__@@ABV?$basic_string@DU?$char_traits@D@std@@V?

    $allocator@D@2@@std@@@Z)
    1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "void * __cdecl

    openvrml::local::dl::sym(struct HINSTANCE__ *,class std::basic_string<char,struct

    std::char_traits<char>,class std::allocator<char> > const &)" (?

    sym@dl@local@openvrml@@YAPAXPAUHINSTANCE__@@ABV?$basic_string@DU?$char_traits@D@std@@V?

    $allocator@D@2@@std@@@Z)
    1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "int __cdecl

    openvrml::local::dl::foreachfile(class std::vector<class boost::filesystem::basic_path<class

    std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct

    boost::filesystem::path_traits>,class std::allocator<class

    boost::filesystem::basic_path<class std::basic_string<char,struct

    std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem::path_traits> >

    > const &,int (__cdecl*)(class std::basic_string<char,struct std::char_traits<char>,class

    std::allocator<char> > const &,void *),void *)" (?foreachfile@dl@local@openvrml@@YAHABV?

    $vector@V?$basic_path@V?$basic_string@DU?$char_traits@D@std@@V?

    $allocator@D@2@@std@@Upath_traits@filesystem@boost@@@filesystem@boost@@V?$allocator@V?

    $basic_path@V?$basic_string@DU?$char_traits@D@std@@V?

    $allocator@D@2@@std@@Upath_traits@filesystem@boost@@@filesystem@boost@@@std@@@std@@P6AHABV?

    $basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@5@PAX@Z2@Z)
    1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "int __cdecl

    openvrml::local::dl::close(struct HINSTANCE__ *)" (?

    close@dl@local@openvrml@@YAHPAUHINSTANCE__@@@Z)
    1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "class

    std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const

    __cdecl openvrml::local::dl::error(void)" (?error@dl@local@openvrml@@YA?BV?

    $basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
    1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "int __cdecl

    openvrml::local::dl::init(void)" (?init@dl@local@openvrml@@YAHXZ)
    1>node_metatype_registry_impl.obj : error LNK2001: 无法解析的外部符号 "int __cdecl

    openvrml::local::dl::exit(void)" (?exit@dl@local@openvrml@@YAHXZ)
    1>E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

    /OpenVRML/Release/bin/openvrml.dll : fatal error LNK1120: 7 个无法解析的外部命令
    1>生成日志保存在"file://e:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

    /OpenVRML/openvrml/Release/BuildLog.htm"
    1>openvrml - 8 个错误,2 个警告

    14>LINK : fatal error LNK1104: 无法打开文件"LIBC.lib"
    14>生成日志保存在"file://e:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

    /OpenVRML/vrml97/Release/BuildLog.htm"
    14>vrml97 - 1 个错误,1 个警告

    19>正在链接...
    19> 正在创建库 E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

    /OpenVRML/Release/bin/sdl-viewer.lib 和对象 E:/X3D/Soft/openvrml-0.18.3/ide-

    projects/Windows/VisualC9_0/OpenVRML/Release/bin/sdl-viewer.exp
    19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeGetTime@0
    19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeBeginPeriod@4
    19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeSetEvent@20
    19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeEndPeriod@4
    19>SDL.lib(SDL_systimer.obj) : error LNK2001: 无法解析的外部符号 __imp__timeKillEvent@4
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_POV
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_Slider
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_RzAxis
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_RyAxis
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_RxAxis
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_ZAxis
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_YAxis
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_XAxis
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _GUID_Key
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _IID_IDirectDrawSurface3
    19>SDL.lib(SDL_dx5yuv.obj) : error LNK2001: 无法解析的外部符号 _IID_IDirectDrawSurface3
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号 _IID_IDirectDraw2
    19>SDL.lib(SDL_dx5video.obj) : error LNK2001: 无法解析的外部符号

    _IID_IDirectDrawGammaControl
    19>SDL.lib(SDL_syscdrom.obj) : error LNK2001: 无法解析的外部符号

    __imp__mciGetErrorStringA@12
    19>SDL.lib(SDL_syscdrom.obj) : error LNK2001: 无法解析的外部符号 __imp__mciSendCommandA@16
    19>SDL.lib(SDL_mmjoystick.obj) : error LNK2001: 无法解析的外部符号 __imp__joyGetDevCapsA@12
    19>SDL.lib(SDL_mmjoystick.obj) : error LNK2001: 无法解析的外部符号 __imp__joyGetPosEx@8
    19>SDL.lib(SDL_mmjoystick.obj) : error LNK2001: 无法解析的外部符号 __imp__joyGetNumDevs@0
    19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号 __imp__waveOutWrite@12
    19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号

    __imp__waveOutUnprepareHeader@12
    19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号 __imp__waveOutClose@4
    19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号

    __imp__waveOutPrepareHeader@12
    19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号 __imp__waveOutOpen@24
    19>SDL.lib(SDL_dibaudio.obj) : error LNK2001: 无法解析的外部符号

    __imp__waveOutGetErrorTextA@12
    19>SDL.lib(SDL_dx5events.obj) : error LNK2001: 无法解析的外部符号 _GUID_SysMouse
    19>SDL.lib(SDL_dx5events.obj) : error LNK2001: 无法解析的外部符号 _GUID_SysKeyboard
    19>SDL.lib(SDL_dx5events.obj) : error LNK2001: 无法解析的外部符号 _IID_IDirectInputDevice2A
    19>E:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0/OpenVRML/Release/bin/sdl-

    viewer.exe : fatal error LNK1120: 31 个无法解析的外部命令
    19>生成日志保存在"file://e:/X3D/Soft/openvrml-0.18.3/ide-projects/Windows/VisualC9_0

    /OpenVRML/sdl-viewer/Release/BuildLog.htm"
    19>sdl-viewer - 33 个错误,0 个警告

    Powered by Zoundry Raven

    本文来源:http://www.cnblogs.com/x3d/,转载请注明。
  • 相关阅读:
    CentOS 7.0关闭默认防火墙启用iptables防火墙
    centos7 启动httpd的时候为什么显示是这样的
    CentOS配置本地yum源/阿里云yum源/163yuan源,并配置yum源的优先级
    Linux如何用yum安装软件或服务
    IE浏览器和Firefox浏览器兼容性问题及解决办法
    Input的size与maxlength属性的区别
    下拉框默认选择数据库取出数据
    登录到 SQL Server 实例
    安装sql server 2008重启失败
    值栈
  • 原文地址:https://www.cnblogs.com/x3d/p/2661374.html
Copyright © 2011-2022 走看看