[regex] Segmentation fault on regex_search only on CentOS

I have compiled the same C++ source on two machines: 1 - Ubuntu 11.04, 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:07:17 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux 2 - CentOS release 5.3, 2.6.18-128.1.14.el5 #1 SMP Wed Jun 17 06:40:54 EDT 2009 i686 i686 i386 GNU/Linux On Ubuntu I have g++-4.5.2, on CentOs g++-4.4.4 and on both I have boost-1.42.0. My source compiles perfectly on both machines, but on the CentOS one I get a Segmentetion Fault during the execution. Using some prints, I found out where it happens: ... boost::regex grepGPP("Monthly Ecosystem GPP", boost::regex::egrep); cerr << "DEBUG BEFORE!" << endl; boost::regex_search (currGPP, grepGPP) cerr << "DEBUG AFTER!" << endl; ... The segmentation fault comes during the execution of regex_search, beacause "DEBUG AFTER" is not printed. Any ideas on how to solve this problem? Thanks in advance. -- Alessandro Candini MEEO S.r.l. Via Saragat 9 I-44122 Ferrara, Italy Tel: +39 0532 1861501 Fax: +39 0532 1861637 http://www.meeo.it ======================================== "ATTENZIONE:le informazioni contenute in questo messaggio sono da considerarsi confidenziali ed il loro utilizzo è riservato unicamente al destinatario sopra indicato. Chi dovesse ricevere questo messaggio per errore è tenuto ad informare il mittente ed a rimuoverlo definitivamente da ogni supporto elettronico o cartaceo." "WARNING:This message contains confidential and/or proprietary information which may be subject to privilege or immunity and which is intended for use of its addressee only. Should you receive this message in error, you are kindly requested to inform the sender and to definitively remove it from any paper or electronic format."

It's worth checking in case you are throwing exceptions accross shared library boundaries. I had a similar problem with GCC. Everything worked fine under gcc 4.5.2 (ubuntu) but not under the version of gcc that is default in CentoOS. I discovered that it was an exception being thrown in a shared library ( and defined in the shared llibrary) that I was trying to catch in my executable. I reolved it by moving all my exception definitions into a seperate shared library and linking it to all my other units including the main executable. So to clarify, if all your execeptions are defined & implemented in a header file that you are including seperately in your shared library and your executable, but you are throwing and catching acrross the boundary you may see this problem. You need to compile the exception implementations into a shared library of their own and link it in to whereever you may thorw or catch them. Regards N Internet boost.regex@virgin.net Sent by: boost-users-bounces@lists.boost.org 07/13/2011 12:23 PM Please respond to boost-users@lists.boost.org To boost-users@lists.boost.org cc Subject Re: [Boost-users] [regex] Segmentation fault on regex_search only onCentOS
Any ideas on how to solve this problem?
Can you run under GDB and see where the fault occurs? John. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users ___________________________________________________________ This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited. Please refer to http://www.bnpparibas.co.uk/en/information/legal_information.asp?Code=ECAS-8... for additional disclosures.
participants (3)
-
Alessandro Candini
-
John Maddock
-
narinder.claire@uk.bnpparibas.com