Bug 82366 - std::regex constructor called from shared library throws std::bad_cast
Summary: std::regex constructor called from shared library throws std::bad_cast
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 7.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: std::regex
  Show dependency treegraph
 
Reported: 2017-09-29 19:28 UTC by spamdrop
Modified: 2023-11-17 20:40 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Included source code to the callback function, the .ii file (221.48 KB, application/gzip)
2017-09-29 19:28 UTC, spamdrop
Details

Note You need to log in before you can comment on or make changes to this bug.
Description spamdrop 2017-09-29 19:28:18 UTC
Created attachment 42265 [details]
Included source code to the callback function, the .ii file

I am writing a callback function in C++ that will be called from Oracle GoldenGate via the User Exit Function API; hence I don't have the source to the calling program.  The code is linked in as a share lib .so module.

My code (ggpost.cpp) in the attachment is about as simple a shared lib I can create, all it does is create the following lines:

std::string test = "${foobar}";
std::smatch m;
std::regex e ("\\$\\{[a-zA-Z_]+[a-zA-Z0-9_]*}");
bool foo = std::regex_search(test, m, e);
std::cerr << "Foo = " << foo << endl;

When the code is compiled against 7.1.0, and run from Oracle GG, is creates the following :
terminate called after throwing an instance of 'std::bad_cast'
  what():  std::bad_cast
Aborted (core dumped)

However, if I compile the same code in gcc 4.9.2, it works fine.  Also I have attempted to construct my own calling program and I cannot duplicate the problem with either compiler.

I have gathered as much detail as I can, but because it required OGG to duplicate the full problem, I'm handicapped providing all the information requested in the submission form.

CUsrText is my attempt to create a local parent program to duplicate the problem, I include it, but it doesn't show the problem.

Below is the detailed writeup, and an attachment is included with the code I can provide.
-------------------------------------
Compile machine
uname -r
2.6.32-642.15.1.el6.x86_64


gcc --version
gcc (GCC) 7.1.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



configure lines:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.64.  Invocation command line was

  $ ../gcc-7.1.0/configure --prefix=/dvl/odb/tools/gcc-7.1.0/

## --------- ##
## Platform. ##
## --------- ##

hostname = evdla176.delta.com
uname -m = x86_64
uname -r = 2.6.32-642.15.1.el6.x86_64
uname -s = Linux
uname -v = #1 SMP Mon Feb 20 02:26:38 EST 2017



Build of libggpost.so:
make
 g++ -save-temps -fPIC -g -ggdb -Wall -Wextra -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -Wnon-virtual-dtor -ggdb -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64 -DTIXML_USE_STL -D_LINUX_ -fpermissive  -std=c++11   -I/. -I/usr/include/ -I/../../include -I/home/b/bfoddy/odb5/dev/cc/snapshots/a26811_snap_linux.4/vobs/soc/include -c ggpost.cpp -o ggpost.o 
evdla176:/home/b/bfoddy/odb5/dev/cc/snapshots/a26811_snap_linux.4/vobs/soc/ODB/goldengate > g++  -fPIC -save-temps ggpost.o -o libggpost.so -shared

evdla176:/home/b/bfoddy/odb5/dev/cc/snapshots/a26811_snap_linux.4/vobs/soc/ODB/goldengate > ll *.i*
-rw-r--r-- 1 545165 dtdev 1653968 Sep 29 18:04 ggpost.ii


ll libggpost.so
-rwxr-xr-x 1 545165 dtdev 1956286 Sep 29 18:05 libggpost.so

evdla176:/home/b/bfoddy/odb5/dev/cc/snapshots/a26811_snap_linux.4/vobs/soc/ODB/goldengate > ldd libggpost.so
        linux-vdso.so.1 =>  (0x00007ffd4eff0000)
        libstdc++.so.6 => /dvl/odb/tools/gcc-7.1.0/lib64/libstdc++.so.6 (0x00007f4e72248000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f4e71faf000)
        libgcc_s.so.1 => /dvl/odb/tools/gcc-7.1.0/lib64/libgcc_s.so.1 (0x00007f4e71d99000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f4e71a05000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4e7287f000)
 
If I use my CUsrExitText program, no problem.       
./CUsrExitText 
Start , open DL
Open success.
Calling lib
Foo = 1

Now copy libggpost.so to runtime machine where Oracle GG installed.

from runtime machine:
uname -r
2.6.32-431.el6.x86_64


[omsd@evdla078 JMS_Adapter]$ ldd libggpost.so 
        linux-vdso.so.1 =>  (0x00007fff855ff000)
        libstdc++.so.6 => /dvl/oms6/gcc-7.1.0/lib64/libstdc++.so.6 (0x00007fc4dc023000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fc4dbd8e000)
        libgcc_s.so.1 => /dvl/oms6/gcc-7.1.0/lib64/libgcc_s.so.1 (0x00007fc4dbb78000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fc4db7e4000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fc4dc65a000)
        

Now run the Oracle GG Extract program, which is configured to open libggpost.so and call the function CUSEREXIT with EXIT_CALL_START as its first argument.

 ./extract PARAMFILE ./dirprm/foddyue.prm 

***********************************************************************
                       Oracle GoldenGate Capture
 Version 12.2.0.1.160419 OGGCORE_12.2.0.1.0OGGBP_PLATFORMS_160430.1401
    Linux, x64, 64bit (optimized), Generic on Apr 30 2016 17:32:41
 
Copyright (C) 1995, 2016, Oracle and/or its affiliates. All rights reserved.


                    Starting at 2017-09-29 18:23:38
***********************************************************************

Operating System Version:
Linux
Version #1 SMP Sun Nov 10 22:19:54 EST 2013, Release 2.6.32-431.el6.x86_64
Node: evdla078.delta.com
Machine: x86_64
                         soft limit   hard limit
Address Space Size   :    unlimited    unlimited
Heap Size            :    unlimited    unlimited
File Size            :    unlimited    unlimited
CPU Time             :    unlimited    unlimited

Process id: 17780

Description: 

***********************************************************************
**            Running with the following parameters                  **
***********************************************************************

2017-09-29 18:23:38  INFO    OGG-03059  Operating system character set identified as UTF-8.

2017-09-29 18:23:38  INFO    OGG-02695  ANSI SQL parameter syntax is used for parameter parsing.
Extract foddyue
GETENV(LD_LIBRARY_PATH)
LD_LIBRARY_PATH = :/dvl/oms6/OracleGG/JMS_Adapter:/dvl/oms6/OracleGG/JDK/jdk1.8.0_144//jre/lib/amd64/server:/dvl/oms6/gcc-7.1.0/lib64:/opt/mqm/lib64
SourceDefs dirdef/jmsrep.def
CUserExit libggpost.so CUSEREXIT PassThru IncludeUpdateBefores

2017-09-29 18:23:38  INFO    OGG-04523  ./extract running with user exit library libggpost.so,  compatiblity level (4) is not current, using compatiblity level (1).

2017-09-29 18:23:38  INFO    OGG-04526  ./extract running with user exit library libggpost.so. Current session character set is operating system default character set.
GetUpdateBefores
Table ODB_PRIMARY.*;

2017-09-29 18:23:38  INFO    OGG-01851  filecaching started: thread ID: 139767519692544.

2017-09-29 18:23:38  INFO    OGG-01815  Virtual Memory Facilities for: COM
    anon alloc: mmap(MAP_ANON)  anon free: munmap
    file alloc: mmap(MAP_SHARED)  file free: munmap
    target directories:
    /dvl/oms6/OracleGG/JMS_Adapter/dirtmp.

CACHEMGR virtual memory values (may have been adjusted)
CACHEPAGEOUTSIZE (default):               8M
PROCESS VM AVAIL FROM OS (min):         128G
CACHESIZEMAX (strict force to disk):     96G
CACHEVMPAGEOUTMAX:                       64M
terminate called after throwing an instance of 'std::bad_cast'
  what():  std::bad_cast
Aborted (core dumped)

Since a core was created, I'm including the gdb stacktrace.

gdb extract core.17780
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/extract...done.
[New Thread 17780]
[New Thread 17784]
[New Thread 17783]
[New Thread 17781]
[New Thread 17782]
[New Thread 17785]
Missing separate debuginfo for 
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/81/a81be2e44c93640adedb62adc93a47f4a09dd1
Reading symbols from /lib64/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libggparam.so...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libggparam.so
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libgglog.so...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libgglog.so
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libggrepo.so...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libggrepo.so
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libdb-6.1.so...(no debugging symbols found)...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libdb-6.1.so
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libggperf.so...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libggperf.so
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libicui18n.so.48...(no debugging symbols found)...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libicui18n.so.48
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libicuuc.so.48...(no debugging symbols found)...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libicuuc.so.48
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libicudata.so.48...(no debugging symbols found)...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libicudata.so.48
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libxerces-c.so.28...(no debugging symbols found)...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libxerces-c.so.28
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libantlr3c.so...(no debugging symbols found)...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libantlr3c.so
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libggnnzitp.so...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libggnnzitp.so
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /dvl/oms6/gcc-7.1.0/lib64/libstdc++.so.6...done.
Loaded symbols for /dvl/oms6/gcc-7.1.0/lib64/libstdc++.so.6
Reading symbols from /dvl/oms6/gcc-7.1.0/lib64/libgcc_s.so.1...done.
Loaded symbols for /dvl/oms6/gcc-7.1.0/lib64/libgcc_s.so.1
Reading symbols from /dvl/oms6/OracleGG/JMS_Adapter/libggpost.so...done.
Loaded symbols for /dvl/oms6/OracleGG/JMS_Adapter/libggpost.so
Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnss_files.so.2
Core was generated by `./extract PARAMFILE ./dirprm/foddyue.prm'.
Program terminated with signal 6, Aborted.
#0  0x00007f1e2c814625 in raise () from /lib64/libc.so.6
warning: File "/dvl/oms6/gcc-7.1.0/lib64/libstdc++.so.6.0.23-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "/usr/share/gdb/auto-load:/usr/lib/debug:/usr/bin/mono-gdb.py".
To enable execution of this file add
        add-auto-load-safe-path /dvl/oms6/gcc-7.1.0/lib64/libstdc++.so.6.0.23-gdb.py
line to your configuration file "/dvl/oms5/home/omsd/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/dvl/oms5/home/omsd/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.149.el6_6.5.x86_64
(gdb) where
#0  0x00007f1e2c814625 in raise () from /lib64/libc.so.6
#1  0x00007f1e2c815e05 in abort () from /lib64/libc.so.6
#2  0x00007f1e30c81c6d in __gnu_cxx::__verbose_terminate_handler () at ../../.././libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007f1e30c82226 in __cxxabiv1::__terminate (handler=Unhandled dwarf expression opcode 0xf3
) at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:40
#4  0x00007f1e30c82253 in std::terminate () at ../../.././libstdc++-v3/libsupc++/eh_terminate.cc:50
#5  0x00007f1e30c79723 in __cxxabiv1::__cxa_throw (obj=0x2a339d0, tinfo=0x7f1e30eeb170, dest=0x7f1e30c86450 <std::bad_cast::~bad_cast()>)
    at ../../.././libstdc++-v3/libsupc++/eh_throw.cc:86
#6  0x00007f1e30c85c82 in std::__throw_bad_cast () at ../../../.././libstdc++-v3/src/c++11/functexcept.cc:58
#7  0x00007f1e2c5308c7 in std::__cxx11::collate<char> const& std::use_facet<std::__cxx11::collate<char> >(std::locale const&) ()
    at /dvl/odb5/build/gcc-7.1.0.obj/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_classes.tcc:137
#8  0x00007f1e2964c897 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::__cxx11::regex_traits<char>::transform<char*>(char*, char*) const () at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex.h:233
#9  0x00007f1e2964a2b4 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::__cxx11::regex_traits<char>::transform_primary<char const*>(char const*, char const*) const () at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex.h:266
#10 0x00007f1e296458f7 in std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, false, false>::_M_apply(char, std::integral_constant<bool, false>) const::{lambda()#1}::operator()() const () at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:626
#11 0x00007f1e29645a78 in std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, false, false>::_M_apply(char, std::integral_constant<bool, false>) const ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:634
#12 0x00007f1e296411e7 in std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, false, false>::_M_make_cache(std::integral_constant<bool, true>) ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.h:555
#13 0x00007f1e2963d484 in std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, false, false>::_M_ready() ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.h:524
#14 0x00007f1e2963e096 in void std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_insert_bracket_matcher<false, false>(bool) ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:444
#15 0x00007f1e2963aa77 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_bracket_expression() ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:363
#16 0x00007f1e296364a8 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_atom() () at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:349
#17 0x00007f1e29633685 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_term() () at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:139
#18 0x00007f1e296313c9 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative() ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:121
#19 0x00007f1e296313ec in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative() ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:124
#20 0x00007f1e296313ec in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative() ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:124
#21 0x00007f1e2962fb71 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_disjunction() ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:97
#22 0x00007f1e2962ef64 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_Compiler(char const*, char const*, std::locale const&, std::regex_constants::syntax_option_type) () at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.tcc:82
#23 0x00007f1e2962e397 in std::enable_if<std::__detail::__is_contiguous_normal_iter<char const*>::value, std::shared_ptr<std::__detail::_NFA<std::__cxx11::regex_traits<char> > const> >::type std::__detail::__compile_nfa<char const*, std::__cxx11::regex_traits<char> >(char const*, char const*, std::__cxx11::regex_traits<char>::locale_type const&, std::regex_constants::syntax_option_type) () at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex_compiler.h:203
#24 0x00007f1e2962db1d in std::__cxx11::basic_regex<char, std::__cxx11::regex_traits<char> >::basic_regex<char const*>(char const*, char const*, std::locale, std::regex_constants::syntax_option_type) () at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex.h:769
#25 0x00007f1e2962d794 in std::__cxx11::basic_regex<char, std::__cxx11::regex_traits<char> >::basic_regex<char const*>(char const*, char const*, std::regex_constants::syntax_option_type) () at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex.h:512
#26 0x00007f1e2962d474 in std::__cxx11::basic_regex<char, std::__cxx11::regex_traits<char> >::basic_regex(char const*, std::regex_constants::syntax_option_type) ()
    at /dvl/odb/tools/gcc-7.1.0/include/c++/7.1.0/bits/regex.h:445
#27 0x00007f1e2962c647 in CUSEREXIT () at ggpost.cpp:44
#28 0x0000000000591f4a in call_user_exit_routine (call_type=1) at /scratch/aime/adestore/views/aime_adc4150338/oggcore/OpenSys/src/app/er/userexit.c:825
#29 call_user_exit_routine (call_type=1) at /scratch/aime/adestore/views/aime_adc4150338/oggcore/OpenSys/src/app/er/userexit.c:807
#30 0x00000000005f0e43 in extract_main (argc=Unhandled dwarf expression opcode 0xf3
) at /scratch/aime/adestore/views/aime_adc4150338/oggcore/OpenSys/src/app/er/extract/extract.cpp:826
#31 0x000000000074db96 in ggs::gglib::MultiThreading::MainThread::ExecMain (this=0x7fff47e75370)
    at /scratch/aime/adestore/views/aime_adc4150338/oggcore/OpenSys/src/gglib/ggstd/MultiThreading.cpp:1305
#32 0x0000000000751fc7 in ggs::gglib::MultiThreading::Thread::RunThread(struct {...} *) (threadArgs=Unhandled dwarf expression opcode 0xf3
)
    at /scratch/aime/adestore/views/aime_adc4150338/oggcore/OpenSys/src/gglib/ggstd/MultiThreading.cpp:499
---Type <return> to continue, or q <return> to quit---
#33 0x00000000007525dd in ggs::gglib::MultiThreading::MainThread::Run (this=Unhandled dwarf expression opcode 0xf3
)
    at /scratch/aime/adestore/views/aime_adc4150338/oggcore/OpenSys/src/gglib/ggstd/MultiThreading.cpp:1296
#34 0x00000000005f1d4b in main ()


The full core file is available on request.  I've given as much supporting info as I can, hopefully its enough.
Comment 1 Jonathan Wakely 2017-09-29 20:27:30 UTC
It looks like the libstdc++.so.6 that the application links to is older than the version you compiled against, and doesn't have support for the new std::string type used in your callback.

It might work to build your code with the macro _GLIBCXX_USE_CXX11_ABI defined to 0, but what you're trying to do (compile against a new libstdc++ then use an older one at run-time) is not supported and cannot work in general.
Comment 2 Jonathan Wakely 2017-09-29 20:30:29 UTC
Actually the gdb output does show the right libstdc++ is being used:

Reading symbols from /dvl/oms6/gcc-7.1.0/lib64/libstdc++.so.6...done.
Loaded symbols for /dvl/oms6/gcc-7.1.0/lib64/libstdc++.so.6

Try using _GLIBCXX_USE_CXX11_ABI=0 anyway, and see if that helps.
Comment 3 spamdrop 2017-09-30 15:23:36 UTC
Thanks, I'll look into, but due to a deadline I have right now, I need to fallback to 4.9.2 until I get my POC project running.

But thanks for the quick reply.
Comment 4 spamdrop 2017-09-30 15:27:42 UTC
One more comment to add before I forget, If I change the regex string to remove the []'s, while the program doesn't do the correct thing (obviously), it at least doesn't throw the exception.  Not sure if that has any significant meaning.
Comment 5 spamdrop 2017-11-16 22:49:22 UTC
Taking Johnathan's recommendation on Sept 29, I rebuilt the entire app, all libaries etc using -D_GLIBCXX_USE_CXX11_ABI=0

Carefully isolating the libs and LD_LIBRARY_PATH.  Using ABI=0, the program runs fine.  When I repeat the exact same steps without the ABI=0 define, the program throws the std::bad_cast error.
Comment 6 spamdrop 2017-11-17 20:21:07 UTC
I downloaded gcc 7.2.0 and built using the same process.  Without the ABI flag, it too throws the bad_cast exception.

I may download older versions to test.

Question, is there anything more I can provide to help diagnose this problem?  I can get full coredumps and can jump to any level.  The where stack trace is below.

(gdb) where
#0  0x00007f9544086495 in raise () from /lib64/libc.so.6
#1  0x00007f9544087c75 in abort () from /lib64/libc.so.6
#2  0x00007f954a97579d in __gnu_cxx::__verbose_terminate_handler() () from /dvl/odb/apps/dev/dal/ogg_12.3/libicuuc.so.56
#3  0x00007f954a974e66 in __cxxabiv1::__terminate(void (*)()) () from /dvl/odb/apps/dev/dal/ogg_12.3/libicuuc.so.56
#4  0x00007f954a974eb1 in std::terminate() () from /dvl/odb/apps/dev/dal/ogg_12.3/libicuuc.so.56
#5  0x00007f954a974fb8 in __cxa_throw () from /dvl/odb/apps/dev/dal/ogg_12.3/libicuuc.so.56
#6  0x00007f954d6e55f2 in std::__throw_bad_cast() () from /dvl/odb/apps/dev/dal/ogg_12.3/libgglog.so
#7  0x00007f9543b89487 in std::use_facet<std::__cxx11::collate<char> > (__loc=...)
    at /dvl/odb5/build/gcc-7.2/gcc-7.2.0.obj/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_classes.tcc:137
#8  0x00007f95414321bf in std::__cxx11::regex_traits<char>::transform<char*> (this=0x246cb30, __first=0x2e869d0 "", 
    __last=0x2e869d1 "!>D\225\177") at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex.h:233
#9  0x00007f954142fea0 in std::__cxx11::regex_traits<char>::transform_primary<char const*> (this=0x246cb30, 
    __first=0x7fff19050e88 "", __last=0x7fff19050e89 "V\350\002") at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex.h:266
#10 0x00007f954142b7ef in std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, false, false>::_M_apply(char, std::integral_constant<bool, false>) const::{lambda()#1}::operator()() const (__closure=0x7fff19050e80)
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:626
#11 0x00007f954142b970 in std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, false, false>::_M_apply (
    this=0x7fff19050fa0, __ch=0 '\000') at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:634
#12 0x00007f9541427225 in std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, false, false>::_M_make_cache (
    this=0x7fff19050fa0) at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.h:556
#13 0x00007f954142364a in std::__detail::_BracketMatcher<std::__cxx11::regex_traits<char>, false, false>::_M_ready (
    this=0x7fff19050fa0) at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.h:525
#14 0x00007f954142421a in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_insert_bracket_matcher<false, false> (
    this=0x7fff19051560, __neg=false) at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:444
#15 0x00007f9541420d29 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_bracket_expression (
    this=0x7fff19051560) at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:363
#16 0x00007f954141c878 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_atom (this=0x7fff19051560)
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:349
#17 0x00007f9541419a8f in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_term (this=0x7fff19051560)
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:139
#18 0x00007f95414176eb in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7fff19051560)
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:121
#19 0x00007f954141770e in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7fff19051560)
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:124
#20 0x00007f954141770e in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_alternative (this=0x7fff19051560)
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:124
#21 0x00007f9541415c37 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_M_disjunction (this=0x7fff19051560)
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:97
#22 0x00007f9541414dd6 in std::__detail::_Compiler<std::__cxx11::regex_traits<char> >::_Compiler (this=0x7fff19051560, 
    __b=0x7f954143a7fa "\\$\\{[a-zA-Z_]+[a-zA-Z0-9_]*}", __e=0x7f954143a816 "", __loc=..., __flags=(unknown: 16))
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.tcc:82
#23 0x00007f9541413dcd in std::__detail::__compile_nfa<char const*, std::__cxx11::regex_traits<char> > (
    __first=0x7f954143a7fa "\\$\\{[a-zA-Z_]+[a-zA-Z0-9_]*}", __last=0x7f954143a816 "", __loc=..., __flags=(unknown: 16))
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex_compiler.h:203
#24 0x00007f9541412d8d in std::__cxx11::basic_regex<char, std::__cxx11::regex_traits<char> >::basic_regex<char const*> (
    this=0x7fff19051820, __first=0x7f954143a7fa "\\$\\{[a-zA-Z_]+[a-zA-Z0-9_]*}", __last=0x7f954143a816 "", __loc=..., 
    __f=(unknown: 16)) at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex.h:769
#25 0x00007f9541411cc2 in std::__cxx11::basic_regex<char, std::__cxx11::regex_traits<char> >::basic_regex<char const*> (
    this=0x7fff19051820, __first=0x7f954143a7fa "\\$\\{[a-zA-Z_]+[a-zA-Z0-9_]*}", __last=0x7f954143a816 "", __f=(unknown: 16))
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex.h:512
#26 0x00007f9541410b92 in std::__cxx11::basic_regex<char, std::__cxx11::regex_traits<char> >::basic_regex (this=0x7fff19051820, 
    __p=0x7f954143a7fa "\\$\\{[a-zA-Z_]+[a-zA-Z0-9_]*}", __f=(unknown: 16))
    at /dvl/odb/tools/gcc-7.2.0/include/c++/7.2.0/bits/regex.h:445
#27 0x00007f954140db14 in DecomposeEnvVar (input=...) at NWA_Config.cpp:1054
#28 0x00007f954140d31c in Config::Check4IncludeElement (this=0x2e5a170, node=0x2ec2410) at NWA_Config.cpp:912
#29 0x00007f954140d1dd in Config::HandleIncludes (this=0x2e5a170, node=0x2ec2410) at NWA_Config.cpp:874
#30 0x00007f954140d22c in Config::HandleIncludes (this=0x2e5a170, node=0x2e877e0) at NWA_Config.cpp:891
#31 0x00007f954140ab44 in Config::Parse (this=0x2e5a170) at NWA_Config.cpp:393
#32 0x00007f95414080c3 in InstallConfig () at config.cpp:26
#33 0x00007f95414001c8 in CallStart () at ggpost.cpp:168
#34 0x00007f95414004fc in MyUserCPPExit (exit_call_type=1, exit_call_result=0x1e36380 <exit_result>, 
    exit_params=0x1e363c0 <exit_params>) at ggpost.cpp:278
#35 0x00007f95414092fc in CUSEREXIT () from /dvl/odb/apps/dev/dal/ogg_12.3/libggpost.so
#36 0x00000000005b89ba in call_user_exit_routine(short) ()
#37 0x000000000061668a in ?? ()
#38 0x0000000000710111 in ggs::gglib::MultiThreading::MainThread::ExecMain() ()
#39 0x000000000070f82c in ggs::gglib::MultiThreading::Thread::RunThread(ggs::gglib::MultiThreading::Thread::ThreadArgs*) ()
---Type <return> to continue, or q <return> to quit--- 
#40 0x0000000000710085 in ggs::gglib::MultiThreading::MainThread::Run(int, char**) ()
#41 0x00000000006173eb in main ()


ldd of the binary libggpost.so is
[odbd@evdla176 ogg_12.3]$ ldd libggpost.so 
        linux-vdso.so.1 =>  (0x00007ffddc5a0000)
        libProcessStats.so => ./lib/libProcessStats.so (0x00007fd58d6c8000)
        libDB.so => ./lib/libDB.so (0x00007fd58d4a6000)
        libNWAtiny.so => ./lib/libNWAtiny.so (0x00007fd58d291000)
        libmqapi.so => ./lib/libmqapi.so (0x00007fd58d088000)
        libmqic.so => /opt/mqm/lib64/libmqic.so (0x00007fd58cf84000)
        libmqmcs.so => /opt/mqm/lib64/libmqmcs.so (0x00007fd58cb58000)
        libstdc++.so.6 => /dvl/odb/tools/gcc-7.2.0/lib64/libstdc++.so.6 (0x00007fd58c7c1000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fd58c528000)
        libgcc_s.so.1 => /dvl/odb/tools/gcc-7.2.0/lib64/libgcc_s.so.1 (0x00007fd58c312000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fd58bf7e000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd58bd60000)
        libmqe.so => /opt/mqm/lib64/libmqe.so (0x00007fd58b52c000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fd58b327000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fd58dc30000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fd58b11f000)
Comment 7 Alibek Omarov 2023-10-27 04:13:20 UTC
Can confirm, it still happens with GCC/libstdc++ 13.0. However, in my case, it's in static initializer.
Comment 8 Jonathan Wakely 2023-10-27 06:41:13 UTC
We still don't have a complete description of the problem though.
Comment 9 Jonathan Wakely 2023-10-27 06:46:19 UTC
If this only happens when the shared library is loaded from a closed source application, you really need to talk to Oracle.
Comment 10 Jonathan Wakely 2023-10-27 06:53:54 UTC
My best guess for what's happening in the original report is that the shared library is being loaded into a running process which uses an older version of libstdc++, and so the locale facets needed by the shared library were never created at startup. When std::regex tried to use those facets, it fails to find it.

But without a way to reproduce the problem, this will never get resolved.
Comment 11 Alibek Omarov 2023-10-27 08:32:24 UTC
I reproduced it with the game engine loading game mod, on Ubuntu Linux system.
Both the engine and the mod are open source, but I'm trying to craft a smaller example.
Comment 12 Jonathan Wakely 2023-10-27 11:32:44 UTC
Is the engine a C++ application, or C, or something else?