Re: Error Compiling on macOS
Rolf Gebhardt <[email protected]> Wed, 24 Apr 2024 17:50:22 +0200
| Newsgroups | gmane.comp.sysutils.backup.dar.support |
|---|---|
| Message-ID | <[email protected]> |
Hi James, hi Denis,
because I have some macs under my desk, i tried to reproduce the error.
(Usually I don't compile Dar on MacOS and use the homebrew version instead.)
On my new mac mini (MacOS Sonoma) the error does not occur.
So I booted Mojave on my old Mac Pro (normally I run Ubuntu on it) and
got the error reported by you.
It seems to have to do with one member of cat_entree:
smart_pointer<pile_descriptor> pdesc;
The class template "smart_pointer" itself has a non default move
assignment operator that is not declared "noexcept". If you edit
smart_pointer.hpp and add the "noexcept"-specification to it, dar
compiles fine on my machine.
/// move assignment operator
smart_pointer & operator = (smart_pointer && ref) noexcept
{
Perhaps this helps.
Don't know, whether stating the error is a compiler bug or just a
behaviour allowed by the language specification. I am not very familiar
with exception specifications, neither with the old and deprecated
"throws", nor with the newer "noexcept".
Regards,
Rolf
Am 24.04.24 um 15:54 schrieb Denis Corbin:
> On 24/04/2024 04:45, James Pedersen wrote:
>> Hi,
>
> Hi James,
>
>>
>> When I try to compile dar 2.7.14 on MacOS Mojave, I get the following
>> error:
>>
>> /In file included from archive.cpp:31/
>> /In file included from ./i_archive.hpp:46:/
>> /In file included from ./catalogue.hpp:46:/
>> /./cat_entree.hpp:104:15: error: exception specification of
>> explicitly defaulted move assignment operator does not match the
>> calculated one/
>> / cat_entree & operator = (cat_entree && ref) noexcept = default;/
>> /
>> /
>> /In file included from archive.cpp:31:/
>> /In file included from ./i_archive.hpp:46:/
>> /In file included from ./catalogue.hpp:47:
>> /
>> /./cat_nomme.hpp:52:14: error: exception specification of explicitly
>> defaulted move assignment operator does not match the calculated one/
>> / cat_nomme & operator = (cat_nomme && ref) noexcept = default;/
>> /
>> /
>> /2 errors generated./
>> /make[3]: *** [archive.lo] Error 1/
>> /make[2]: *** [all-recursive] Error 1/
>> /make[1]: *** [all-recursive] Error 1/
>> /Make: *** [all] Error 2
>> /
>> /
>> /
>> How can I fix this error?
>
> cat_entree and car_nomme classes have not changed since several
> releases, it seems related to the compiler you are using (probably
> clang?).
>
> There has been changed in the past on whether a default copy and move
> assignment operator could have "noexcept" flag or not. g++ and clang
> are not always in sync on that, some years ago the noexcept flag
> needed to be removed:
>
> https://stackoverflow.com/questions/41620922/default-noexcept-move-semantics
>
>
> now it seems clang wants it to be added...
>
> I will figure out what the new status of things for next release.
>
> I'll probably have to enhance the configure script to check the
> behavior of the compiler used in regard of that type of hysterical
> complain... and have the code adapting on it.
>
> In the meanwhile several path can be followed:
> - using gcc instead of clang
> - finding a flag in clang to disable this error (not sure it exists
> see below)
> - edit libdar code adding (or rather removing) the "noexcept" keyworld
> in libdar code where clang is coughing... cat_entree.hpp line 104,
> cat_nomme.hpp line 52 and so on.
>
> how to play with compiler flags (second point above):
>
> export CXXFLAGS=-std=c++14
> ./configure ....
> make ...
>
> replace/add to -std=c++14 other flag if you find some more pertinent
> or interesting
>
>
>>
>> Thank you,
>> James Pedersen
>>
>>
>
> Sorry to not provide a better solution for today
>
> Regards,
> Denis
>