[MacPorts] #36953: Basic serialization code throws exception (boost)
#36953: Basic serialization code throws exception (boost) --------------------------+-------------------------------- Reporter: dario.izzo@… | Owner: macports-tickets@… Type: defect | Status: new Priority: High | Milestone: Component: ports | Version: 2.1.2 Keywords: | Port: --------------------------+-------------------------------- Lets take the basic code below (taken from the basic tutorial from boost developers http://www.boost.org/doc/libs/1_52_0/libs/serialization/doc/tutorial.html) {{{ #include <fstream> // include headers that implement a archive in simple text format #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> ///////////////////////////////////////////////////////////// // gps coordinate // // illustrates serialization for a simple type // class gps_position { private: friend class boost::serialization::access; // When the class Archive corresponds to an output archive, the // & operator is defined similar to <<. Likewise, when the class Archive // is a type of input archive the & operator is defined similar to >>. template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & degrees; ar & minutes; ar & seconds; } int degrees; int minutes; float seconds; public: gps_position(){}; gps_position(int d, int m, float s) : degrees(d), minutes(m), seconds(s) {} }; int main() { // create and open a character archive for output std::ofstream ofs("filename"); // create class instance const gps_position g(35, 59, 24.567f); // save data to archive { boost::archive::text_oarchive oa(ofs); // write class instance to archive oa << g; // archive and stream closed when destructors are called } // ... some time later restore the class instance to its orginal state gps_position newg; { // create and open an archive for input std::ifstream ifs("filename"); boost::archive::text_iarchive ia(ifs); // read class state from archive ia >> newg; // archive and stream closed when destructors are called } return 0; } }}} and compile it with {{{ g++ boost_archives.cpp -L/opt/local/lib/ -lboost_serialization-mt }}} where: {{{ g++ --version }}} returns: {{{ g++ (MacPorts gcc47 4.7.2_2) 4.7.2 }}} the following exception is caught!! {{{ (libc++abi.dylib: terminate called throwing an exception) }}} I also tried gcc 4.5 and boost 1.49, 1.50, 1.51 -> no difference. Conclusion: The mac port boost serialization library seems to not work on osx 10.8.2!!! -- Ticket URL: <https://trac.macports.org/ticket/36953> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36953: Basic serialization code throws exception (boost) ---------------------------+-------------------------------- Reporter: dario.izzo@… | Owner: macports-tickets@… Type: defect | Status: new Priority: High | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: | ---------------------------+-------------------------------- Comment (by dario.izzo@…): I forgot to mention that the original attempt was made woth boost 1.52 -- Ticket URL: <https://trac.macports.org/ticket/36953#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36953: Basic serialization code throws exception (boost) ---------------------------+--------------------------- Reporter: dario.izzo@… | Owner: adfernandes@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: boost | ---------------------------+--------------------------- Changes (by ecronin@…): * owner: macports-tickets@… => adfernandes@… * priority: High => Normal * port: => boost Comment: Boost is compiled with the Apple compilers in macports. It is incompatible with any of the macports gccs due to incompatibilities between the different C++ runtimes the two compiler families use (libstdc++ vs libc++) and will at best error out like you're seeing and at worst appear to work but be unreliable. Your choices at this time are to compile your own boost with the macports gcc toolchain or use clang/llvm-gcc with the macports boost. Also do not set the priority field in tickets and cc: the port's maintainer. -- Ticket URL: <https://trac.macports.org/ticket/36953#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36953: Basic serialization code throws exception (boost) ---------------------------+--------------------------- Reporter: dario.izzo@… | Owner: adfernandes@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: invalid | Keywords: Port: boost | ---------------------------+--------------------------- Changes (by adfernandes@…): * status: new => closed * resolution: => invalid Comment: This summary is, unfortunately, entirely correct. Boost also has a nasty habit of using quite different compiler settings for clang++ and gcc++, the most recent one being completely different link-visibility settings. Personally, my company has actually began migrating away from boost because of issues like these. The header-only parts are okay, but the library issues are driving us insane. Marking the bug as "invalid" because, technically, it isn't a bug, it's mixing incompatible dynamic libraries. Even though it should not be a problem. Even though it's silly to have incompatibilities like this. Sorry. Wow. It's like using dynamic libraries back in the 1980s! -- Ticket URL: <https://trac.macports.org/ticket/36953#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
participants (1)
-
MacPorts