Opened 9 years ago

Last modified 9 years ago

#3430 new Bugs

Build boost.regex shared-link 1.40 under mingw 3.4

Reported by: Oleg Tsarev <zabivator@…> Owned by: Vladimir Prus
Milestone: Boost 1.41.0 Component: build
Version: Boost 1.40.0 Severity: Problem
Keywords: bjam Cc:

Description

I try build boost.regex under mingw 3.4 (include in Qt SDK) I add mingw to PATH enviroment variable, than run: bootstrap.bat bjam.exe --build_type=complete --toolset=gcc --with-regex --with-program_options variant=release link=shared runtime-link=shared stage

bjam build static lib version of boost.regex. It i use msvc2008 console tool, and use toolset "msvc-9.0" shared version build correct.

It's like on bug. Thank you!

Attachments (3)

build.boost.log (26.4 KB) - added by zabivator@… 9 years ago.
regex_failed.zip (122.1 KB) - added by crisb 9 years ago.
output of bjam toolset=gcc link=shared on mingw gcc 4.4.0 (win7)
regex_stack.txt (3.3 KB) - added by crisb 9 years ago.
stack trace from running regex_regress

Download all attachments as: .zip

Change History (22)

comment:1 Changed 9 years ago by Oleg Tsarev <zabivator@…>

"It i use msvc2008 console tool, and use toolset "msvc-9.0" shared version build correct. " Of course, "when i use"

comment:2 Changed 9 years ago by John Maddock

Component: regexbuild
Owner: changed from John Maddock to Vladimir Prus

As this is a Boost.Build issue, I'm reassinging.

comment:3 Changed 9 years ago by Vladimir Prus

Could you please add the --debug-building option to bjam command line and report the output? You don't need to clean anything, just run this command. Please attach the output, as it will be too long for comment.

Changed 9 years ago by zabivator@…

Attachment: build.boost.log added

comment:4 Changed 9 years ago by zabivator@…

I run bjam.exe --build_type=complete --toolset=gcc --with-regex variant=release link=shared --debug-building runtime-link=shared stage As result i found libboost..... (static version) build log in attach

comment:5 Changed 9 years ago by Vladimir Prus

John, I see <toolset>gcc-mingw:<link>static in requirements for boost-regex. Is this still necessary or I can remove it (as well as similar requirement for cygwin)?

comment:6 Changed 9 years ago by John Maddock

I believe static linking is a necessary requirement yes. Last time I checked the shared libraries segfaulted on that platform, there seems to be an issue with gcc here :-(

John.

comment:7 Changed 9 years ago by Vladimir Prus

Then, there's no bug here?

comment:8 Changed 9 years ago by anonymous

I edit libs/regex/build/Jamfile.v2 and built shared version of boost.regex. How can i test it? Boost have regeression test, than boost have tools for run all tests. How?

comment:9 Changed 9 years ago by anonymous

*than boost have tools Of course "then boost have tools"

comment:10 Changed 9 years ago by Vladimir Prus

Running "bjam link=shared" in libs/regex/test directory should be enough. Let me know what results you get.

comment:11 Changed 9 years ago by Vladimir Prus

Oleg, did you manage to run the tests, and if so, what are the results.

Unless it's definitely established that shared build of boost.regex indeed works, I plan to close this issue as not an issue.

Thanks, Volodya

Changed 9 years ago by crisb

Attachment: regex_failed.zip added

output of bjam toolset=gcc link=shared on mingw gcc 4.4.0 (win7)

comment:12 Changed 9 years ago by crisb

output from

bjam toolset=gcc link=shared

with boost 1.40.0, having first enabled shared build on mingw (using mingw gcc 4.4.0).

output attached.

comment:13 Changed 9 years ago by Vladimir Prus

John, could you check if the errors in the attached log look like the errors you were working around by forcing link=static?

Thanks, Volodya

comment:14 Changed 9 years ago by anonymous

No these are something new I believe - it looks like the Mingw guys have fixed a few issues, but that throwing exceptions across dll-boundaries is still a no-go. Unless there's some magic build option we're missing?

John.

comment:15 Changed 9 years ago by crisb

is this really about throwing exceptions across boundaries? some of these tests arent meant to throw any exceptions at all, yet throw a bad_cast exception. is this not now some other problem?

by the looks of it g++ 4.4.0 should work with throwing exceptions across dll boundaries. it automatically uses -shared=libgcc when running g++ in order to support this.

Changed 9 years ago by crisb

Attachment: regex_stack.txt added

stack trace from running regex_regress

comment:16 Changed 9 years ago by John Maddock

Thanks for the stack trace, however, now I'm more confused than ever :-(

Note that:

  • We don't have this issue with gcc on any other platform.
  • The issue goes away as soon as you static link.
  • The exception being thrown is a result of a std::out_of_range trying to be thrown and failing... looks like the std lib is holed somewhere.

Which all screams gcc-bug I'm afraid.

I've also spent several hours now trying and failing to get a working up-to-date mingw install on my Vista machine, and have now given up... sorry but unless someone can actually tell me what the problem is, I'm inclined to shrug and move on at this point. Anyone know if the manual install instructions here - http://www.mingw.org/wiki/Getting_Started - are supposed to work on Vista?

The only thing I can think of to try, is defining BOOST_REGEX_NO_EXTERNAL_TEMPLATES in boost/regex/user.hpp and rebuild *everything* and see if that helps.

John.

comment:17 Changed 9 years ago by crisb

BOOST_REGEX_NO_EXTERNAL_TEMPLATES did indeed help! All tests passed. Thanks! What does this mean then? ;)

about your other problem - I managed to install on Win7 with no troubles whatsoever following those instructions.

comment:18 Changed 9 years ago by John Maddock

BOOST_REGEX_NO_EXTERNAL_TEMPLATES did indeed help! All tests passed. 
Thanks! What does this mean then? ;)

It means it might work, or it might not!

Normally the regex library instantiates the most commonly used templates in the library - as this speeds up compilation times no end - as well as reducing binary sizes. Defining BOOST_REGEX_NO_EXTERNAL_TEMPLATES disables this, so the same templates end up getting instantiated in both the dll and the application. Frankly if this doesn't work though, then I do wonder whether there isn't some hidden bug in gcc relating to sharing template instances across dll-boundaries :-(

I will try and investigate some more though.

about your other problem - I managed to install on Win7 
with no troubles whatsoever following those instructions.

Sigh... for me not only does gcc crash and burn when I try and compile a hello-world app... it actually managed to bring down my whole machine :-(

Cheers, John.

comment:19 Changed 9 years ago by John Maddock

Volodya,

Is there any way we can enable shared lib builds only for mingw-gcc >= 4.4 ?

Thanks, John.

Note: See TracTickets for help on using tickets.