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 insideBoost.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 intoBoost.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 insideBoost.Extension.Tutorial/
folder we can simply callBoost.Extension.Tutorial/ premake4-build-windows.bat
on windows to get sln for Visual Studio orBoost.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.
There must be difference in configuration, because this is the result of my testing:
- cd /tmp
- svn checkout http://cloudobserver.googlecode.com/svn/branches/v0.4/ cloudobserver
- cd cloudobserver/Boost.Extension.Tutorial/libs/boost/
- svn co http://svn.boost.org/svn/boost/sandbox/boost/reflection/
- cd ../../projects/linux-gmake/
- make
- cd bin/debug/
- export LD_LIBRARY_PATH=.
- ./Interoperability
outputs:
First reflection: It's an SUV. Second reflection: It's a compact.
A release buld perhaps?
- cd ../..
- make -Bs config=release
- cd bin/release/
- ./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)
精彩评论