cetlib build failure with native clang from Xcode 8
MarcP and I are experimenting with building the art suite and externals with Xcode 8 native clang (e.g. Mac El Capitan). We have a show-stopper build failure in cetlib...
[ 92%] Building CXX object cetlib/cetlib/test/CMakeFiles/cetlib_test_TestPlugin_plugin.dir/TestPlugin_plugin.cc.o /Users/lyon/Development/clangstuff/dev/srcs/cetlib/cetlib/test/TestPlugin_plugin.cc:25:3: error: 'makePlugin' has C-linkage specified, but returns incomplete type 'std::unique_ptr<cettest::TestPluginBase>' which could be incompatible with C [-Werror,-Wreturn-type-c-linkage] makePlugin(std::string message) ^ /Users/lyon/Development/clangstuff/dev/srcs/cetlib/cetlib/test/TestPlugin_plugin.cc:31:1: error: 'pluginType' has C-linkage specified, but returns user-defined type 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') which is incompatible with C [-Werror,-Wreturn-type-c-linkage] DEFINE_BASIC_PLUGINTYPE_FUNC(cettest::TestPluginBase) ^ /Users/lyon/Development/clangstuff/dev/srcs/cetlib/cetlib/PluginTypeDeducer.h:35:5: note: expanded from macro 'DEFINE_BASIC_PLUGINTYPE_FUNC' pluginType() \ ^ 2 errors generated.
How to fix?
#2 Updated by Christopher Green almost 4 years ago
- File clang.patch added
- Tracker changed from Bug to Support
- Status changed from New to Feedback
- Assignee set to Christopher Green
- % Done changed from 0 to 100
- Experiment g-2 added
- Experiment deleted (
A trawl of the C++14 standard shows nothing that explicitly permits or prohibits the behavior we use, so we believe that the correct workaround is to add
-Wno-return-type-c-linkage to the compile options. Please apply the attached patch and let me know if that solves the problem. There may be a couple of more places in art code where this adjustment needs to be applied. Please let us know if there are and include the error messages on this ticket, and we will address them in the same way.