Thursday 21 April 2011

Developer Journal 75 - On Boost Serialization

I'm struggling to link the Boost Serialization Library. I've done it before using Makefiles but now I'm using CMake to create Makefiles for me.

I tried to build the Boost Serialization Library but no luck but the linker could not find the serialization library.

bjam toolset=gcc --with-serilization stage

I tried to make a shared library but the build process failed.

bjam toolset=gcc --with-serialization link=shared stage

I'm going to try a complete build.

bjam toolset=gcc --with-serialization --build-type=complete stage

If that doesn't work, I'm going to have to do a more in depth study of CMake by starting with a a simple CMake file. The CMake file I got was from the OGRE graphics library but it's too complex.

I'm working with Boost 1.44, MinGW 4.5, and CMake 2.8. I had to upgrade from Boost 1.42, MinGW 4.4, and Makefiles to work with OGRE.

I tried a complete build of the Boost Serialization Library but there a number of targets that failed to build, notably the shared or DLL ones. Hmm.

I'm not sure whether to try to fix Boost Serialization or learn more about CMake. I don't know whether I need the Boost Serialization DLL files or not.

I had a search for Boost 1.44 Serialization MinGW and other people have had trouble building the shared libraries as well. I really don't want to step up a version.

I tried renaming a Boost 1.42 Serialization DLL to 1.44 but the linker could not find it. I just remembered that you need the LIB file for link time. The DLL is only for run time. I'm expecting that the linker should at least find the file and then stop. No luck.

I removed libboost_thread-mgw45-mt-1_44.a and the linker complained. At least I know the linker is looking in the right directory.

I had a look at the way the CMake file from OGRE linked to the Boost Thread library and success!

Instead of doing the following which strangely works for Bullet but not Boost.

target_link_libraries(OgreApp
BulletDynamics
BulletCollision
LinearMath
opengl32
glu32
$(OGRE_LIBRARIES)
$(OIS_LIBRARIES)
boost_serialization
)

I did,

set(OGRE_BOOST_COMPONENTS thread date_time serialization)

Yes!

I removed the fake libboost_serialization-mgw45-mt-1_44.lib and libboost_serialization-mgw45-mt-1_44.dll

No! Turns out I needed libboost_serialization-mgw45-mt-1_44.lib after all.

Argh! What am I to do? Nevermind, at least I've take another step forward.

The fake LIB and DLL files don't work either.

Looks like I have to upgrade my copy of Boost.

I hate websites that copy discussions from other websites. I just don't get why they do that!

It might be time to move away from Boost Serialization.

http://code.google.com/p/protobuf/
http://s11n.net/

There doesn't seem to be a fix. I'm going to try to upgrade one version of Boost to 1.45. Fingers crossed.

RELATED

No comments:

Post a Comment