Using Boost.Test on 64-bit OSX

I can't seem to get Boost's unit test framework to work on OS X Leopard (10.5) when using "-arch x86_64" for 64-bit builds (note: the programs I build using boost seem to work fine, but the unit tests blow up). I have Xcode 3.1.2 installed, and the results are the same if I'm using gcc 4.0 or 4.2. I used the 32_64.diff patch from trac to make 4-way Universal boost libraries (https://svn.boost.org/trac/boost/ticket/1679 ). Any ideas would be greatly appreciated =) Thanks, -Mike Without "-arch x86_64" (defaults to 32-bit intel): Mikes-Mac-Pro:~ mdickey$ g++ -DBOOST_TEST_DYN_LINK -I/usr/local/ include/boost-1_37 -L/usr/local/lib -lboost_unit_Test_framework-xgcc42- mt -o test test.cpp Mikes-Mac-Pro:~ mdickey$ ./test Running 5 test cases... *** No errors detected With "-arch x86_64": Mikes-Mac-Pro:~ mdickey$ g++ -arch x86_64 -DBOOST_TEST_DYN_LINK -I/usr/ local/include/boost-1_37 -L/usr/local/lib -lboost_unit_Test_framework- xgcc42-mt -o test test.cpp Mikes-Mac-Pro:~ mdickey$ ./test --log_level=all Running 5 test cases... Entering test suite "simple-unit-test" Entering test suite "SimpleTests_S" Entering test case "test1" Test case test1 doesn't include any assertions Leaving test case "test1"; testing time: 22mks Entering test case "test2" Test case test2 doesn't include any assertions Leaving test case "test2"; testing time: 15mks Entering test case "test3" Test case test3 doesn't include any assertions Leaving test case "test3"; testing time: 16mks Entering test case "test4" Test case test4 doesn't include any assertions Leaving test case "test4"; testing time: 15mks Entering test case "test5" Test case test5 doesn't include any assertions Leaving test case "test5"; testing time: 14mks Leaving test suite "SimpleTests_S" Leaving test suite "simple-unit-test" *** No errors detected test(93789) malloc: *** error for object 0x30001001004d0: Non-aligned pointer being freed (2) *** set a breakpoint in malloc_error_break to debug test(93789) malloc: *** error for object 0x30001001005d0: Non-aligned pointer being freed (2) *** set a breakpoint in malloc_error_break to debug test(93789) malloc: *** error for object 0x30001001006c0: Non-aligned pointer being freed (2) *** set a breakpoint in malloc_error_break to debug test(93789) malloc: *** error for object 0x30001001007c0: Non-aligned pointer being freed (2) *** set a breakpoint in malloc_error_break to debug gdb backtrace to malloc_error_break (note above that it's happening after completion of all tests): #0 0x00007fff810a9a11 in malloc_error_break () #1 0x00007fff810a4a90 in szone_error () #2 0x00000001000156ec in ~framework_impl [inlined] () at impl/ framework.ipp:133 #3 0x00000001000156ec in __tcf_1 () at impl/framework.ipp:222 #4 0x00007fff8100131c in __cxa_finalize () #5 0x00007fff81001232 in exit () #6 0x0000000100001057 in start () Confirm test program is a 64-bit executable: Mikes-Mac-Pro:~ mdickey$ file test test: Mach-O 64-bit executable x86_64 Dynamic linkage of test program: Mikes-Mac-Pro:~ mdickey$ otool -L test test: libboost_unit_test_framework-xgcc42-mt-1_37.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3) Confirm Universal/FAT build of Boost libraries: Mikes-Mac-Pro:~ mdickey$ file /usr/local/lib/ libboost_unit_test_framework-xgcc42-mt.dylib /usr/local/lib/libboost_unit_test_framework-xgcc42-mt.dylib: Mach-O universal binary with 4 architectures /usr/local/lib/libboost_unit_test_framework-xgcc42-mt.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/local/lib/libboost_unit_test_framework-xgcc42-mt.dylib (for architecture ppc7400): Mach-O dynamically linked shared library ppc /usr/local/lib/libboost_unit_test_framework-xgcc42-mt.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/local/lib/libboost_unit_test_framework-xgcc42-mt.dylib (for architecture ppc64): Mach-O 64-bit dynamically linked shared library ppc64 Source code for test.cpp (note that if I have just one or two test cases it doesn't crash.. having several IS significant): #define BOOST_TEST_MODULE simple-unit-test #include <boost/test/unit_test.hpp> class SimpleFixture { public: SimpleFixture() {} virtual ~SimpleFixture() {} }; BOOST_FIXTURE_TEST_SUITE(SimpleTests_S, SimpleFixture) BOOST_AUTO_TEST_CASE(test1) {} BOOST_AUTO_TEST_CASE(test2) {} BOOST_AUTO_TEST_CASE(test3) {} BOOST_AUTO_TEST_CASE(test4) {} BOOST_AUTO_TEST_CASE(test5) {} BOOST_AUTO_TEST_SUITE_END()

Michael Dickey <mike <at> mikedickey.com> writes:
test(93789) malloc: *** error for object 0x30001001004d0: Non-aligned pointer being freed (2)
#0 0x00007fff810a9a11 in malloc_error_break () #1 0x00007fff810a4a90 in szone_error () #2 0x00000001000156ec in ~framework_impl [inlined] () at impl/ framework.ipp:133 #3 0x00000001000156ec in __tcf_1 () at impl/framework.ipp:222 #4 0x00007fff8100131c in __cxa_finalize () #5 0x00007fff81001232 in exit () #6 0x0000000100001057 in start ()
I have a suspicion that it's related to the delete statements valgrind was complaining about. Not sure what is wrong though. Try to comment delete for test units and let me know how it works. Maybe you can provide some explanation either. Gennadiy
participants (2)
-
Gennadiy Rozental
-
Michael Dickey