Bug 259418 - devel/glog: fix build with clang 13
Summary: devel/glog: fix build with clang 13
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: Po-Chuan Hsieh
Depends on:
Blocks: 258209
  Show dependency treegraph
Reported: 2021-10-24 19:46 UTC by Dimitry Andric
Modified: 2021-11-02 16:57 UTC (History)
0 users

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

devel/glog: work around clang 13 assertion (1.22 KB, patch)
2021-10-24 19:47 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 2021-10-24 19:46:24 UTC
During an exp-run for llvm 13 (see bug 258209), it turned out that devel/glog  fails to build with clang 13:

FAILED: CMakeFiles/stacktrace_unittest.dir/src/stacktrace_unittest.cc.o 
/usr/bin/c++ -DGFLAGS_IS_A_DLL=0 -DGLOG_NO_SYMBOLIZE_DETECTION -I/wrkdirs/usr/ports/devel/glog/work/.build -I/wrkdirs/usr/ports/devel/glog/work/glog-0.5.0/src -isystem /usr/local/include -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   -std=c++11 -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden -Wno-unnamed-type-template-args -MD -MT CMakeFiles/stacktrace_unittest.dir/src/stacktrace_unittest.cc.o -MF CMakeFiles/stacktrace_unittest.dir/src/stacktrace_unittest.cc.o.d -o CMakeFiles/stacktrace_unittest.dir/src/stacktrace_unittest.cc.o -c /wrkdirs/usr/ports/devel/glog/work/glog-0.5.0/src/stacktrace_unittest.cc
Assertion failed: ((E || !FunctionPass) && "No function transformations should introduce *new* ref " "edges! Any new ref edges would require IPO which " "function passes aren't allowed to do!"), function operator(), file /poudriere/jails/mainamd64PR258209/usr/src/contrib/llvm-project/llvm/lib/Analysis/CGSCCPassManager.cpp, line 965.
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.

This is due to a clang bug introduced after 13.0 branched, and which has been reported at https://bugs.llvm.org/show_bug.cgi?id=50881 .

While upstream is working on a fix, I propose to put in a workaround. This patches CMakeLists.txt to use the -flegacy-pass-manager compiler flag for stacktrace_unittest.cc, avoiding the assertion.
Comment 1 Dimitry Andric freebsd_committer 2021-10-24 19:47:21 UTC
Created attachment 229002 [details]
devel/glog: work around clang 13 assertion
Comment 2 Dimitry Andric freebsd_committer 2021-11-02 16:57:56 UTC
This is now fixed without touching the port, by applying an upstream fix for the assertion: