Skip to content

Comments

Mac fix build race condition#6444

Merged
AenBleidd merged 6 commits intomasterfrom
mac_fix_build_race_condition
Jul 18, 2025
Merged

Mac fix build race condition#6444
AenBleidd merged 6 commits intomasterfrom
mac_fix_build_race_condition

Conversation

@CharlieFenton
Copy link
Contributor

Many of the applications that are part of BOINC for Macintosh include an info.plist file, and several also include an infoplist.strings file, all of which contain the version number of BOINC. MacOS uses the information from these plist files to dsplay the version strings and related information to the user.

The Xcode project builds a helper app setversion which copies the templates of the various info.plist files from clientgui/mac/templates/ and updates the version information in each. The setversion app also generates the infoplist.strings files.

Each info.plist and infoplist.strings file must be created before the corresponding application is built by Xcode or the build of that application will fail. It has always been a challenge to ensure that happens, especially for simpler applications which take very little time to build. This sometimes created a race condition during the Xcode build process, causing builds to fail.

This PR builds and invokes the setversion helper app earlier in the build process, eliminating the race condition to make the build process more reliable.

In addition, this PR has a small change to the file lib/hostinfo.cpp to fix a compiler warning due to a change introduced in PR #6425, under the mistaken belief that the space characters must be escaped in the Podman data directory path string. As it turned out, the backslash characters added in that PR were ignored by the Xcode compiler and generated a warning "Unknown escape sequence."

The issue with Podman on the Mac was actually due to the Podman executable not being in the standard search path. BOINC does not inherit all default paths from the user's environment, so it must specify the full path to the Podman app: /opt/podman/bin/podman. This had already been fixed in PR #6396, after the release of BOINC 8.2.4.

@CharlieFenton
Copy link
Contributor Author

This PR is ready to merge when CI checks are complete.

@AenBleidd
Copy link
Member

While Windows and MinGW errors are unrelated to this PR (I'll fix them separately), however this one looks strange:

▸ Processing BoincCmd-Info.plist



❌  error: Build input file cannot be found: '/Users/runner/work/boinc/boinc/mac_build/BoincCmd-Info.plist'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'cmd_boinc' from project 'boinc')
The following build commands failed:

	ProcessInfoPlistFile /Users/runner/work/boinc/boinc/mac_build/build/boinc.build/Deployment/cmd_boinc.build/Objects-normal/x86_64/Processed-Info.plist /Users/runner/work/boinc/boinc/mac_build/BoincCmd-Info.plist (in target 'cmd_boinc' from project 'boinc')

	ProcessInfoPlistFile /Users/runner/work/boinc/boinc/mac_build/build/boinc.build/Deployment/cmd_boinc.build/Objects-normal/arm64/Processed-Info.plist /Users/runner/work/boinc/boinc/mac_build/BoincCmd-Info.plist (in target 'cmd_boinc' from project 'boinc')
▸ Processing BoincCmd-Info.plist
(2 failures)

❌  error: Build input file cannot be found: '/Users/runner/work/boinc/boinc/mac_build/BoincCmd-Info.plist'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'cmd_boinc' from project 'boinc')


Building cmd_boinc...failed

@CharlieFenton, could you please take a look?

@AenBleidd
Copy link
Member

@CharlieFenton, still failing:

▸ Processing BoincCmd-Info.plist


The following build commands failed:
❌  error: Build input file cannot be found: '/Users/runner/work/boinc/boinc/mac_build/BoincCmd-Info.plist'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'cmd_boinc' from project 'boinc')
	ProcessInfoPlistFile /Users/runner/work/boinc/boinc/mac_build/build/boinc.build/Deployment/cmd_boinc.build/Objects-normal/arm64/Processed-Info.plist /Users/runner/work/boinc/boinc/mac_build/BoincCmd-Info.plist (in target 'cmd_boinc' from project 'boinc')

	ProcessInfoPlistFile /Users/runner/work/boinc/boinc/mac_build/build/boinc.build/Deployment/cmd_boinc.build/Objects-normal/x86_64/Processed-Info.plist /Users/runner/work/boinc/boinc/mac_build/BoincCmd-Info.plist (in target 'cmd_boinc' from project 'boinc')

(2 failures)
▸ Processing BoincCmd-Info.plist

❌  error: Build input file cannot be found: '/Users/runner/work/boinc/boinc/mac_build/BoincCmd-Info.plist'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'cmd_boinc' from project 'boinc')


Building cmd_boinc...failed

@CharlieFenton
Copy link
Contributor Author

@AenBleidd It should fixed now. I had tested only building using the Xcode GUI, but apparently building from the command line using xcodebuild works differently, so I also had to modify the BuildMacBOINC.sh script.

@CharlieFenton
Copy link
Contributor Author

Please wait before merging. I want to look at one more thing.

@CharlieFenton CharlieFenton marked this pull request as draft July 17, 2025 20:42
@CharlieFenton CharlieFenton marked this pull request as ready for review July 17, 2025 21:00
@CharlieFenton
Copy link
Contributor Author

@AenBleidd Thank you. I am done now, pending final CI checks succeeding. Please merge.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a race condition in the macOS build process by moving the execution of the SetVersion helper app earlier in the build process, and corrects a compiler warning in lib/hostinfo.cpp.

  • Moves SetVersion execution from individual target dependencies to pre-build actions in Xcode schemes
  • Removes redundant SetVersion dependencies from multiple targets in the Xcode project
  • Adds a new script Update_Info_Plists.sh to handle SetVersion execution during pre-build actions

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
mac_build/boinc.xcodeproj/xcshareddata/xcschemes/*.xcscheme Adds pre-build actions to execute Update_Info_Plists.sh script
mac_build/boinc.xcodeproj/project.pbxproj Removes SetVersion target dependencies and updates build configurations
mac_build/Update_Info_Plists.sh New script to build and execute SetVersion during pre-build phase
mac_build/BuildMacBOINC.sh Explicitly calls Update_Info_Plists.sh since xcodebuild ignores pre-actions
lib/hostinfo.cpp Removes unnecessary escape characters from Podman directory path
clientgui/mac/SetVersion.cpp Adds chdir to SRCROOT environment variable

#

## Called from pre-actions in BOINC Xcode project when compiling BOINC.
## Note that Xcode runs build pre-actions pnly for the currently selected
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

Typo in comment: 'pnly' should be 'only'

Suggested change
## Note that Xcode runs build pre-actions pnly for the currently selected
## Note that Xcode runs build pre-actions only for the currently selected

Copilot uses AI. Check for mistakes.
## Note that Xcode runs build pre-actions pnly for the currently selected
## build target, not for any dependent targets that may also be built along
## with the selected target. So this script is called only once for any
## build operation, even the build_all target. The ovehead of running this
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

Typo in comment: 'ovehead' should be 'overhead'

Suggested change
## build operation, even the build_all target. The ovehead of running this
## build operation, even the build_all target. The overhead of running this

Copilot uses AI. Check for mistakes.
printf("%s\n", myPath); // For debugging
#endif

chdir(getenv("SRCROOT"));
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

The chdir call does not check if getenv("SRCROOT") returns NULL, which would cause undefined behavior. Add a null check before calling chdir.

Suggested change
chdir(getenv("SRCROOT"));
const char* srcroot = getenv("SRCROOT");
if (srcroot == NULL) {
fprintf(stderr, "Error: SRCROOT environment variable is not set.\n");
return 1;
}
chdir(srcroot);

Copilot uses AI. Check for mistakes.
printf("%s\n", myPath); // For debugging
#endif

chdir(getenv("SRCROOT"));
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

The chdir call does not check for failure. If the directory change fails, the program may not work correctly. Consider checking the return value and handling errors appropriately.

Suggested change
chdir(getenv("SRCROOT"));
if (chdir(getenv("SRCROOT")) == -1) {
perror("Error changing directory to SRCROOT");
return 1;
}

Copilot uses AI. Check for mistakes.
@CharlieFenton
Copy link
Contributor Author

I'm not worried about the suggestion Copilot made about error checking. If that call fails (which is extremely unlikely, since Xcode always sets that environment variable before running any script, including the one which runs SetVersion), there's nothing we can do about it and the build will fail anyway.

@AenBleidd AenBleidd merged commit 6c832b1 into master Jul 18, 2025
177 checks passed
@AenBleidd AenBleidd deleted the mac_fix_build_race_condition branch July 18, 2025 07:45
@github-project-automation github-project-automation bot moved this from In progress to Merged in Client/Manager Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants