Bug 2304756

Summary: gcc fails to build mozjs128 where clang succeeds
Product: [Fedora] Fedora Reporter: František Zatloukal <fzatlouk>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: david.abdurachmanov, dmalcolm, fweimer, jakub, jlaw, josmyers, jwakely, mcermak, mpolacek, msebor, nickc, nixuser, sipoyare, xry111
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
build log
none
dist-git tarball none

Description František Zatloukal 2024-08-13 23:40:15 UTC
Description of problem:

I am working on packaging mozjs128, a dependency of gjs (GNOME). The upstream prefers clang tooling, but Fedora and el builds have historically used gcc.

The build fails on:
error: ‘static void js::gc::Cell::operator delete(void*)’ is private within this context

where clang doesn't complain and builds an usable binary.

Version-Release number of selected component (if applicable):
gcc-14.2.1-1.fc40.x86_64
gcc-14.1.1-7.fc41.x86_64 (Latest in rawhide as gcc is FTBFS there)

How reproducible:
Always

Steps to Reproduce:
The buildsys is a bit complicated, I'll upload a tarball archive as an attachment (as this is an upcoming package).

1. Untar, git init, git checkout -b rawhide, spectool -g mozjs128.spec, fedpkg srpm
2. mock build
3.

Actual results:
A spam of:
error: ‘static void js::gc::Cell::operator delete(void*)’ is private within this context

Expected results:
Working build.

Additional info:

Comment 1 František Zatloukal 2024-08-13 23:40:58 UTC
Created attachment 2044180 [details]
build log

Comment 2 František Zatloukal 2024-08-13 23:41:31 UTC
Created attachment 2044181 [details]
dist-git tarball

Comment 3 František Zatloukal 2024-08-13 23:42:48 UTC
FYI, I've left commented out '%global toolchain clang' to experiment with, the clang build fails too at a later point (due to packaging in progress, on brp-mangle-shebangs ).

Comment 4 František Zatloukal 2024-08-13 23:45:46 UTC
As for the steps how to reproduce, the first one should be with git add mozjs128.spec & git commit, sorry.

Comment 5 Aoife Moloney 2025-02-26 13:11:00 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.

Comment 6 Xi Ruoyao 2025-08-29 19:05:03 UTC
When I work on another distro I found the same symptom is triggered by "-fexception" in the default CXXFLAGS setting of that distro.  The mozjs build system appends the CXXFLAGS from environment after the flags set on its own, and this -fexception overrides the -fno-exception set by the mozjs build system then things can go wrong.

But I've not figured out the full event of chain how this leads to the cryptic "error: ‘static void js::gc::Cell::operator delete(void*)’ is private within this context."

Comment 7 David Abdurachmanov 2025-11-12 16:40:30 UTC
I can confirm that adding:

%global optflags %(echo %{optflags} | sed -e 's/-fexceptions//g')

Resolves compilation error with toolchain is GCC.