所以我尝试为标准 IDE 移植一些 Boost.Extension 示例 - 使其不受 BJAM 的影响,并能够跨平台以标准方式使用它们。
我现在遇到问题的示例在此处进行了描述。这是我的代码端口(我们尝试在主代码文件中加载的库,主应用程序,常规这里描述了所有端口想法,以及一些当前的 Linux 进展在这里(大多数示例确实可以根据需要工作!))。当我在 Linux 下编译此示例时,它会编译,它会找到库,但在执行期间失败,并出现 分段错误错误 。当我在 Windows 上编译它时,会发生同样的事情。
我已尽力不更改原始教程代码 尽可能多。
那么代码出了什么问题,为什么会失败,唯一重要的是 - 如何修复它?
那么如何使用 premake 构建这些东西:
- 你会得到svn 从这里(仅此文件夹是必需的)
- 您得到为您的平台进行 premake 或从源代码构建它并将其放入您从 svn 下载的文件夹中
- 您应该编译并安装官方 Boost(请阅读我们在目录中提供的 ReadMe.txt 文件),所以需要什么:
- Boost C++ 库(我们使用版本 1.4.16 进行测试)
- Boost-Extension(我们使用最新版本,我们将其作为 boost 'boost/extension/
的一部分**
' 我们必须制作一些chandes(实际上只有一个)来增强扩展,因此我们将其提供在Boost.Extension.Tutorial/libs/boost/extension/
文件夹中,以便当你下载 svn 时你就得到了它,它只是标题)
- Boost-Reflection(我们使用它因为本教程< /a> ,我们使用 最新版本 ,我们将其作为一部分boost 'boost/reflection/
**
' *为了简单起见,我们建议将其放入 Boost.Extension.Tutorial/libs/boost/reflection
* )
- 现在,当您的系统中有官方 Boost 时,只有 Boost-reflection 和 Boost-extension 头文件位于
Boost.Extension.Tutorial/libs/boost
文件夹中,premake4 可执行文件位于 < code>Boost.Extension.Tutorial/ 文件夹中,我们可以简单地在 Windows 上调用 Boost.Extension.Tutorial/ premake4-build-windows.bat
来获取 Visual Studio 或 Boost 的 sln .Extension.Tutorial/ premake-build.sh
获取 makefile。
- 您可以在生成的项目文件夹中找到生成的解决方案/makefile。
- 祝你好运!=)
更新:
项目文件 适用于 Windows 和 Linux 的版本现在位于 svn 中,因此您可以使用 premake 来创建项目 - 只需拥有 Boost、我们的 svn 和反射标头专用库即可。
更新 2:
一般来说,我的电脑在 Windows 和 Linux 上都会出现问题。有关我的 Linux 的详细信息(这是一个包含 Mono 2.10.2 的 openSUSE 11.3 VMWare 映像< /a>) GCC (gcc -v
):
rupert@linux:~> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i586-suse-linux/4.5/lto-wrapper
Target: i586-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.5 --enable-ssp --disable-libssp --disable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.5 --enable-linux-futex --without-system-libunwind --enable-gold --with-plugin-ld=/usr/bin/gold --with-arch-32=i586 --with-tune=generic --build=i586-suse-linux
Thread model: posix
gcc version 4.5.0 20100604 [gcc-4_5-branch revision 160292] (SUSE Linux)
我的 Windows 是标准 Windows 7,带有 Visual Studio Team System 2008 Team Suite。
我的 boost 是 1.46.1 从这里下载手动编译和安装。
So I try to port some Boost.Extension samples for standart IDEs - to make tham free from BJAM and to be able to work with them in standard ways across platforms.
The sample I have trobules with now is described here. Here is my code port (library we try to load in main code file, main application, general all port idea is described here, and some current linux progress here (most of the samples really work as needed!)). When I compile this sample under linux it compiles, it finds library but fails during execution with segmentation fault error. When I compile it on Windows same stuff happens.
I have tried my best not to change original tutorial code as much as possible.
So what is wrong with code, why if fails, and only thing that matters - how to fix it?
So how to build this stuff with premake:
- You get svn from here (only this folder is required)
- You get premake for your platform or build it from source and put it into folder you downloaded from svn
- You should have official Boost compiled and installed (please read ReadMe.txt file we provide in directory) so what is needed:
- Boost C++ library's (we tested with version 1.4.16)
- Boost-Extension ( we use latest revision , we adress it as part of boost 'boost/extension/
**
' We had to make some chandes (actually only one) to boost extension so we provide it inside Boost.Extension.Tutorial/libs/boost/extension/
folder so when you downloaded svn you got it, it is header only )
- Boost-Reflection ( we use it because of this tutorial , we use latest revision , we adress it as part of boost 'boost/reflection/
**
' *and for simplness we recommend just to put it into Boost.Extension.Tutorial/libs/boost/reflection
* )
- Now when official Boost is in your system, header only Boost-reflection and Boost-extension are in
Boost.Extension.Tutorial/libs/boost
folder, premake4 executable is inside Boost.Extension.Tutorial/
folder we can simply call Boost.Extension.Tutorial/ premake4-build-windows.bat
on windows to get sln for Visual Studio or Boost.Extension.Tutorial/ premake-build.sh
to get makefiles.
- You can find generated solution/makefiles inside generated projects folder.
- Have good luck!=)
Update:
Project files for Windows and Linux are now in svn so you can get aroung project creation with premake - just have Boost, our svn, and reflection headers only lib.
Update 2:
So generally my computer shows problems both on Windows and Linux. Details on my Linux (which is an openSUSE 11.3 VMWare image which includes Mono 2.10.2) GCC (gcc -v
):
rupert@linux:~> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i586-suse-linux/4.5/lto-wrapper
Target: i586-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.5 --enable-ssp --disable-libssp --disable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.5 --enable-linux-futex --without-system-libunwind --enable-gold --with-plugin-ld=/usr/bin/gold --with-arch-32=i586 --with-tune=generic --build=i586-suse-linux
Thread model: posix
gcc version 4.5.0 20100604 [gcc-4_5-branch revision 160292] (SUSE Linux)
My windows is standard Windows 7 with Visual Studio Team System 2008 Team Suite on board.
My boost is 1.46.1 download from here compiled and installed manually.
发布评论
评论(1)
配置一定有区别,因为这是我测试的结果:
互操作性输出:
也许是一个发行版?
更新
我已经在 32 位 Linux 上使用
1.46.1.1 Mono-2.10.2.vmdk 映像 SuSE 与
结论、提示
所有测试的版本都给了我正确的结果和相同的输出。 PEBCAK 肯定发生了什么事情吗? 也许可以在新的虚拟机上重复我的上述步骤来亲自查看?
我真正看到的唯一错误是
There must be difference in configuration, because this is the result of my testing:
outputs:
A release buld perhaps?
Update
I have since tested this on 32bit linux with
The Mono-2.10.2.vmdk image SuSE with
Conclusions, hints
All versions tested gave me correct and identical output. Surely there must be something PEBCAK going on? Perhaps repeat my above steps on a fresh VM to see for yourself?
The only thing I can really see going wrong is