hovatterz / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

Unit tests Abort when built as shared library #279

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build as a shared library (BUILD_SHARED_LIBS=ON)
2. Run the unit tests

What is the expected output? What do you see instead?
I would expect the unit tests to run and exit cleanly, instead after the tests 
finish I get

*** glibc detected *** ./run-tests: double free or corruption (fasttop): 
0x0000000001f820d0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x76a16)[0x7ff22a2fda16]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7ff22a3027bc]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSsD1Ev+0x20)[0x7ff22ab6ab20]
/lib/x86_64-linux-gnu/libc.so.6(__cxa_finalize+0xa5)[0x7ff22a2bde65]
/home/paul/Source/yaml-cpp-collab/Build/test/gmock-1.7.0/libgmock.so(+0x268f3)[0
x7ff22aff48f3]
======= Memory map: ========
00400000-006f0000 r-xp 00000000 08:05 4464026                            
/home/paul/Source/yaml-cpp-collab/Build/test/run-tests
008f0000-008f1000 rw-p 002f0000 08:05 4464026                            
/home/paul/Source/yaml-cpp-collab/Build/test/run-tests
008f1000-008f3000 rw-p 00000000 00:00 0 
01f34000-01faf000 rw-p 00000000 00:00 0                                  [heap]
7ff224000000-7ff224021000 rw-p 00000000 00:00 0 
7ff224021000-7ff228000000 ---p 00000000 00:00 0 
7ff22a287000-7ff22a409000 r-xp 00000000 08:05 2097600                    
/lib/x86_64-linux-gnu/libc-2.13.so
7ff22a409000-7ff22a609000 ---p 00182000 08:05 2097600                    
/lib/x86_64-linux-gnu/libc-2.13.so
7ff22a609000-7ff22a60d000 r--p 00182000 08:05 2097600                    
/lib/x86_64-linux-gnu/libc-2.13.so
7ff22a60d000-7ff22a60e000 rw-p 00186000 08:05 2097600                    
/lib/x86_64-linux-gnu/libc-2.13.so
7ff22a60e000-7ff22a613000 rw-p 00000000 00:00 0 
7ff22a613000-7ff22a628000 r-xp 00000000 08:05 2097651                    
/lib/x86_64-linux-gnu/libgcc_s.so.1
7ff22a628000-7ff22a828000 ---p 00015000 08:05 2097651                    
/lib/x86_64-linux-gnu/libgcc_s.so.1
7ff22a828000-7ff22a829000 rw-p 00015000 08:05 2097651                    
/lib/x86_64-linux-gnu/libgcc_s.so.1
7ff22a829000-7ff22a8aa000 r-xp 00000000 08:05 2097597                    
/lib/x86_64-linux-gnu/libm-2.13.so
7ff22a8aa000-7ff22aaa9000 ---p 00081000 08:05 2097597                    
/lib/x86_64-linux-gnu/libm-2.13.so
7ff22aaa9000-7ff22aaaa000 r--p 00080000 08:05 2097597                    
/lib/x86_64-linux-gnu/libm-2.13.so
7ff22aaaa000-7ff22aaab000 rw-p 00081000 08:05 2097597                    
/lib/x86_64-linux-gnu/libm-2.13.so
7ff22aaab000-7ff22ab93000 r-xp 00000000 08:05 3540769                    
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ff22ab93000-7ff22ad93000 ---p 000e8000 08:05 3540769                    
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ff22ad93000-7ff22ad9b000 r--p 000e8000 08:05 3540769                    
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ff22ad9b000-7ff22ad9d000 rw-p 000f0000 08:05 3540769                    
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17
7ff22ad9d000-7ff22adb2000 rw-p 00000000 00:00 0 
7ff22adb2000-7ff22adc9000 r-xp 00000000 08:05 2100805                    
/lib/x86_64-linux-gnu/libpthread-2.13.so
7ff22adc9000-7ff22afc8000 ---p 00017000 08:05 2100805                    
/lib/x86_64-linux-gnu/libpthread-2.13.so
7ff22afc8000-7ff22afc9000 r--p 00016000 08:05 2100805                    
/lib/x86_64-linux-gnu/libpthread-2.13.so
7ff22afc9000-7ff22afca000 rw-p 00017000 08:05 2100805                    
/lib/x86_64-linux-gnu/libpthread-2.13.so
7ff22afca000-7ff22afce000 rw-p 00000000 00:00 0 
7ff22afce000-7ff22b033000 r-xp 00000000 08:05 4463911                    
/home/paul/Source/yaml-cpp-collab/Build/test/gmock-1.7.0/libgmock.so
7ff22b033000-7ff22b233000 ---p 00065000 08:05 4463911                    
/home/paul/Source/yaml-cpp-collab/Build/test/gmock-1.7.0/libgmock.so
7ff22b233000-7ff22b236000 rw-p 00065000 08:05 4463911                    
/home/paul/Source/yaml-cpp-collab/Build/test/gmock-1.7.0/libgmock.so
7ff22b236000-7ff22b282000 r-xp 00000000 08:05 4463917                    
/home/paul/Source/yaml-cpp-collab/Build/test/gmock-1.7.0/gtest/libgtest.so
7ff22b282000-7ff22b482000 ---p 0004c000 08:05 4463917                    
/home/paul/Source/yaml-cpp-collab/Build/test/gmock-1.7.0/gtest/libgtest.so
7ff22b482000-7ff22b485000 rw-p 0004c000 08:05 4463917                    
/home/paul/Source/yaml-cpp-collab/Build/test/gmock-1.7.0/gtest/libgtest.so
7ff22b485000-7ff22b4fe000 r-xp 00000000 08:05 4463978                    
/home/paul/Source/yaml-cpp-collab/Build/libyaml-cpp.so.0.5.1
7ff22b4fe000-7ff22b6fe000 ---p 00079000 08:05 4463978                    
/home/paul/Source/yaml-cpp-collab/Build/libyaml-cpp.so.0.5.1
7ff22b6fe000-7ff22b700000 rw-p 00079000 08:05 4463978                    
/home/paul/Source/yaml-cpp-collab/Build/libyaml-cpp.so.0.5.1
7ff22b700000-7ff22b701000 rw-p 00000000 00:00 0 
7ff22b701000-7ff22b721000 r-xp 00000000 08:05 2097610                    
/lib/x86_64-linux-gnu/ld-2.13.so
7ff22b8dc000-7ff22b8e4000 rw-p 00000000 00:00 0 
7ff22b91c000-7ff22b920000 rw-p 00000000 00:00 0 
7ff22b920000-7ff22b921000 r--p 0001f000 08:05 2097610                    
/lib/x86_64-linux-gnu/ld-2.13.so
7ff22b921000-7ff22b922000 rw-p 00020000 08:05 2097610                    
/lib/x86_64-linux-gnu/ld-2.13.so
7ff22b922000-7ff22b923000 rw-p 00000000 00:00 0 
7ffff02fa000-7ffff031b000 rw-p 00000000 00:00 0                          [stack]
7ffff0399000-7ffff039a000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  
[vsyscall]
Aborted

What version of the product are you using? On what operating system?
Current trunk, Debian Sid

Please provide any additional information below.
This happens because both gmock and gtest are linked to the tests, this is 
redundant, I think. The attached patch just links the tests against gmock.

Original issue reported on code.google.com by paul.nov...@gmail.com on 21 Feb 2015 at 2:38

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed, r1decba57cf6f.

Interestingly, I couldn't reproduce this on OS X, but I could on Ubuntu.

Original comment by jbe...@gmail.com on 21 Feb 2015 at 6:40