Bug 237215 - games/diaspora: fix build with GCC-based architectures
Summary: games/diaspora: fix build with GCC-based architectures
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: Steve Wills
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-12 06:23 UTC by Piotr Kubaj
Modified: 2019-04-13 00:58 UTC (History)
2 users (show)

See Also:
lightside: maintainer-feedback+


Attachments
patch (696 bytes, patch)
2019-04-12 06:23 UTC, Piotr Kubaj
no flags Details | Diff
v2 (695 bytes, patch)
2019-04-12 18:06 UTC, Piotr Kubaj
lightside: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer freebsd_triage 2019-04-12 06:23:09 UTC
Created attachment 203608 [details]
patch

Add -fpermissive to CXXFLAGS when compiling with GCC to fix build.

Failing build:
https://talos.anongoth.pl/data/powerpc64-default/2019-04-06_01h45m28s/logs/errors/diaspora-1.1.1_1.log

While here, also add USES=gl.
Comment 1 lightside 2019-04-12 15:42:49 UTC
Hello.

Thanks for PR and patch submission.

As I understood, the provided build log mentions about GCC 4.2.1 compiler:
_CCVERSION_921dbbb2=cc (GCC) 4.2.1 20070831 patched [FreeBSD] <..>

I checked build with using newer GCC 8.3 compiler (lang/gcc8, USE_GCC=yes) (at least on amd64 architecture, but mentioned compiler errors might be the same) and it builds without errors. The newer GCC 8.3 compiler doesn't require CXXFLAGS+=-fpermissive for this case also. This may mean, that this is GCC 4.2.1 (or 4.x) related compiler issue.

The ".if exists(/usr/lib/libstdc++.so)" (in attachment #203608 [details]) is inderect check for installed GCC 4.2.1 compiler in FreeBSD base, if I'm not wrong. There are cases in current FreeBSD ports for such check. But maybe possible to add some comment about GCC 4.2.1 related issue for this case.

I guess, that possible alternative approach is explicit check for GCC compiler version, for example:
-8<--
USES+=	compiler

.include <bsd.port.pre.mk>

.if ${CHOSEN_COMPILER_TYPE} == gcc && ${COMPILER_VERSION} < 43
CXXFLAGS+=	-fpermissive
.endif

# <..>
.include <bsd.port.post.mk>
-->8-

(In reply to comment #0)
> While here, also add USES=gl.
You also proposed to add sdl to USES.

There is a space character between "+=" and "-fpermissive" on 76 (19 in patch) line in attachment #203608 [details]: "WARN: Makefile: [76]: use a tab (not space) after a variable name". Please fix this and I may approve this patch.
Comment 2 Piotr Kubaj freebsd_committer freebsd_triage 2019-04-12 18:05:16 UTC
(In reply to lightside from comment #1)
When using GCC8, I get:
bmpman/bmpman.cpp: In function 'int bm_make_render_target(int, int, int)':
bmpman/bmpman.cpp:2817:71: error: cast from 'void*' to 'ptr_u' {aka 'unsigned int'} loses precision [-fpermissive]
   bm_bitmaps[n].bm.data = (ptr_u) bm_malloc(n, bm_bitmaps[n].mem_taken);


That's how I found that -fpermissive fixes that and it turns out it works with base GCC.

You could add:
.if ${CHOSEN_COMPILER_TYPE} == gcc && ${COMPILER_VERSION} < 43
if this is the approach you want to use. However, you can drop the check for CHOSEN_COMPILER_TYPE, there's no Clang version lower than 4.3 in currently supported FreeBSD versions.
Comment 3 Piotr Kubaj freebsd_committer freebsd_triage 2019-04-12 18:06:05 UTC
Created attachment 203620 [details]
v2

Patch with corrected space.
Comment 4 lightside 2019-04-12 18:41:25 UTC
Comment on attachment 203620 [details]
v2

(In reply to comment #2)
Thanks for explanations. I approved new patch.
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-04-13 00:58:16 UTC
A commit references this bug:

Author: swills
Date: Sat Apr 13 00:57:27 UTC 2019
New revision: 498783
URL: https://svnweb.freebsd.org/changeset/ports/498783

Log:
  games/diaspora: fix build with GCC-based architectures

  PR:		237215
  Submitted by:	Piotr Kubaj <pkubaj@anongoth.pl>
  Approved by:	lightside <lightside@gmx.com> (maintainer)

Changes:
  head/games/diaspora/Makefile
Comment 6 Steve Wills freebsd_committer freebsd_triage 2019-04-13 00:58:38 UTC
Committed, thanks!