[petsc-users] C++11 related issue
Matthew Knepley
knepley at gmail.com
Fri Aug 25 07:25:58 CDT 2023
On Fri, Aug 25, 2023 at 7:05 AM maitri ksh <maitri.ksh at gmail.com> wrote:
> Thanks Matt for the clarification, I used gcc11.2 instead and the
> petsc-configuration worked out fine. But now, I am facing an issue while
> doing the 'make check' of the libraries. The error points to some
> unbalanced or mismatch of double-quote (")
>
> /usr/bin/bash: -c: line 6: unexpected EOF while looking for matching `"'
> /usr/bin/bash: -c: line 7: syntax error: unexpected end of file
>
> The error seems to be related to a shell script, I am unable to debug the
> error, I looked for instances where 'bash -c' is being used, I couldn't
> locate any. How should I proceed?
>
You can do the check by hand:
cd $PETSC_DIR
cd src/snes/tutorials
make ex5
./.ex5 -snes_monitor
Thanks,
Matt
> On Thu, Aug 24, 2023 at 1:37 PM Matthew Knepley <knepley at gmail.com> wrote:
>
>> On Thu, Aug 24, 2023 at 6:10 AM maitri ksh <maitri.ksh at gmail.com> wrote:
>>
>>> I was facing a problem while compiling a code (which earlier, got
>>> compiled successfully using the same petsc set up), the problem was related
>>> to compilers. I decided to reconfigure petsc but ran into errors which are
>>> related to non-compliance of the compiler with 'C++11'. I had faced this
>>> issue earlier when I was installing Petsc and I had it resolved by using a
>>> newer version of compiler (openmpi-4.1.5).
>>>
>>
>> OpenMPI is not a compiler. It is an implementation of MPI that produces
>> compiler wrappers. Your actual compiler appears to be GCC 4.8.2:
>>
>> Output from compiling with -std=c++11
>> In file included from /usr/include/c++/4.8.2/algorithm:62:0,
>> from
>> /tmp/petsc-hl_0r720/config.setCompilers/conftest.cc:9:
>> /usr/include/c++/4.8.2/bits/stl_algo.h: In instantiation of
>> ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator,
>> _RandomAccessIterator, const _Tp&, _Compare) [with _RandomAccessIterator =
>> __gnu_cxx::__normal_iterator<std::unique_ptr<double>*,
>> std::vector<std::unique_ptr<double> > >; _Tp = std::unique_ptr<double>;
>> _Compare = main()::__lambda0]’:
>> /usr/include/c++/4.8.2/bits/stl_algo.h:2296:78: required from
>> ‘_RandomAccessIterator
>> std::__unguarded_partition_pivot(_RandomAccessIterator,
>> _RandomAccessIterator, _Compare) [with _RandomAccessIterator =
>> __gnu_cxx::__normal_iterator<std::unique_ptr<double>*,
>> std::vector<std::unique_ptr<double> > >; _Compare = main()::__lambda0]’
>> /usr/include/c++/4.8.2/bits/stl_algo.h:2337:62: required from ‘void
>> std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size,
>> _Compare) [with _RandomAccessIterator =
>> __gnu_cxx::__normal_iterator<std::unique_ptr<double>*,
>> std::vector<std::unique_ptr<double> > >; _Size = long int; _Compare =
>> main()::__lambda0]’
>> /usr/include/c++/4.8.2/bits/stl_algo.h:5499:44: required from ‘void
>> std::sort(_RAIter, _RAIter, _Compare) [with _RAIter =
>> __gnu_cxx::__normal_iterator<std::unique_ptr<double>*,
>> std::vector<std::unique_ptr<double> > >; _Compare = main()::__lambda0]’
>> /tmp/petsc-hl_0r720/config.setCompilers/conftest.cc:58:119: required
>> from here
>> /usr/include/c++/4.8.2/bits/stl_algo.h:2263:35: error: no match for call
>> to ‘(main()::__lambda0) (std::unique_ptr<double>&, const
>> std::unique_ptr<double>&)’
>> while (__comp(*__first, __pivot))
>> ^
>> /tmp/petsc-hl_0r720/config.setCompilers/conftest.cc:58:42: note:
>> candidates are:
>> std::sort(vector.begin(), vector.end(), [](std::unique_ptr<double> &a,
>> std::unique_ptr<double> &b) { return *a < *b; });
>> ^
>> In file included from /usr/include/c++/4.8.2/algorithm:62:0,
>> from
>> /tmp/petsc-hl_0r720/config.setCompilers/conftest.cc:9:
>> /usr/include/c++/4.8.2/bits/stl_algo.h:2263:35: note: bool
>> (*)(std::unique_ptr<double>&, std::unique_ptr<double>&) <conversion>
>> while (__comp(*__first, __pivot))
>>
>> This compiler was released almost 10 years ago and has incomplete support
>> for C++11.
>>
>>
>>> Now, I am trying to use the same compiler (openmpi-4.1.5) to reconfigure
>>> petsc but the old issue (related to 'C++11') pops up. I used a code that
>>> was available online
>>> <https://stackoverflow.com/questions/5047971/how-do-i-check-for-c11-support>
>>> to check if the present compiler supports C++11, and it shows it does
>>> support.
>>>
>>
>> You may not have read to the bottom of the answer, but it tells you how
>> to check for complete support for C++11 and this compiler definitely does
>> not have it.
>>
>> Thanks,
>>
>> Matt
>>
>>
>>> I have attached the '*configure.log*' herewith for your reference.
>>> Can anyone suggest how to resolve/work-around this issue?
>>>
>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230825/2d998100/attachment-0001.html>
More information about the petsc-users
mailing list