Opened 10 years ago

Closed 10 years ago

#7642 closed Bugs (fixed)

archive::archive_exception fails to build when using C++11 with gcc 4.7.2

Reported by: steven.lemay@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.52.0 Severity: Problem
Keywords: archive exception failed throw destructor Cc:

Description

The destructors no throw specifier 'throw ()' appears not be be inherited properly for some classes derived from archive::archive_exception. A temporary workaround was to remove the 'throw ()' specification for gcc 4.7.2 compilation.

Build log output.

"QCC" -Wc,-ftemplate-depth-128 -DFD_SETSIZE=2048 -march=k8-sse3 -mtune=k8-sse3 -mmmx -msse3 -mfpmath=sse -mno-3dnow -mstackrealign -Y_cpp -Wc,-fPIC,-fnothrow-opt,-std=c++11,-std=gnu++11 -O3 -Wc,-finline-functions -Wc,-Wno-inline -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I"." -c -o "D:\boostBuild_QCC_1_52_0\boost\bin.v2\libs\serialization\build\qcc\release\link-static\target-os-qnxnto\threadapi-pthread\threading-multi\xml_iarchive.o" "libs\serialization\src\xml_iarchive.cpp"

...failed qcc.compile.c++ D:\boostBuild_QCC_1_52_0\boost\bin.v2\libs\serialization\build\qcc\release\link-static\target-os-qnxnto\threadapi-pthread\threading-multi\xml_iarchive.o... qcc.compile.c++ D:\boostBuild_QCC_1_52_0\boost\bin.v2\libs\serialization\build\qcc\release\link-static\target-os-qnxnto\threadapi-pthread\threading-multi\xml_archive_exception.o In file included from libs\serialization\src\xml_archive_exception.cpp:21:0: ./boost/archive/xml_archive_exception.hpp:35:44: error: looser throw specifier for 'virtual boost::archive::xml_archive_exception::~xml_archive_exception()' In file included from ./boost/archive/xml_archive_exception.hpp:25:0,

from libs\serialization\src\xml_archive_exception.cpp:21:

./boost/archive/archive_exception.hpp:86:5: error: overriding 'virtual boost::archive::archive_exception::~archive_exception() throw ()' cc: d:/qnxsdk/qnxsdk6.5-001/host/win32/x86/usr/lib/gcc/i486-pc-nto-qnx6.5.0/4.7.2/cc1plus caught signal 1

Change History (11)

comment:1 by Robert Ramey, 10 years ago

I've investigated this and some things occur to me.

a) I'm suspecting that this some sort of compiler/library quirk related to qcc compiler. I say this because our text matrix shows problems with this compiler and the serialization library.

b) I don't see virtual boost::archive::archive_exception::~archive_exception() throw (); on line 86 of boost/archive/archive_exception.hpp:86: What I DO see is ~archive_exception(); which looks fine to me.

c) Another thing I see is: class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception :

public virtual std::exception

{ on line 44 of boost/archive/archive_exception.hpp: This raises a couple of issues:

1) Why did I put "virtual" there. This would be to conflate base classes when the exception is part of a multiple inheritance hierarchy. Perhaps not a bad idea. But I doubt that it's used by anyone.

2)I looks to me that the compiler is using this to mean that all functions are virtual? One can only guess.

I would try commenting out the "virtual" inheritance and see if that fixes things. Since I don't have this compiler, this would fall to you. I would also much appreciate it if you used tools/regression/src/library_test.sh to run ALL the serialization library tests after making this change and let me know what happens. Meanwhile, I'll leave this pending.

Robert Ramey

comment:2 by steven.lemay@…, 10 years ago

I restored the original code and only removed the misplaced 'virtual' as described in item c) on line 44 boost/archive/archive_exception.hpp. Boost::serialization now builds WITHOUT the errors previously described.

Now consider xml_archive_exception.hpp line 35-36:

class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) xml_archive_exception :

public virtual boost::archive::archive_exception

comment:3 by steven.lemay@…, 10 years ago

I'm new to Boost, and especially the included regression test system. I'm not having much luck executing the suggested test on our Windows hosted cross-compile environment for QNX RTOS. Even running the provided batch file for the Windows 7/VS2012 build doesn't seem to work off-the-shelf. Hopefully, I can better verify the change once I figure this out (or what I'm doing wrong to execute the test). Sorry for the delay.

comment:4 by Robert Ramey, 10 years ago

First of all - thanks for making this effort. I realize it's much harder than it should be.

Here is some advice. Use the procedure described in

http://www.boost.org/doc/libs/1_52_0/tools/regression/doc/library_status.html

This will permit you to just test your changes in the serialization library without having to test the whole of boost. This still takes a while - over an hour - but it's doable.

Note that this required the building of the library_status and process_jam_log executables. Contrary to the information on the page sited above, the bjam command to do this would be:

bjam toolset=<your compiler here!> library_status process_jam_log

This is required because the Jamfile in the .../tools/regression/build/Jamfile doesn't build these two executable by default - you have to explicitly state them as targets.

Good Luck with this. and thanks again.

Robert Ramey

comment:5 by anonymous, 10 years ago

Are you able to perform these test operations with Visual Studio [2012]? I am having little success. I must be missing some fundamental step or configuration.

comment:6 by Robert Ramey, 10 years ago

I haven't tried vs 2012. But I'm pretty confident things will work.

The question is: have you been able to get the bjam and related tools up and running? That's the key. This might entail:

fixing up user-config.jam in regression/tools/... making sure your command line compiler works. I had to make batch file in my program files to make make this work.

compile process_jam_log and library_status and move the executables to some directory in the path.

Finally:

move to BOOST_ROOT/libs/serialization/test

invoke ../../../regression/test/library_test.bat (or sh) and follow the instructions there.

Robert Ramey

comment:7 by Robert Ramey, 10 years ago

I've been looking int to this somewhat. Mostly into why I used the "virtual" in the first place. I'm guessing that this was due to the advice offered in http://www.boost.org/community/error_handling.html which you might want to look at. Based on this I would be inclined to leave in the "virtual" for the normal case - but eliminated for the offending situation. I believe that this problem only occurs with the QCC compiler. Maybe you have a little more information you can share about this. I don't know if there is a boost config macro which can detect this problem so we can work around it in a more definitive manner.

Still looking at this.

Robert Ramey

comment:8 by anonymous, 10 years ago

I looked at this some more and concluded that the best fix is to remove the "throw()" from the archive exception constructors and destructores.

a) They weren't really correct in the first place. b) constructors / destructors shouldn't ever throw anyhow c) I believe that this will fix your issue.

The change will be chacked in the trunk in a few days after I can run tests on my local system.

Robert Ramey

comment:9 by tvaneerd@…, 10 years ago

by the way, QCC is just a simple wrapper around gcc. The same bug should happen with gcc with the same compiler flags set.

comment:10 by Robert Ramey, 10 years ago

I believe I've addressed this.

I've checked in changes to the trunk. Please verify if this problem isn't solved.

Robert Ramey

comment:11 by Robert Ramey, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.