#56013 closed defect (fixed)
source-highlight @3.1.8_3: crashes (and fails to build) on 10.6
Reported by: | Ionic (Mihai Moldovan) | Owned by: | Mihai Moldovan <ionic@…> |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | michaelld (Michael Dickens) | |
Port: | source-highlight |
Description (last modified by Ionic (Mihai Moldovan))
:info:build ../src/source-highlight --data-dir ../src/ -s java -f html --style-file ../src/default.style -i ./Hello.java -o Hello1.html :info:build ../src/source-highlight --data-dir ../src/ -s java -f html --style-file ../src/default.style --input ./Hello.java --output Hello2.html --doc :info:build terminate called after throwing an instance of 'std::bad_cast' :info:build what(): terminate called after throwing an instance of 'std::bad_cast' :info:build what(): std::bad_cast :info:build std::bad_cast
Debugging this proves to be difficult...
# gdb (gdb) file /bin/sh Reading symbols for shared libraries .... done Reading symbols from /bin/sh...done. (gdb) run ../src/source-highlight --data-dir ../src/ -s java -f html --style-file ../src/default.style -i ./Hello.java -o Hello1.html Starting program: /bin/sh ../src/source-highlight --data-dir ../src/ -s java -f html --style-file ../src/default.style -i ./Hello.java -o Hello1.html Reading symbols for shared libraries +++. done Program received signal SIGTRAP, Trace/breakpoint trap. 0x00007fff5fc01028 in __dyld__dyld_start () (gdb) bt #0 0x00007fff5fc01028 in __dyld__dyld_start () #1 0x0000000100000000 in ?? () (gdb) c Continuing. Reading symbols for shared libraries ..warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/c_regex_traits.o" - no debug information available for "libs/regex/build/../src/c_regex_traits.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/cpp_regex_traits.o" - no debug information available for "libs/regex/build/../src/cpp_regex_traits.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/cregex.o" - no debug information available for "libs/regex/build/../src/cregex.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/fileiter.o" - no debug information available for "libs/regex/build/../src/fileiter.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/icu.o" - no debug information available for "libs/regex/build/../src/icu.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/instances.o" - no debug information available for "libs/regex/build/../src/instances.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/posix_api.o" - no debug information available for "libs/regex/build/../src/posix_api.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/regex.o" - no debug information available for "libs/regex/build/../src/regex.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/regex_raw_buffer.o" - no debug information available for "libs/regex/build/../src/regex_raw_buffer.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/regex_traits_defaults.o" - no debug information available for "libs/regex/build/../src/regex_traits_defaults.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/static_mutex.o" - no debug information available for "libs/regex/build/../src/static_mutex.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/wc_regex_traits.o" - no debug information available for "libs/regex/build/../src/wc_regex_traits.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/wide_posix_api.o" - no debug information available for "libs/regex/build/../src/wide_posix_api.cpp". warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_boost/boost/work/boost_1_66_0/bin.v2/libs/regex/build/darwin-darwin-4.2.1/release/threadapi-pthread/threading-multi/winstances.o" - no debug information available for "libs/regex/build/../src/winstances.cpp". ...... done terminate called after throwing an instance of 'std::bad_cast' what(): std::bad_cast Program received signal SIGABRT, Aborted. 0x00007fff8373b0b6 in __kill () (gdb) bt #0 0x00007fff8373b0b6 in __kill () #1 0x00007fff837db9f6 in abort () #2 0x0000000101ff5ec5 in __gnu_cxx::__verbose_terminate_handler () Previous frame inner to this frame (gdb could not unwind past this frame)
But luckily we do have diagnostic reports:
Process: source-highlight [82704] Path: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_source-highlight/source-highlight/work/source-highlight-3.1.8/src/.libs/source-highlight Identifier: source-highlight Version: ??? (???) Code Type: X86-64 (Native) Parent Process: gnumake [82703] Date/Time: 2018-03-11 23:26:33.349 +0100 OS Version: Mac OS X 10.6.8 (10K549) Report Version: 6 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Application Specific Information: abort() called Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libSystem.B.dylib 0x00007fff8373b0b6 __kill + 10 1 libSystem.B.dylib 0x00007fff837db9f6 abort + 83 2 libstdc++.6.dylib 0x0000000101ff5ec5 __gnu_cxx::__verbose_terminate_handler() + 188 3 libstdc++.6.dylib 0x0000000101ff4317 std::rethrow_exception(std::__exception_ptr::exception_ptr) + 106 4 libstdc++.6.dylib 0x0000000101ff4374 std::terminate() + 17 5 libstdc++.6.dylib 0x0000000101ff4556 __cxa_rethrow + 0 6 libstdc++.6.dylib 0x0000000101ff35d9 __cxa_bad_typeid + 0 7 libstdc++.6.dylib 0x0000000102039f99 std::collate<char> const& std::use_facet<std::collate<char> >(std::locale const&) + 74 8 libboost_regex-mt.dylib 0x0000000100181fc6 boost::shared_ptr<boost::re_detail_106600::cpp_regex_traits_implementation<char> const> boost::re_detail_106600::create_cpp_regex_traits<char>(std::locale const&) + 102 9 libboost_regex-mt.dylib 0x0000000100181df8 boost::re_detail_106600::regex_data<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::regex_data() + 72 10 libboost_regex-mt.dylib 0x0000000100180060 boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int) + 240 11 libsource-highlight.4.dylib 0x000000010001d743 boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::basic_regex(char const*, unsigned int) + 39 12 libsource-highlight.4.dylib 0x000000010001d7ee __static_initialization_and_destruction_0(int, int) + 132 13 dyld 0x00007fff5fc0d510 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 228 14 dyld 0x00007fff5fc0bcfc ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int) + 236 15 dyld 0x00007fff5fc0bcad ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int) + 157 16 dyld 0x00007fff5fc0bdb6 ImageLoader::runInitializers(ImageLoader::LinkContext const&) + 58 17 dyld 0x00007fff5fc0211a dyld::initializeMainExecutable() + 133 18 dyld 0x00007fff5fc06996 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**) + 2993 19 dyld 0x00007fff5fc016de dyldbootstrap::start(macho_header const*, int, char const**, long) + 811 20 dyld 0x00007fff5fc01052 _dyld_start + 42 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000000 rbx: 0x00007fff7066a2f8 rcx: 0x00007fff5fbfcd68 rdx: 0x0000000000000000 rdi: 0x0000000000014310 rsi: 0x0000000000000006 rbp: 0x00007fff5fbfcd80 rsp: 0x00007fff5fbfcd68 r8: 0x0000000000000000 r9: 0x000000000000000d r10: 0x00007fff837370fa r11: 0x0000000000000202 r12: 0x00000001022002d0 r13: 0x00000001000ad7c0 r14: 0x0000000102200220 r15: 0x00007fff5fbfce40 rip: 0x00007fff8373b0b6 rfl: 0x0000000000000202 cr2: 0x0000000101ff2fa4 Binary Images: 0x100000000 - 0x100010fff +source-highlight ??? (???) <EFDC48C5-79B0-248B-50D6-775F467C8D85> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_source-highlight/source-highlight/work/source-highlight-3.1.8/src/.libs/source-highlight 0x10001b000 - 0x1000a8fff +libsource-highlight.4.dylib 5.1.0 (compatibility 5.0.0) <0C70183E-0877-0E1A-BDA4-FA233DF841D8> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_source-highlight/source-highlight/work/source-highlight-3.1.8/lib/srchilite/.libs/libsource-highlight.4.dylib 0x100133000 - 0x10020efff +libboost_regex-mt.dylib ??? (???) <C1BEC490-2540-3F79-82FB-D134B59EC86F> /opt/local/lib/libboost_regex-mt.dylib 0x1002c3000 - 0x101bc2ff7 +libicudata.58.dylib 58.2.0 (compatibility 58.0.0) <C6B0192E-18BF-46A1-DB26-92A73F76692C> /opt/local/lib/libicudata.58.dylib 0x101bc4000 - 0x101d7fff7 +libicui18n.58.dylib 58.2.0 (compatibility 58.0.0) <4B10FF7F-8916-E290-9DA0-DBA55BE2A21E> /opt/local/lib/libicui18n.58.dylib 0x101e55000 - 0x101f89ff7 +libicuuc.58.dylib 58.2.0 (compatibility 58.0.0) <4D5676CB-1ACD-D4AA-EC01-9743409023A3> /opt/local/lib/libicuuc.58.dylib 0x101ff1000 - 0x1020acff7 +libstdc++.6.dylib 7.24.0 (compatibility 7.0.0) <EA6F8F3B-B29F-3AF2-918C-4BECC914BB52> /opt/local/lib/libgcc/libstdc++.6.dylib 0x102148000 - 0x102157fe7 +libgcc_s.1.dylib ??? (???) <00C2E662-1D79-3083-984C-49098B4EC84D> /opt/local/lib/libgcc/libgcc_s.1.dylib 0x7fff5fc00000 - 0x7fff5fc3be0f dyld 132.1 (???) <29DECB19-0193-2575-D838-CF743F0400B2> /usr/lib/dyld 0x7fff81c78000 - 0x7fff81c7cff7 libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> /usr/lib/system/libmathCommon.A.dylib 0x7fff836ec000 - 0x7fff838adfef libSystem.B.dylib 125.2.11 (compatibility 1.0.0) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib 0x7fff85de9000 - 0x7fff85e66fef libstdc++.6.dylib 7.9.0 (compatibility 7.0.0) <35ECA411-2C08-FD7D-11B1-1B7A04921A5C> /usr/lib/libstdc++.6.dylib 0x7fffffe00000 - 0x7fffffe01fff libSystem.B.dylib ??? (???) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib
Attachments (1)
Change History (9)
Changed 7 years ago by Ionic (Mihai Moldovan)
Attachment: | source-highlight-main.log added |
---|
comment:1 Changed 7 years ago by Ionic (Mihai Moldovan)
Description: | modified (diff) |
---|
comment:2 Changed 7 years ago by Ionic (Mihai Moldovan)
Cc: | michaelld added |
---|
comment:3 Changed 7 years ago by Ionic (Mihai Moldovan)
Switching to a libc++
-based installation as described in LibcxxOnOlderSystems fixes this bug, which is not very surprising.
Given that boost seems to be linking against the system libstdc++
, which doesn't support C++11, we could potentially fix this issue by having boost link against macports-libstdc++
, which does support C++11, if the libc++
is set to libstdc++
. Comments?
comment:4 follow-up: 5 Changed 7 years ago by kencu (Ken)
We are about to default to libc++
on all Intel systems, in part for exactly this reason.
Perhaps this is a wontfix
?
comment:5 Changed 7 years ago by Ionic (Mihai Moldovan)
Replying to kencu:
We are about to default to
libc++
on all Intel systems, in part for exactly this reason.
Yeah, that's why I decided to switch my 10.6 VM over to the new system. There are more and more problems with the default system libstdc++
and if consensus is to only support these systems with libc++
, I might as well switch.
Perhaps this is a
wontfix
?
Maybe. The question, though, is, whether adding -stdlib=macports-libstdc++
to the boost build process if cxx_stdlib eq libstdc++
could trivially fix this problem for the now legacy-legacy platform or not. I might want to test this out in my libstdc++
backup prefix.
comment:6 follow-up: 7 Changed 7 years ago by Mihai Moldovan <ionic@…>
Owner: | set to Mihai Moldovan <ionic@…> |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:7 follow-up: 8 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to Ionic:
It's likely that this has been caused by #55926.
Recompiling with
cxx11 1.1
and adding-stdlib=c++11
causes other corruption:
-stdlib=c++11
is not a valid flag. Perhaps you meant -std=c++11
and/or -stdlib=libc++
.
Replying to Ionic:
Switching to a
libc++
-based installation as described in LibcxxOnOlderSystems fixes this bug, which is not very surprising.
That does surprise me. That should not have worked, since that works by passing the -stdlib=libc++
flag every time C++ files are compiled or linked. Since that flag was missing when linking, linking should have failed. And it should have succeeded when not using LibcxxOnOlderSystems.
Given that boost seems to be linking against the system
libstdc++
, which doesn't support C++11, we could potentially fix this issue by having boost link againstmacports-libstdc++
, which does support C++11, if thelibc++
is set tolibstdc++
. Comments?
Since #55926 was fixed, on older systems, boost does not use the system libstdc++, which doesn't support C++11. It uses the MacPorts libstdc++, which does support C++11.
Replying to kencu:
Perhaps this is a
wontfix
?
No, we should fix such problems by passing the -stdlib=
flag where needed. This will continue to be necessary after we make libc++ the default cxx_stdlib, unless we change the clang compiler's default stdlib. I know you've advocated for that elsewhere so we don't need to discuss it again in this ticket.
Replying to Mihai Moldovan <ionic@…>:
Using the cxx11 1.1 portgroup should not be necessary. The whole point of #55926 was to make C++11 features available to ports that use boost, but not to require ports that use boost to use C++11. If that didn't work for source-highlight -- if source-highlight doesn't build on older systems anymore unless C++11 is used now -- then we might need to reevaluate what we did in the boost port for #55926.
comment:8 Changed 7 years ago by Ionic (Mihai Moldovan)
Replying to ryandesign:
Replying to Ionic:
Recompiling with
cxx11 1.1
and adding-stdlib=c++11
causes other corruption:
-stdlib=c++11
is not a valid flag. Perhaps you meant-std=c++11
and/or-stdlib=libc++
.
Sorry, of course I meant -stdlib=libc++
.
Replying to Ionic:
Switching to a
libc++
-based installation as described in LibcxxOnOlderSystems fixes this bug, which is not very surprising.That does surprise me. That should not have worked, since that works by passing the
-stdlib=libc++
flag every time C++ files are compiled or linked. Since that flag was missing when linking, linking should have failed. And it should have succeeded when not using LibcxxOnOlderSystems.
As far as I've seen, source-highlight's dylib was linked against the system libstdc++
. That's also visible in the crash report. I think the problem here is that the binary and library are built and linked against a different stdlib instead of the one found in library dependents (like the boost-regex library). Since two different C++ standard libraries are linked in this case, a lot of stuff breaks. If we build programs like source-highlight
in C++11 mode and against the same stdlib as boost, such mismatched should not happen.
Given that boost seems to be linking against the system
libstdc++
, which doesn't support C++11, we could potentially fix this issue by having boost link againstmacports-libstdc++
, which does support C++11, if thelibc++
is set tolibstdc++
. Comments?Since #55926 was fixed, on older systems, boost does not use the system libstdc++, which doesn't support C++11. It uses the MacPorts libstdc++, which does support C++11.
That's correct, not sure where I got that idea from. It was linking against a libstdc++ version, but it was not the system one, but (the correct) MacPorts version.
Replying to kencu:
Perhaps this is a
wontfix
?No, we should fix such problems by passing the
-stdlib=
flag where needed. This will continue to be necessary after we make libc++ the default cxx_stdlib, unless we change the clang compiler's default stdlib. I know you've advocated for that elsewhere so we don't need to discuss it again in this ticket.
If doing the migration correctly by changing cxx_stdlib
and forcing all usage of C++ code to be linked against this, such problems shouldn't come up any longer (unless we start mixing up libc++
and libstdc++
, but I hope there's no reason for this to happen).
Using the cxx11 1.1 portgroup should not be necessary. The whole point of #55926 was to make C++11 features available to ports that use boost, but not to require ports that use boost to use C++11. If that didn't work for source-highlight -- if source-highlight doesn't build on older systems anymore unless C++11 is used now -- then we might need to reevaluate what we did in the boost port for #55926.
It definitely didn't work. source-highlight
was both linking against the system libstdc++
and pulling in libboost-regex-mt.dylib
, which linked against a different C++ stdlib. That lead to everything crashing. Only force-enabling C++11 mode and changing the stdlib at compile/link time directly to the one boost
was built against fixed this issue.
I do not see a way to fix such library mix up issues just by having boost build against a different stdlib. Other programs will always be linked against the default stdlib (if not specified otherwise) by the compiler. The only way this could *possibly* work is by using -nostdlib
which avoids pulling in an stdlib - and hope that library dependencies will pull in a suitable stdlib. I don't know if programs and libraries will successfully link at build time with -nostdlib
, though.
It's likely that this has been caused by #55926.
Recompiling with
cxx11 1.1
and adding-stdlib=c++11
causes other corruption: