升压扩展反射如何编译官方样片时不与修复的bjam分段错误? [英] Boost-Extension-Reflection How to fix segmentation fault error when compiling official sample not with bjam?

查看:177
本文介绍了升压扩展反射如何编译官方样片时不与修复的bjam分段错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我尝试一些端口样本Boost.Extension为非标准的IDE - 使从艾德里安的bjam自由,能在标准的方式与他们合作,跨平台的。

我与现在trobules描述样品<一个href=\"http://boost-extension.redshoelace.com/docs/boost/extension/boost_extension/extension_reflection.html\"相对=nofollow>此处。这里是我的code口(<一个href=\"http://$c$c.google.com/p/cloudobserver/source/browse/branches/v0.4/Boost.Extension.Tutorial/src/lib-interoperability/cars.cpp\"相对=nofollow>图书馆,我们尝试在主code文件加载,<一个href=\"http://$c$c.google.com/p/cloudobserver/source/browse/branches/v0.4/Boost.Extension.Tutorial/src/interoperability_main.cpp\"相对=nofollow>主要应用,一般所有端口的想法是这里描述,并且一些目前Linux的进展(大部分样品的需要真功夫!))。当我在linux下它编译编译此样本,发现库但分段错误执行过程中失败。当我编译它在Windows相同的事情发生。

我已经尽了全力不改变原创教程$ C $ç尽可能。

那么,什么是错的code,为什么如果失败,唯一的事项 - 如何解决它。

因此,如何建立这个东西用premake:


  1. 您获得 SVN从这里(只需要该文件夹)

  2. 的get premake为您的平台或源构建它,并把它进入文件夹从SVN下载

  3. 您应该有正式的升压编译和安装(请阅读ReadMe.txt文件,我们在目录中提供),所以需要什么:

    • 提升C ++库的(用1.4.16版本测试)

    • 升压拓(我们使用的最新修订,我们ADRESS它作为提升的一部分升压/推广/ ** 我们不得不做出一些chandes(其实只有一个),以提高扩展,使我们为他提供 Boost.Extension.Tutorial /库/升压内/推广/ 文件夹,以便当您下载SVN你得到了它,它是唯一的标题

    • 升压反射(我们使用它的由于本教程,我们使用最新修订,我们ADRESS它作为提升的一部分升压/反射/ ** *和simplness我们建议只把它变成 Boost.Extension.Tutorial /库/升压/反射 *


  4. 现在,当官方的加速是在你的系统中,只有头升压反射和Boost扩展在 Boost.Extension.Tutorial /库/升压文件夹,premake4可执行文件是 Boost.Extension.Tutorial / 文件夹内,我们可以简单地调用 Boost.Extension.Tutorial / premake4 - 建造 - windows.bat 在Windows上获得SLN为Visual Studio或 Boost.Extension.Tutorial / premake-build.sh 获得的makefile。

  5. 您能找到产生内部产生的项目解决方案文件夹/ Makefile文件。

  6. 有好运气!=)

更新:

Project文件用于Windows和Linux现在是在SVN 这样你就可以得到aroung项目创建与premake - 只是加速,我们的SVN,和反思头只LIB

更新2:
所以,一般我的电脑同时显示在Windows和Linux的问题。在我的Linux详细信息(这是一个的openSUSE 11.3 VMware映像,其中包括单声道2.10.2 )海湾合作委员会(的gcc -v

 鲁珀特@ Linux的:〜&GT; GCC -v
使用内置的规格。
COLLECT_GCC = GCC
COLLECT_LTO_WRAPPER = / usr / lib目录/ GCC / i586的-SUSE Linux的/ 4.5 / LTO-包装
目标:i586的-SUSE Linux的
- preFIX =的/ usr --infodir =的/ usr /共享/信息--mandir =的/ usr / share / man的--libdir = / usr / lib目录--libexecdir =的/ usr ../configure:与配置/ lib目录--enable-语言= C,C ++,objc,FORTRAN,OBJ-C ++,JAVA,ADA --enable-检查=发行--with-GXX-包括-DIR = / usr / include目录/ C ++ / 4.5 - 使-SSP --disable-libssp --disable-插件--with-bugurl = HTTP://bugs.opensuse.org/ --with-pkgversion ='的SUSE Linux'--disable---disable的libgcj-libmudflap - -with-slibdir = / lib目录--with-系统的zlib --enable -__ cxa_atexit --enable-libstdcxx分配器=新--disable-libstdcxx-PCH --enable-版本特有的运行时库--program-后缀= -4.5 --enable-Linux的futex的--without-系统libunwind --enable-金--with-插件-LD =的/ usr / bin中/金--with拱-32 = i586的--with-调=通用--build = i586的-SUSE Linux的
线程模型:POSIX
gcc版本4.5.0 20100604 [GCC-4_5-分支修订160292](的SUSE Linux)

我的窗户是标准的Windows 7在船上的Visual Studio团队系统2008年团队套件。

我提升为1.46.1 从这里下载编译并手动安装。


解决方案

有必须在结构的不同,因为这是我的测试结果:


  1. CD / tmp目录

  2. svn签 HTTP://cloudobserver.google$c$c .COM / SVN /分支机构/ V0.4 / cloudobserver

  3. CD cloudobserver / Boost.Extension.Tutorial /库/升压/

  4. SVN合作 http://svn.boost.org/svn/boost /沙/升压/反射/

  5. 光盘../../项目/ Linux的使用gmake /


  6. CD斌/调试/

  7. 导出LD_LIBRARY_PATH =。

  8. ./互操作性

输出:


  

首先反思:这是一个SUV。
  第二个反思:这是一个紧凑


一个释放球泡吧?


  1. CD ../..

  2. 请-bs配置=释放

  3. CD斌/释放/

  4. ./互操作性


  

首先反思:这是一个SUV。
  第二个反思:这是一个紧凑



更新

因为我已经有这个测试在32位的Linux


  • Ubuntu的GCC 4.4.5,升压1.42.0

  • Ubuntu的GCC 4.5.1,升压1.42.0

  • debian的GCC 4.5.2-8,提振1.46.1.1

  • 的Debian 4.6.1的gcc 20110428($ P $租赁前),提振1.46.1.1

单 - 2.10.2.vmdk图像的SuSE

  • GCC 4.5.0 20100604,提振1.42.0.7.1.1(从回购的YaST2)

  • GCC 4.5.0 20100604,升压1.46.1(源文件)

结论,提示

测试的所有版本给了我正确的和相同的输出。当然一定有什么东西PEBCAK怎么回事? 或许重复我在一个新的虚拟机上面的步骤来看一看吧

我真的可以看到出错的唯一的事情就是


  • 错误的库路径(动态加载(老了吗?)不兼容的建立使公司的)

  • 使用
  • 错误头(导致不兼容的构建OD这样的)

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:

  1. You get svn from here (only this folder is required)
  2. You get premake for your platform or build it from source and put it into folder you downloaded from svn
  3. 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 * )
  4. 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.
  5. You can find generated solution/makefiles inside generated projects folder.
  6. 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.

解决方案

There must be difference in configuration, because this is the result of my testing:

  1. cd /tmp
  2. svn checkout http://cloudobserver.googlecode.com/svn/branches/v0.4/ cloudobserver
  3. cd cloudobserver/Boost.Extension.Tutorial/libs/boost/
  4. svn co http://svn.boost.org/svn/boost/sandbox/boost/reflection/
  5. cd ../../projects/linux-gmake/
  6. make
  7. cd bin/debug/
  8. export LD_LIBRARY_PATH=.
  9. ./Interoperability

outputs:

First reflection: It's an SUV. Second reflection: It's a compact.

A release buld perhaps?

  1. cd ../..
  2. make -Bs config=release
  3. cd bin/release/
  4. ./Interoperability

First reflection: It's an SUV. Second reflection: It's a compact.


Update

I have since tested this on 32bit linux with

  • ubuntu gcc 4.4.5, boost 1.42.0
  • ubuntu gcc 4.5.1, boost 1.42.0
  • debian gcc 4.5.2-8, boost 1.46.1.1
  • debian gcc 4.6.1 20110428 (prerelease), boost 1.46.1.1

The Mono-2.10.2.vmdk image SuSE with

  • gcc 4.5.0 20100604, boost 1.42.0.7.1.1 (from yast2 repo)
  • gcc 4.5.0 20100604, boost 1.46.1 (from source)

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

  • wrong library paths (dynamically loading (old?) incompatible builds of so's)
  • wrong headers used (resulting in incompatible builds od so's)

这篇关于升压扩展反射如何编译官方样片时不与修复的bjam分段错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆