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 a linker error with macOS #626

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EmeraldLoc
Copy link
Contributor

During the linking stage of compilation, an error is thrown as --build-id appears to not exist in macOS. I've simply gone ahead and removed the added ld flags if the project is being compiled on macOS. The game appears to launch and run fine with this change.

@Isaac0-dev
Copy link
Collaborator

but the reason that line is there is to attempt to keep manually built executables as predictable as possible. will mac builds consistently produce the same executable every time even with this change?

@EmeraldLoc
Copy link
Contributor Author

Thats good to know. How are you comparing the binary? When I go and compile coop, put that into a SHA-256 convertor, save that, then delete only the executable file, and recompile that file, it results in the same SHA-256. Running make clean or distclean and then recompiling it and comparing the hashes results in them being different, thus not accomplishing the goal you have in mind. However. their may be metadata related to time and other info that would cause this to happen, so I don't know if that is a reliable way to compare.

@Isaac0-dev
Copy link
Collaborator

yeah that's how I test the builds are the same, and it seems that this change breaks the intended result.. the hope is to get the same build every time you make clean

@EmeraldLoc
Copy link
Contributor Author

Alright, so apparently macOS' linker does not include a build id by default anyways, so something else is causing the issue (I think?). I've been unable to reproduce 2 of the same executables, they're always different. The only solution that might work (that I haven't tried as I don't want to deal with uninstalling it if it turns out it doesn't work) is getting a GNU linker that allows the build id to be passed, however this would be rather inconvenient (but doable if necessary) for us Mac users. Pretty stumped on this one other than that though unfortunately.

@Isaac0-dev
Copy link
Collaborator

@EmeraldLoc can you try using -Wl,-no_uuid and -Wl,-x separately, and see if either produce a consistent build? if neither do alone, i guess try both combined (-Wl,-no_uuid -Wl,-x)?
i'm hoping only one of those is needed though. also don't forget to run make clean between builds to ensure its a proper test.

@EmeraldLoc
Copy link
Contributor Author

Running 1make clean1 in between each test, trying the flags -Wl,-no_uuid, -Wl,-x, and -Wl,-no_uuid -Wl,-x, none of which appear to output the same SHA-256 binary. My workflow is compiling the app, then, without doing any changes to the location of the binary, dragging the binary into the SHA256 checker at this site, and with that compiling my next binary, and comparing the 2 outputs of that sha256 checker. Dragging in the same binary results in the same output, and dragging in a copied binary results in the same output, but dragging in a differently compiled binary results in a different output.

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.

2 participants