Skip to content

fix(agc): declare environ for macOS host reports - #15205

Draft
mashingaan wants to merge 1 commit into
boykopovar:mainfrom
mashingaan:fix/agc-host-report-environ-14371
Draft

mashingaan wants to merge 1 commit into
boykopovar:mainfrom
mashingaan:fix/agc-host-report-environ-14371

Conversation

@mashingaan

Copy link
Copy Markdown
Contributor

What

Declare environ for non-Windows builds in HostReportSources.cpp. The source reads this global on macOS, but <unistd.h> does not declare it there, so compiling libSceAgcDriver fails with an undeclared identifier. This matches the declaration already used by PerformanceTrace.cpp and FrameRecorder.cpp. Fixes #14371.

Tested

Not run locally. This change is queued for Hosted CI.

Checklist

@kurexw kurexw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked on macOS 27.2 on an Apple M4 (x86-64 build under Rosetta, Apple clang 21.0.0) against main at a72186d.

This change is already on main. #14867 (merged 2026-11-03) closed #14371. It added the same declaration inside the non-Windows branch of the includes in HostReportSources.cpp, at line 17:

#else
#include <cerrno>
#include <sys/utsname.h>
#include <unistd.h>
extern char** environ;
#endif

This PR's merge-base, 9090972, predates that. The PR still merges cleanly, but merging it now adds a second, identical #ifndef _WIN32 extern char** environ; #endif block just after the one above.

With the PR merged, HostReportSources.cpp compiles with Apple clang. The only warning is -Wreturn-type-c-linkage from HostCpu.hpp:31, and main gives the same warning, so the duplicate declaration doesn't break anything. But it adds nothing. Closing this as superseded by #14867 seems right.

I ran file_streams as a smoke test on this build. It fails exactly as it does on main (Stream scan changed a matching failure to input failure, which #21720 and #21721 address), so that failure has nothing to do with this PR.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the declaration matches the existing non-Windows declarations and resolves the use of environ in the host report source.

What I ran

Reviewed head ee697a1b726748eda988063821a0e3383ab846e1. No build or tests were run; the PR description says local testing was not run and Hosted CI is pending.

Results

Check Result Note
Source review passed Change and use inspected
Build and tests not run CI pending per description

Findings

Blocking

None.

Non-blocking

None.

Not verified

The macOS compile claim and Hosted CI results were not verified. Read the full changed file core/libs/prx/libSceAgcDriver/Execution/src/HostReportSources.cpp, the relevant declaration/use in PerformanceTrace.cpp and FrameRecorder.cpp, and the supplied description, commits, manifest, and diff. No changed files were excluded from the review bundle.

To get this to a good state

Nothing is required.

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trial merge onto c1601e56d5 was clean. The host-report change declares environ and continues to read it directly on Darwin. The adjacent device-fault fix in #16796 obtains the array via _NSGetEnviron(). Please confirm compilation and linking of HostReportSources.cpp on native macOS and consider using the same Darwin accessor so both environment reports follow the same platform contract. My review is source-based.

AI-assisted: yes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* fix error Closes an issue (Fixes #N)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGC: libSceAgcDriver doesn't compile on macOS since HostReportSources.cpp was split off (environ undeclared); fix branch ready

4 participants