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

Bug 870082

Summary: media-radio/fldigi-4.1.23 fails to compile (MUSL): table.cxx:49:18: error: NULL was not declared in this scope
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Thomas Beierlein <tomjbe>
Status: RESOLVED FIXED    
Severity: normal CC: sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 839975    
Attachments: build.log

Description Agostino Sarubbo gentoo-dev 2022-09-14 10:25:19 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: media-radio/fldigi-4.1.23 fails to compile (MUSL).
Discovered on: amd64 (internal ref: tinderbox_musl)

NOTE:
This machine uses MUSL libc
Comment 1 Agostino Sarubbo gentoo-dev 2022-09-14 10:25:21 UTC
Created attachment 805087 [details]
build.log

build log and emerge --info
Comment 2 Thomas Beierlein gentoo-dev 2022-09-16 17:56:27 UTC
Weird. A MUSL related bug has been solved already (#832231). The code afterwards build without problems under MUSL. Now it magically fails. 

At the moment I do not see what has changed in between. Needs to investigate some more.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-16 18:01:01 UTC
This kind of one could easily be gcc 11 vs 12, but only appearing on musl. Just a missing include hopefully.
Comment 4 Thomas Beierlein gentoo-dev 2022-09-16 20:08:03 UTC
(In reply to Sam James from comment #3)
> This kind of one could easily be gcc 11 vs 12, but only appearing on musl.

I will have to  check whats the difference between both. Some defaults may have changed.

> Just a missing include hopefully.

No, looks a little bit more complicated.

The log show a

#define nullptr NULL

from one of the source files, but an additional

#define NULL nullptr 

from included time.h

When commenting out the first (conditional) definition the code compiles.

Maybe it is related to the different handling of the NULL macro in glibc and musl.
Comment 5 Thomas Beierlein gentoo-dev 2022-09-16 20:19:27 UTC
(In reply to Thomas Beierlein from comment #4)
> (In reply to Sam James from comment #3)
> > This kind of one could easily be gcc 11 vs 12, but only appearing on musl.
> 
> I will have to  check whats the difference between both. Some defaults may
> have changed.
> 
Hmm, looks not like GCC11 vs. GCC12 related. Fails to compile even under GCC-11.3.0
Comment 6 Thomas Beierlein gentoo-dev 2022-09-17 10:18:28 UTC
Turns out, the problem is a change in definition of NULL in musl-1.2.3. See teh following commit: 

https://git.musl-libc.org/cgit/musl/commit?id=98e688a9da5e7b2925dda17a2d6820dddf1fb287

-#ifdef __cplusplus
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
 #define NULL 0L
 #else
 #define NULL ((void*)0)


As fldigi has a

#define nullptr NULL 

it results in a circular redefinition.

So but is not related to GCC12
Comment 7 Larry the Git Cow gentoo-dev 2022-09-17 12:12:15 UTC
The bug has been closed via the following commit(s):

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

commit 2d149b09fb7c013457a0c866a3a6a4f9e72c3ee3
Author:     Thomas Beierlein <tomjbe@gentoo.org>
AuthorDate: 2022-09-17 12:11:20 +0000
Commit:     Thomas Beierlein <tomjbe@gentoo.org>
CommitDate: 2022-09-17 12:11:20 +0000

    media-radio/fldigi: Drop problematic definition of nullptr
    
    Closes: https://bugs.gentoo.org/870082
    Signed-off-by: Thomas Beierlein <tomjbe@gentoo.org>

 .../files/fldigi-drop-nullptr-definition.patch     | 23 ++++++++++++++++++++++
 media-radio/fldigi/fldigi-4.1.22.ebuild            |  3 ++-
 media-radio/fldigi/fldigi-4.1.23.ebuild            |  3 ++-
 3 files changed, 27 insertions(+), 2 deletions(-)