This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Parallel extensions and Boost


Hi, Marc,

You were absolutely right, isolating the code using Boost into a
separate file, compiling it without the parallel mode, and then
linking in the result fixed the problem. What threw me off with the
error message is that there were no vectors involved in my code, and
definitely none passed to Boost, only strings. I guess it's Boost's
internals that were using them anyway. Your fix works perfectly
though.

Thanks for your help.
Dmitriy

P.S. Congratulations on the new appointment!

On Mon, Jul 20, 2009 at 10:40 PM, Marc Glisse<marc.glisse@normalesup.org> wrote:
> Hello,
>
> On Mon, 20 Jul 2009, Dmitriy Morozov wrote:
>
>> I am trying to compile a program that uses Boost libraries with GCC's
>> parallel extensions, but I get linking errors. In particular, if I
>> compile without the flags "-fopenmp -D_GLIBCXX_PARALLEL", then
>> everything works fine. However, if I add those two flags, I get the
>> error below. Actually, to be specific the error appears when I add
>> -D_GLIBCXX_PARALLEL, -fopenmp by itself does not cause problems. I
>> suspect the problem comes from the fact that Boost was compiled
>> without -D_GLIBCXX_PARALLEL.
>
> Indeed, as documented here:
> http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch31s03.html
> "therefore one can only link code compiled with parallel mode and code
> compiled without parallel mode if no instantiation of a container is passed
> between the two translation units."
> and the error message shows a vector.
>
>> I was wondering if there was a way to
>> work around this problem, since in this example I don't need the
>> parallel extensions in the part of the code that uses Boost (in this
>> case just for command line parsing).
>
> You could separate the code that does the option parsing and the rest in 2
> separate files, one compiled with the parallel flag and one without it, such
> that no container is shared by the 2 parts. Or you could explicitly use
> parallel containers/algorithms where you want them so you don't need the
> global flag.
>
> You could likely get away with a simple renaming of symbols, but it is
> unsupported.
>
> --
> Marc Glisse
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]