Bug 216650 - devel/caf: fails to build with clang 4.0
Summary: devel/caf: fails to build with clang 4.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: needs-patch
Depends on:
Blocks: 216008
  Show dependency treegraph
 
Reported: 2017-01-31 01:28 UTC by Jan Beich
Modified: 2017-01-31 05:12 UTC (History)
1 user (show)

See Also:
jbeich: merge-quarterly-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2017-01-31 01:28:08 UTC
In file included from libcaf_core/src/actor_config.cpp:20:
In file included from libcaf_core/caf/actor_config.hpp:23:
In file included from /usr/include/c++/v1/string:470:
In file included from /usr/include/c++/v1/string_view:171:
In file included from /usr/include/c++/v1/__string:56:
In file included from /usr/include/c++/v1/algorithm:637:
/usr/include/c++/v1/type_traits:4301:23: error: calling 'operator()' with incomplete return type 'caf::behavior'
_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__config:390:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/usr/include/c++/v1/type_traits:4198:23: note: expanded from macro '_LIBCPP_INVOKE_RETURN'
    noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) \
                      ^~~~~~~~~~~
/usr/include/c++/v1/type_traits:4318:9: note: in instantiation of exception specification for '__invoke<std::__1::function<caf::behavior (caf::local_actor *)> &, caf::local_actor *>' requested here
        _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...));
        ^
/usr/include/c++/v1/__config:390:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/usr/include/c++/v1/functional:1591:33: note: in instantiation of template class 'std::__1::__invokable_r<void, std::__1::function<caf::behavior (caf::local_actor *)> &, caf::local_actor *>' requested here
                                __invokable<_Fp&, _ArgTypes...>::value>
                                ^
/usr/include/c++/v1/functional:1616:9: note: in instantiation of default argument for '__callable<std::__1::function<caf::behavior (caf::local_actor *)> >' required here
        __callable<_Fp>::value && !is_same<_Fp, function>::value
        ^~~~~~~~~~~~~~~
/usr/include/c++/v1/functional:1618:5: note: in instantiation of default argument for 'function<std::__1::function<caf::behavior (caf::local_actor *)> >' required here
    function(_Fp);
    ^~~~~~~~~~~~~
/usr/include/c++/v1/functional:1578:28: note: while substituting deduced template arguments into function template 'function' [with _Fp = std::__1::function<caf::behavior (caf::local_actor *)>, $1 = (no value)]
class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
                           ^
/usr/include/c++/v1/functional:1670:9: note: 'operator()' declared here
    _Rp operator()(_ArgTypes...) const;
        ^
libcaf_core/caf/fwd.hpp:62:7: note: forward declaration of 'caf::behavior'
class behavior;
      ^

build log: http://package18.nyi.freebsd.org/data/headamd64PR216008-default/2017-01-29_16h09m05s/logs/errors/caf-0.15.3.log
libc++ first bad: https://github.com/llvm-mirror/libcxx/commit/8d5cbd7ce2e9
Comment 1 Jan Beich freebsd_committer freebsd_triage 2017-01-31 01:29:00 UTC
Note, caf-0.15.3 builds fine with clang 3.9 or with clang 4.0 before that libc++ commit.
Comment 2 Matthias Vallentin 2017-01-31 01:40:15 UTC
I would like to reproduce the issue, but can't find a clang 4.x package: pkg search clang yields:

clang-devel-5.0.d20170114_1    C, Objective-C, and C++ compiler (use devel/llvm-devel)
clang33-3.3_9                  C, Objective-C, and C++ compiler
clang34-3.4.2_5                C, Objective-C, and C++ compiler
clang35-3.5.2_1                C, Objective-C, and C++ compiler
clang36-3.6.2                  C, Objective-C, and C++ compiler
clang37-3.7_3                  C, Objective-C, and C++ compiler (use devel/llvm37)
clang38-3.8_1                  C, Objective-C, and C++ compiler (use devel/llvm38)

How did you wind up with clang 4.x?

The issue itself looks like it could be one-line fix by adding

    #include "caf/behavior.hpp"

in libcaf_core/caf/actor_config.hpp. If you have a chance to try it, I'd much appreciate it.
Comment 3 Jan Beich freebsd_committer freebsd_triage 2017-01-31 02:03:34 UTC
(In reply to Matthias Vallentin from comment #2)
> I would like to reproduce the issue, but can't find a clang 4.x package: pkg search clang yields:

If you're on 12.0-CURRENT (only the kernel matters) try the following

  $ poudriere jail -cj clang40-amd64 -v projects/clang400-import -m svn
  $ poudriere bulk -Ctj clang40-amd64 devel/caf

otherwise try the following but it may show a false positive during linking

  $ git clone https://github.com/llvm-mirror/libcxx/
  $ (cd libcxx; git co origin/release_40)
  $ cd /usr/ports/devel/caf
  $ echo 'CXXFLAGS += -nostdinc++ -isystem/path/to/libcxx/include' >>Makefile.local
then
  $ pkg install llvm40
  $ make clean all CC=clang40 CXX=clang++40 CPP=clang-cpp40
or
  $ pkg install llvm-devel
  $ make clean all CC=clang-devel CXX=clang++-devel CPP=clang-cpp-devel

> The issue itself looks like it could be one-line fix by adding
>
>    #include "caf/behavior.hpp"
>
> in libcaf_core/caf/actor_config.hpp. If you have a chance to try it,
> I'd much appreciate it.

It does help. I'll land it shortly after testing the fix doesn't regress build on other FreeBSD versions.
Comment 4 commit-hook freebsd_committer freebsd_triage 2017-01-31 02:45:11 UTC
A commit references this bug:

Author: jbeich
Date: Tue Jan 31 02:44:36 UTC 2017
New revision: 432892
URL: https://svnweb.freebsd.org/changeset/ports/432892

Log:
  devel/caf: unbreak build with clang/libc++ 4.0

  PR:		216650
  Submitted by:	Matthias Vallentin <vallentin@icir.org> (maintainer)

Changes:
  head/devel/caf/files/
  head/devel/caf/files/patch-libcaf__core_src_actor__config.cpp
Comment 5 Jan Beich freebsd_committer freebsd_triage 2017-01-31 02:49:46 UTC
Thanks. Landed.
Comment 6 Jan Beich freebsd_committer freebsd_triage 2017-01-31 02:59:42 UTC
Cannot be MFH'd to /branches/2017Q1 as the patched file is missing and 0.14.5 was broken on 12.0-CURRENT, anyway.
Comment 7 Matthias Vallentin 2017-01-31 05:12:59 UTC
Looks like you've already patched the port, thanks! I've also fixed the issue upstream:

    https://github.com/actor-framework/actor-framework/commit/c5a3ee26a6e76b28dd4226f35230b280f291386d

The next release will include that commit. Then we can get rid of the patch again.