epics-base / epics-base

The C/C++ core of the EPICS Base control system toolkit
https://epics-controls.org/
Other
126 stars 137 forks source link

Build broken if `INSTALL_LOCATION` disappears #512

Open exzombie opened 3 months ago

exzombie commented 3 months ago

It should always be possible to get the source directory to a (reasonably) pristine state by running make clean or make distclean. As it stands, this is not possible if the build was made with INSTALL_LOCATION that is not $(TOP) and if that directory is subsequently removed. The reason is the modules/RELEASE.$(T_A).local file that is generated during the build because it references build rules from INSTALL_LOCATION which do not exist any more. Thus, make clean is broken and the only ways to recover are to delete that file (which approximately no one knows about), or to remove the entire source directory and clone again.

anjohnson commented 2 months ago

@simon-ess: BEWARE, HERE BE DRAGONS!

This is a long-known problem, if you have any interest or ideas about fixing it please take a look. My experience when developing the submodule builds feature was that the simple solutions to the cleanup of the generated modules/RELEASE.$(EPICS_HOST_ARCH).local file were invariably incorrect, but I'd love to be proven wrong about that. That's the fundamental cause of @exzombie's complaint, if that file exists but the things it points to don't the build can't descend into any of the external submodules.

It isn't possible for make clean or make distclean to remove it because that would be run before make descends into the submodule directories, and they rely on that file to know where EPICS_BASE and hence the build files are. There is a simple solution included in the configure/RULES_TOP file (in the realuninstall rule) which usually works for me, but apparently not for all cases. The manual fix is to delete that RELEASE.host.local file.

Things which appear to exacerbate the problem: Setting INSTALL_LOCATION, and especially setting it on the make command-line. There are comments at the top of configure/RULES_MODULES which explain some of the moving parts, and configure/RULES_TOP also provides some of the implementation.