A problem with using boost::regex
I have been a boost users for years, but this is the first time I've come across a problem with using it. I'm posting this in the hopes that one of you will say "oh yeah you did 'X' wrong", because I have been beating my head against the wall with this for some time. Thanks for taking a look. -- Michael Lindner I have the following program: #include "boost/regex.hpp" #include <string> int main(int argc, char** argv) { std::string re("[123]abc"); boost::regex reg(re); return 0; } It compiles and runs just fine on my Mac and Linux machines. On Windows, however, it compiles fine, and runs fine compiled under the "Debug" configuration. When I change that to "Release" however, it crashes with the following stack trace: msvcr90.dll!7858cc9d() msvcr90.dll!7858ccb5() dme.exe!boost::re_detail::w32_ transform() + 0xd5 bytes C++ dme.exe!boost::re_detail::w32_regex_traits_implementation<char>::transform() + 0x21 bytes C++ dme.exe!boost::re_detail::find_sort_syntax<boost::re_detail::w32_regex_traits_implementation<char>,char>() + 0x64 bytes C++ dme.exe!boost::re_detail::w32_regex_traits_implementation<char>::w32_regex_traits_implementation<char>() + 0x399 bytes C++ dme.exe!boost::object_cache<unsigned int,boost::re_detail::w32_regex_traits_implementation<char> >::do_get() + 0x28f bytes C++ dme.exe!boost::object_cache<unsigned int,boost::re_detail::w32_regex_traits_implementation<char> >::get() + 0x69 bytes C++ dme.exe!boost::re_detail::create_w32_regex_traits<char>() + 0x1b bytes C++ dme.exe!boost::re_detail::regex_data<char,boost::regex_traits<char,boost::w32_regex_traits<char>
::regex_data<char,boost::regex_traits<char,boost::w32_regex_traits<char> () + 0x5d bytes C++
dme.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char>
::do_assign() + 0x5f bytes C++
dme.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char>
::assign(const char * p1=0x0012ff4c, const char * p2=0x0012ff54, unsigned int f=0) Line 380 C++
dme.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char>
::assign<std::char_traits<char>,std::allocator<char> >(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & s="[123]abc", unsigned int f=0) Line 418 C++
::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char> <std::char_traits<char>,std::allocator<char> >(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
dme.exe!boost::basic_regex<char,boost::regex_traits<char,boost::w32_regex_traits<char> p="[123]abc", unsigned int f=0) Line 393 C++ dme.exe!main(int argc=1, char * * argv=0x00345628) Line 9 C++ I am using boost 1.46.0 Microsoft Visual Studio 2008 Version 9.0.30729.1 SP Microsoft .NET Framework Version 3.5 SP1
AMDG On 04/19/2011 01:32 PM, Michael Lindner wrote:
I have been a boost users for years, but this is the first time I've come across a problem with using it. I'm posting this in the hopes that one of you will say "oh yeah you did 'X' wrong", because I have been beating my head against the wall with this for some time. Thanks for taking a look.
-- Michael Lindner
I have the following program:
#include "boost/regex.hpp" #include <string>
int main(int argc, char** argv) { std::string re("[123]abc"); boost::regex reg(re); return 0; }
It compiles and runs just fine on my Mac and Linux machines. On Windows, however, it compiles fine, and runs fine compiled under the "Debug" configuration. When I change that to "Release" however, it crashes with the following stack trace:
I would guess that there's a mismatch between the options used to compile the library and the options used to compile Boost. I assume you compiled Boost without any special options? Can you provide the compiler command line? In Christ, Steven Watanabe
Thanks for your quick reply. I would guess that too, except I would have expected a link time error or at least for the Debug version to fail as well. Anyway, the compile options for my little program are /GL /I "..\boost_1_46_0" /AI "C:\src\boost_1_46_0\stage\lib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /EHsc /MD /Fo"Release\\" /Fd"Release\vc90.pdb" /W3 /nologo /c /Wp64 /Zi /TP /errorReport:prompt and link options are /OUT:"Release\dme.exe" /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTFILE:"Release\dme.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"c:\src\dme\Release\dme.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib I compiled boost with boost-jam, and I'm not sure how to find out what the compile options are for that. If you can show me where to find that (or where to find where to find that). Also a caveat, although I am a long time C++ programmer I am a relative newbie on Windows. Peace, Michael Lindner On Tue, Apr 19, 2011 at 5:01 PM, Steven Watanabe <watanabesj@gmail.com>wrote:
AMDG
I have been a boost users for years, but this is the first time I've come across a problem with using it. I'm posting this in the hopes that one of you will say "oh yeah you did 'X' wrong", because I have been beating my head against the wall with this for some time. Thanks for taking a look.
-- Michael Lindner
I have the following program:
#include "boost/regex.hpp" #include <string>
int main(int argc, char** argv) { std::string re("[123]abc"); boost::regex reg(re); return 0; }
It compiles and runs just fine on my Mac and Linux machines. On Windows, however, it compiles fine, and runs fine compiled under the "Debug" configuration. When I change that to "Release" however, it crashes with
On 04/19/2011 01:32 PM, Michael Lindner wrote: the
following stack trace:
I would guess that there's a mismatch between the options used to compile the library and the options used to compile Boost. I assume you compiled Boost without any special options? Can you provide the compiler command line?
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I have been a boost users for years, but this is the first time I've come across a problem with using it. I'm posting this in the hopes that one of you will say "oh yeah you did 'X' wrong", because I have been beating my head against the wall with this for some time. Thanks for taking a look.
-- Michael Lindner
I have the following program:
#include "boost/regex.hpp" #include <string>
int main(int argc, char** argv) { std::string re("[123]abc"); boost::regex reg(re); return 0; }
It compiles and runs just fine on my Mac and Linux machines. On Windows, however, it compiles fine, and runs fine compiled under the "Debug" configuration. When I change that to "Release" however, it crashes with the following stack trace:
I don't know what to say except it "works for me". Sounds like a typical binary compatibility issue though. Two things you could try: 1) cd into libs/regex/test and do a "bjam regex_regress release" and check the test passes OK. 2) Create a static lib project in your IDE, add libs/regex/src/*.cpp to it and set the build options the same as your .exe. Then set the define BOOST_REGEX_NO_LIB in your .exe's project settings and add the static lib as a reference and rebuild. HTH, John.
Thank you John and Steven for your help. Making a library compiled with the same settings worked, so it appears to have been a compiler option mismatch. I'll spend more time worrying about which option when I finish this project and have more time. Peace, Mike On Wed, Apr 20, 2011 at 5:10 AM, John Maddock <boost.regex@virgin.net>wrote:
I have been a boost users for years, but this is the first time I've come
across a problem with using it. I'm posting this in the hopes that one of you will say "oh yeah you did 'X' wrong", because I have been beating my head against the wall with this for some time. Thanks for taking a look.
-- Michael Lindner
I have the following program:
#include "boost/regex.hpp" #include <string>
int main(int argc, char** argv) { std::string re("[123]abc"); boost::regex reg(re); return 0; }
It compiles and runs just fine on my Mac and Linux machines. On Windows, however, it compiles fine, and runs fine compiled under the "Debug" configuration. When I change that to "Release" however, it crashes with the following stack trace:
I don't know what to say except it "works for me". Sounds like a typical binary compatibility issue though. Two things you could try:
1) cd into libs/regex/test and do a "bjam regex_regress release" and check the test passes OK. 2) Create a static lib project in your IDE, add libs/regex/src/*.cpp to it and set the build options the same as your .exe. Then set the define BOOST_REGEX_NO_LIB in your .exe's project settings and add the static lib as a reference and rebuild.
HTH, John. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I have been a boost users for years, but this is the first time I've come across a problem with using it. I'm posting this in the hopes that one of you will say "oh yeah you did 'X' wrong", because I have been beating my head against the wall with this for some time. Thanks for taking a look.
One other wildcard suggestion: there were a bunch of large updates to Visual Studio on Windows Update recently, if you installed those, it might be wise to rebuild the Boost libraries.... just in case you know ;-) John.
participants (3)
-
John Maddock
-
Michael Lindner
-
Steven Watanabe