Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where incremental dynamic builds do not link to static dependencies. #2196

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

billhollings
Copy link
Contributor

After the recent change to building dynamic frameworks and dylibs as targets built by linking to a static library dependency, incremental builds do not correctly link the dynamic frameworks and dylibs to the rebuilt static library.

  • Delete dynamic target outputs during static target builds.
  • Run platform schemes sequentially in manual order.
  • Build the dynamic framework before the dylib.
  • Clean up Xcode Scheme organization.

It is not entirely obvious what the dependency problem is, and why these particular changes work. A lot of trial-and-error was required. It's possible that Xcode dependency analysis does not correctly analyze the flow used in MoltenVK builds.

This should fix issue #2186.

…ndencies.

After the recent change to building dynamic frameworks and dylibs as targets
built by linking to a static library dependency, incremental builds do not
correctly link the dynamic frameworks and dylibs to the rebuilt static library.

- Delete dynamic target outputs during static target builds.
- Run platform schemes sequentially in manual order.
- Build the dynamic framework before the dylib.
- Clean up Xcode Scheme organization.

It is not entirely obvious what the dependency problem is, and why
these particular changes work. A lot of trial-and-error was required.
It's possible that Xcode dependency analysis does not correctly analyze
the flow used in MoltenVK builds.
Copy link
Collaborator

@spnda spnda left a comment

Choose a reason for hiding this comment

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

This seems to fix the issue locally for me. Though I have no idea about the Xcode project changes themselves.

@SRSaunders
Copy link
Contributor

SRSaunders commented Apr 2, 2024

I wonder if the problem is not having any source files to compile for the dylib target. As a quick and dirty test, I removed the libMoltenVK.a static library from the Link Binary with Libraries area under Build Phases, and added all the MoltenVK source and header files directly to the MoltenVK-macOS-dylib target. This may be duplicating things (I'm not sure actually), but incremental builds do begin working properly after that.

UPDATE - Unfortunately it does look like XCode is duplicating the work. I was hoping that it would be a bit smarter about compilation of like units for different targets. Darn. However, I wonder if some smaller source code unit could be created that would force Xcode to see the dependency on a changed libMoltenVK.a? Not sure. In any case, what you have accomplished with your fix works well and is probably the most efficient solution for minimizing compilation time.

@billhollings
Copy link
Contributor Author

@SRSaunders Thanks for looking into options and testing them.

UPDATE - Unfortunately it does look like XCode is duplicating the work. I was hoping that it would be a bit smarter about compilation of like units for different targets. Darn.

Yeah. It would be nice, especially for the individual object-file compiles. But it appears that in...

~/Library/Developer/Xcode/DerivedData/MoltenVKPackaging-xxxx/Build/Intermediates.noindex/MoltenVK.build/Release

...Xcode tracks each target build separately.

@billhollings billhollings merged commit adcd448 into KhronosGroup:main Apr 2, 2024
6 checks passed
@billhollings billhollings deleted the incr-dyn-link-fix branch April 2, 2024 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants