Bug 237058

Summary: net/asterisk13 and net/asterisk16: filed to build with system clang - "unknown argument: '-fno-partial-inlining'"
Product: Ports & Packages Reporter: Vladimir Druzenko <vvd>
Component: Individual Port(s)Assignee: Guido Falsi <madpilot>
Status: Closed FIXED    
Severity: Affects Only Me Flags: madpilot: maintainer-feedback+
madpilot: merge-quarterly-
Priority: ---    
Version: Latest   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
asterisk13 patch
none
asterisk16 patch none

Description Vladimir Druzenko freebsd_committer freebsd_triage 2019-04-06 03:41:37 UTC
12.0-p3 amd64.
Build fine with GCC on.
End of build log with command "MAKE_JOBS_UNSAFE=yes portmaster net/asterisk16" (option GCC is off):
gmake[3]: Entering directory '/opt/obj/usr/ports/net/asterisk16/work/asterisk-16.3.0/utils'
cc -o astcanary.o -c astcanary.c -MD -MT astcanary.o -MF .astcanary.o.d -MP -pthread -I/opt/obj/usr/ports/net/asterisk16/work/asterisk-16.3.0/include -O2 -pipe -march=core2  -I/usr/local/include/lua53 -DLIBICONV_PLUG -fstack-protector -DLDAP_DEPRECATED -isystem /usr/local/include -fno-strict-aliasing -std=gnu89    -I/usr/local/include/libxml2 -I/usr/include  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations  -fblocks  -isystem /usr/local/include   -DSTANDALONE -O3 -fno-partial-inlining -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -march=native -Wno-parentheses-equality -O2 -pipe -march=core2  -I/usr/local/include/lua53 -DLIBICONV_PLUG -fstack-protector -DLDAP_DEPRECATED -isystem /usr/local/include -fno-strict-aliasing -std=gnu89  -Wno-unused-value -Wno-parentheses-equality
cc: error: unknown argument: '-fno-partial-inlining'
gmake[3]: *** [/opt/obj/usr/ports/net/asterisk16/work/asterisk-16.3.0/Makefile.rules:159: astcanary.o] Error 1
gmake[3]: Leaving directory '/opt/obj/usr/ports/net/asterisk16/work/asterisk-16.3.0/utils'
gmake[2]: *** [Makefile:386: utils] Error 2
gmake[2]: Leaving directory '/opt/obj/usr/ports/net/asterisk16/work/asterisk-16.3.0'
*** Error code 1
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2019-04-06 07:18:04 UTC
Hi,

The port is building fine on 12.0 in poudriere or the build cluster.

I suspect there's something else, causing this issue.

First of all I need to see the exact options you're building the port with, you can get those with make showconfig

The full build log could be useful too, since I can't find the "-fno-partial-inlining" in the build log from poudriere, it could be useful to try to understand where it's coming from in your case.

Could you share your /etc/make.conf file?

Could you also share the output of "cc --version" on your system?
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2019-04-06 07:23:52 UTC
(In reply to Guido Falsi from comment #1)

> The full build log could be useful too, since I can't find the
> "-fno-partial-inlining" in the build log from poudriere, it could be useful
> to try to understand where it's coming from in your case.

I found the possible cause in an asterisk Makefile:

# gcc version 8.2.1 and above must have partial-inlining disabled to avoid documented bug
GCC_VER_GTE821:=$(shell expr `gcc --version | grep ^gcc | cut -d ' ' -f 3 | sed -e 's/\.\([0-9][0-9]\)/
\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \>= 80201)
ifeq ($(GCC_VER_GTE821),1)
    OPTIMIZE+=-fno-partial-inlining
endif


it's unconditionally running "gcc --version", so if you have a recent gcc installed it can trigger this.

I'm preparing a fix for you to test.
Comment 3 Guido Falsi freebsd_committer freebsd_triage 2019-04-06 07:38:44 UTC
Created attachment 203424 [details]
asterisk13 patch
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2019-04-06 07:39:01 UTC
Created attachment 203425 [details]
asterisk16 patch
Comment 5 Guido Falsi freebsd_committer freebsd_triage 2019-04-06 07:39:43 UTC
Please test the attached patches. Should fix the issue.
Comment 6 Guido Falsi freebsd_committer freebsd_triage 2019-04-06 07:47:32 UTC
Versions present in quarterly branch not affected.
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2019-04-06 13:45:39 UTC
(In reply to Guido Falsi from comment #5)
Testing…
Comment 8 Vladimir Druzenko freebsd_committer freebsd_triage 2019-04-06 14:05:55 UTC
(In reply to VVD from comment #7)
asterisk13 build fine with patch.
Testing asterisk16…

Ye, you are right about cc/gcc:
$ cc --version
FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
$ gcc --version
gcc (FreeBSD Ports Collection) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 9 Vladimir Druzenko freebsd_committer freebsd_triage 2019-04-06 15:05:58 UTC
(In reply to VVD from comment #8)
asterisk16 build fine too - you can commit the patches.

asterisk15 don't need the patch.
Comment 10 commit-hook freebsd_committer freebsd_triage 2019-04-07 16:19:46 UTC
A commit references this bug:

Author: madpilot
Date: Sun Apr  7 16:18:55 UTC 2019
New revision: 498283
URL: https://svnweb.freebsd.org/changeset/ports/498283

Log:
  Fix build on live system when gcc 8 is also installed.

  PR:		237058
  Submitted by:	VVD <vvd@unislabs.com>

Changes:
  head/net/asterisk13/files/patch-Makefile.rules
Comment 11 commit-hook freebsd_committer freebsd_triage 2019-04-07 16:19:49 UTC
A commit references this bug:

Author: madpilot
Date: Sun Apr  7 16:19:14 UTC 2019
New revision: 498284
URL: https://svnweb.freebsd.org/changeset/ports/498284

Log:
  Fix build on live system when gcc 8 is also installed.

  PR:		237058
  Submitted by:	VVD <vvd@unislabs.com>

Changes:
  head/net/asterisk16/files/patch-Makefile.rules
Comment 12 Guido Falsi freebsd_committer freebsd_triage 2019-04-07 16:20:09 UTC
Committed. Thanks!