Skip to content

fix duplicate source inclusion - #30

Merged
MasonRemaley merged 3 commits into
allyourcodebase:mainfrom
alorans:main
Aug 30, 2026
Merged

fix duplicate source inclusion#30
MasonRemaley merged 3 commits into
allyourcodebase:mainfrom
alorans:main

Conversation

@alorans

@alorans alorans commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

SDL_iokitjoystick.c is included in both the generic and cocoa source list. This can cause issues on Mac, especially with zig-compile-commands.

@jayschwa

Copy link
Copy Markdown
Collaborator

Did you try it the other way too - leaving the file in cocoa and removing from generic?

@alorans

alorans commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

I didn't try it initially but I have now. It doesn't seem to make a difference. The most recent commit removed it from generic and left it in cocoa.

@jayschwa

Copy link
Copy Markdown
Collaborator

Since the CI for 0.16.0 passes even on the main branch, how were you encountering / reproducing the problem this PR aims to fix?

@alorans

alorans commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

When you use SDL as a dependency in a project on Mac that is using zig-compile-commands, building the compilation database shows this message:

alorans@alorans:~/code/projects/sdl_test/ > zig build cdb                                                        
warning: Found duplicate source file in a single compile step: "/Users/alorans/code/projects/sdl_test/zig-pkg/N-V-__8AAAHL9wLH-k89zUdJesNpvVC3lHMzF3jnhXfuclqx/src/joystick/darwin/SDL_iokitjoystick.c", ignoring repeated instance
warning: Found duplicate source file in a single compile step: "/Users/alorans/code/projects/sdl_test/zig-pkg/N-V-__8AAAHL9wLH-k89zUdJesNpvVC3lHMzF3jnhXfuclqx/src/joystick/darwin/SDL_iokitjoystick.c", ignoring repeated instance
warning: Found duplicate source file in a single compile step: "/Users/alorans/code/projects/sdl_test/zig-pkg/N-V-__8AAAHL9wLH-k89zUdJesNpvVC3lHMzF3jnhXfuclqx/src/joystick/darwin/SDL_iokitjoystick.c", ignoring repeated instance

It shows the message 3 times because I was using SDL, SDL_image, and SDL_ttf. This used to be a panic instead of a warning until the most recent version of zig-compile-commands.

@alorans

alorans commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

This issue doesn't really affect the usability of the library in general, but any tooling that introspects the zig build graph can theoretically stumble on this.

@MasonRemaley

Copy link
Copy Markdown
Contributor

Thanks for the PR! I'm surprised this wasn't breaking the build, regardless each implementation file is only intended to be included once so the change is welcome.

(I went ahead and moved this one to "generic" before merging since SDL wraps it with the proper ifdefs to allow this.)

@MasonRemaley
MasonRemaley merged commit 5d74fc4 into allyourcodebase:main Aug 30, 2026
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