Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 646352

Summary: games-emulation/desmume - utils/libfat/directory.cpp:142:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Product: Gentoo Linux Reporter: Andrew Ammerlaan <andrewammerlaan>
Component: Current packagesAssignee: Hanno Böck <hanno>
Status: RESOLVED FIXED    
Severity: normal CC: andrewammerlaan, drmccoy, games, kfm, plevine457, tsmksubc
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/7606
Whiteboard: ~arch only
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 617524    
Attachments: build.log
emerge-info
ebuild environment

Description Andrew Ammerlaan gentoo-dev 2018-02-01 20:00:05 UTC
Created attachment 517466 [details]
build.log

games-emulation/desmume fails to build with gcc-7.3.0 

What I think is the error:
utils/libfat/directory.cpp:142:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  while (count < len-1 && src != '\0') {

This thread: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853372
leads me to believe that there is a fix, however it stays vague about the actual solution. Full build log attached.
Comment 1 Andrew Ammerlaan gentoo-dev 2018-02-01 20:01:18 UTC
Created attachment 517468 [details]
emerge-info
Comment 2 Andrew Ammerlaan gentoo-dev 2018-02-01 20:03:09 UTC
Created attachment 517470 [details]
ebuild environment
Comment 3 Adam Feldman gentoo-dev 2018-02-23 17:01:19 UTC
(In reply to Andrew Ammerlaan from comment #0)
> Created attachment 517466 [details]
> build.log
> 
> games-emulation/desmume fails to build with gcc-7.3.0 
> 
> What I think is the error:
> utils/libfat/directory.cpp:142:33: error: ISO C++ forbids comparison between
> pointer and integer [-fpermissive]
>   while (count < len-1 && src != '\0') {
> 
> This thread: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853372
> leads me to believe that there is a fix, however it stays vague about the
> actual solution. Full build log attached.

Here's the patch Debian uses:


From e1f7039f1b06add4fb75b2f8774000b8f05574af Mon Sep 17 00:00:00 2001
From: rogerman <rogerman@users.sf.net>
Date: Mon, 17 Aug 2015 21:15:04 +0000
Subject: Fix bug with libfat string handling.

diff --git a/src/utils/libfat/directory.cpp b/src/utils/libfat/directory.cpp
index 765d7ae5..b6d7f01f 100644
--- a/src/utils/libfat/directory.cpp
+++ b/src/utils/libfat/directory.cpp
@@ -139,7 +139,7 @@ static size_t _FAT_directory_mbstoucs2 (ucs2_t* dst, const char* src, size_t len
 	int bytes;
 	size_t count = 0;
 
-	while (count < len-1 && src != '\0') {
+	while (count < len-1 && *src != '\0') {
 		bytes = mbrtowc (&tempChar, src, MB_CUR_MAX, &ps);
 		if (bytes > 0) {
 			*dst = (ucs2_t)tempChar;
Comment 4 Andrew Ammerlaan gentoo-dev 2018-02-24 08:30:09 UTC
Thank you, I can confirm that this patch fixes this issue.
Comment 5 Peter Levine 2018-03-25 06:26:33 UTC
PR: https://github.com/gentoo/gentoo/pull/7606
Comment 6 Larry the Git Cow gentoo-dev 2018-04-04 21:44:49 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8c5ab82437990540303065670b04fa21b71df82

commit f8c5ab82437990540303065670b04fa21b71df82
Author:     Peter Levine <plevine457@gmail.com>
AuthorDate: 2018-03-25 06:16:42 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2018-04-04 21:37:58 +0000

    games-emulation/desmume: Fix building with GCC-7
    
    Closes: https://bugs.gentoo.org/646352
    Closes: https://github.com/gentoo/gentoo/pull/7606
    Package-Manager: Portage-2.3.16, Repoman-2.3.6

 games-emulation/desmume/desmume-0.9.11-r1.ebuild    |  3 ++-
 .../desmume/files/desmume-0.9.11-gcc7.patch         | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)