Bug 232520

Summary: devel/tigcc: fix build with GCC-based architectures
Product: Ports & Packages Reporter: Piotr Kubaj <pkubaj>
Component: Individual Port(s)Assignee: Mark Linimon <linimon>
Status: Closed FIXED    
Severity: Affects Only Me CC: cyberbotx, linimon
Priority: --- Flags: cyberbotx: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch
none
updated patch to tigcc none

Description Piotr Kubaj freebsd_committer freebsd_triage 2018-10-22 08:52:43 UTC
Created attachment 198458 [details]
patch

-fnested-functions is necessary to support nested functions with base GCC.

Tested on powerpc64.

Hardware sponsored by IntegriCloud.
Comment 1 Naram Qashat 2018-10-22 11:53:35 UTC
Patch looks good to me.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2018-11-27 20:38:21 UTC
Testing a patch with the flag conditionalized on CHOSEN_COMPILER_TYPE.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2018-11-28 08:32:03 UTC
Created attachment 199632 [details]
updated patch to tigcc
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2018-11-28 08:32:27 UTC
(In reply to Mark Linimon from comment #3)

This patch is sufficient on powerpc64 but fails on amd64.  What am I missing?
Comment 5 Piotr Kubaj freebsd_committer freebsd_triage 2018-11-28 13:49:13 UTC
(In reply to Mark Linimon from comment #4)
Do you mean it fails with clang or gcc on amd64?
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2018-11-29 11:01:46 UTC
(In reply to Piotr Kubaj from comment #5)

On amd64 I get:

checking whether the C compiler (gcc7 -O2 -pipe  -fnested-functions -fstack-protector -Wl,-rpath=/usr/local/lib/gcc7 -fno-strict-aliasing -std=gnu89   -fstack-protector -Wl,-rpath=/usr/local/lib/gcc7 -L/usr/local/l
ib/gcc7 ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
Comment 7 Piotr Kubaj freebsd_committer freebsd_triage 2018-11-29 14:42:24 UTC
It looks like new GCC supports nested functions without any switch.

We can check for
.if exists(/usr/lib/libstdc++.so)
and only add -fnested-functions if it exists.
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-12-06 23:56:11 UTC
A commit references this bug:

Author: linimon
Date: Thu Dec  6 23:56:00 UTC 2018
New revision: 486810
URL: https://svnweb.freebsd.org/changeset/ports/486810

Log:
  -fnested-functions is necessary to support nested functions with base GCC.

  While here, pet portlint.

  PR:		232520
  Submitted by:	Piotr Kubaj
  Approved by:	maintainer (earlier version of patch)

Changes:
  head/devel/tigcc/Makefile