Bug 263176 - devel/heimdall: fix build with libc++ 14
Summary: devel/heimdall: fix build with libc++ 14
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Emanuel Haupt
URL:
Keywords:
Depends on:
Blocks: 261742
  Show dependency treegraph
 
Reported: 2022-04-09 11:26 UTC by Dimitry Andric
Modified: 2022-04-26 19:15 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (ehaupt)


Attachments
devel/heimdall: stop attempting to define nullptr (714 bytes, patch)
2022-04-09 11:28 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2022-04-09 11:26:59 UTC
During an exp-run for llvm 14 (see bug 261742), it turned out that devel/heimdall fails to build with libc++ 14:

In file included from /wrkdirs/usr/ports/devel/heimdall/work/Heimdall-1.4.2/heimdall/source/HelpAction.cpp:24:
In file included from /wrkdirs/usr/ports/devel/heimdall/work/Heimdall-1.4.2/heimdall/source/Interface.h:25:
In file included from /usr/include/c++/v1/map:535:
In file included from /usr/include/c++/v1/__node_handle:63:
In file included from /usr/include/c++/v1/memory:819:
In file included from /usr/include/c++/v1/__memory/ranges_uninitialized_algorithms.h:22:
In file included from /usr/include/c++/v1/__memory/uninitialized_algorithms.h:17:
In file included from /usr/include/c++/v1/iterator:591:
In file included from /usr/include/c++/v1/__iterator/common_iterator.h:22:
In file included from /usr/include/c++/v1/variant:204:
/usr/include/c++/v1/__functional/hash.h:174:12: error: no matching constructor for initialization of 'pair<unsigned long, unsigned long>'
    return pair<_Size, _Size>(__a + __z, __b + __c);
           ^                  ~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__functional/hash.h:182:12: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::__weak_hash_len_32_with_seeds' requested here
    return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),
           ^
/usr/include/c++/v1/__functional/hash.h:241:28: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::__weak_hash_len_32_with_seeds' requested here
  pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
                           ^
/usr/include/c++/v1/__functional/hash.h:344:16: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::operator()' requested here
        return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
               ^
/usr/include/c++/v1/__functional/hash.h:418:20: note: in instantiation of member function 'std::__scalar_hash<std::_PairT, 2>::operator()' requested here
    return _HashT()(__p);
                   ^
/usr/include/c++/v1/__utility/pair.h:157:14: note: candidate template ignored: requirement '_CheckArgsDep<true>::__enable_explicit()' was not satisfied [with _Dummy = true]
    explicit pair(_T1 const& __t1, _T2 const& __t2)
             ^
[... much more of this ...]

This is because Heimdall.h defines nullptr as a macro with value 0, which isn't compatible with C++11 or later.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-04-09 11:28:57 UTC
Created attachment 233093 [details]
devel/heimdall: stop attempting to define nullptr

A similar patch for libpit.h is already in devel/heimdall/files. I just took the same approach of deleting the whole block that attempts to redefine nullptr.

(It seems upstream isn't showing much signs of being alive, so I haven't tried making this into a patch that could be submitted upstream.)
Comment 2 Emanuel Haupt freebsd_committer freebsd_triage 2022-04-09 13:17:45 UTC
LGTM, thank you. Please commit.
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-04-26 19:13:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=97936b3d67af0be32750eb83edc3170bd01f9755

commit 97936b3d67af0be32750eb83edc3170bd01f9755
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-04-09 11:24:31 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-04-26 19:11:50 +0000

    devel/heimdall: stop attempting to define nullptr

    During an exp-run for llvm 14 (see bug 261742), it turned out that
    devel/heimdall fails to build with libc++ 14:

    In file included from /wrkdirs/usr/ports/devel/heimdall/work/Heimdall-1.4.2/heimdall/source/HelpAction.cpp:24:
    In file included from /wrkdirs/usr/ports/devel/heimdall/work/Heimdall-1.4.2/heimdall/source/Interface.h:25:
    In file included from /usr/include/c++/v1/map:535:
    In file included from /usr/include/c++/v1/__node_handle:63:
    In file included from /usr/include/c++/v1/memory:819:
    In file included from /usr/include/c++/v1/__memory/ranges_uninitialized_algorithms.h:22:
    In file included from /usr/include/c++/v1/__memory/uninitialized_algorithms.h:17:
    In file included from /usr/include/c++/v1/iterator:591:
    In file included from /usr/include/c++/v1/__iterator/common_iterator.h:22:
    In file included from /usr/include/c++/v1/variant:204:
    /usr/include/c++/v1/__functional/hash.h:174:12: error: no matching constructor for initialization of 'pair<unsigned long, unsigned long>'
        return pair<_Size, _Size>(__a + __z, __b + __c);
               ^                  ~~~~~~~~~~~~~~~~~~~~
    /usr/include/c++/v1/__functional/hash.h:182:12: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::__weak_hash_len_32_with_seeds' requested here
        return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),
               ^
    /usr/include/c++/v1/__functional/hash.h:241:28: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::__weak_hash_len_32_with_seeds' requested here
      pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
                               ^
    /usr/include/c++/v1/__functional/hash.h:344:16: note: in instantiation of member function 'std::__murmur2_or_cityhash<unsigned long, 64>::operator()' requested here
            return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
                   ^
    /usr/include/c++/v1/__functional/hash.h:418:20: note: in instantiation of member function 'std::__scalar_hash<std::_PairT, 2>::operator()' requested here
        return _HashT()(__p);
                       ^
    /usr/include/c++/v1/__utility/pair.h:157:14: note: candidate template ignored: requirement '_CheckArgsDep<true>::__enable_explicit()' was not satisfied [with _Dummy = true]
        explicit pair(_T1 const& __t1, _T2 const& __t2)
                 ^
    [... much more of this ...]

    This is because Heimdall.h defines nullptr as a macro with value 0,
    which isn't compatible with C++11 or later.

    PR:             263176
    Approved by:    ehaupt (maintainer)
    MFH:            2022Q2

 .../heimdall/files/patch-heimdall_source_Heimdall.h (new) | 15 +++++++++++++++
 1 file changed, 15 insertions(+)