Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Detect when linking a binary has finished by looking at just the executable?

The build tool for the language in which our project is written does compilation and linking in parallel, for a number of different binaries and so on. In CI we have a separate thread that looks for these compiled binaries as they become available and kicks off other processes.

The trouble is it seems that just waiting for the file to exist and become chmod a+x is not enough, and sometimes we end up uploading corrupt binaries.

Is there any way to determine, just by looking at a file, whether linking has finished? This can be specific to x86-64, and even just specific to gold or lld.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

(My fallback solution is to create a shim around the linker that we use, that can signal in some way when it’s actually complete)

>Solution :

While the linker output file is open then the linker is not finished. The approach I would use is to check whether the output file is open or not.

See Is there a way to check if a file is in use?

See as well this post about to an answer about checking a file is open by another process which has a discussion on the problem Determine if file is in the process of being written upon?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading