Make clean - bug or feature?


Please read tips for efficient and successful posting and posting code

_ROOT Version:6.26/02
_Platform:_linuxarm64
_Compiler: gcc (Debian 10.2.1-6)

I compiled root from source on Raspberry Pi Raspberry-OS 64bit.
It worked like magic without any problem. Using beforehand the “Debian one-liner” string to install the common optional packages, it even installed qt5 which I found hard to install on raspberry pi before.

The download from github and compilation of root on Raspberry Pi takes quite some time (more than an hour, i guess) even with 8GB of ram and a ssd disk with SATA adapter.
As a habit after having tried out my new shiny root I unfortunately typed “make clean”. The system then silently did some operations which also took some time and at the end the executable of root had disappeared and I had to compile everything again. To me, this is not an expected behavior. Is it a bug or a feature?

best regards Karl

Hi @karl.loewenich ,
I think it is to be expected that running make clean in the build directory might remove the build artifacts. However the top-level makefile created automatically by cmake does not have a clean target, so I am confused as to what clean target you invoked?

Cheers,
Enrico

EDIT: nevermind, my mistake. I do have a clean target, all clear :slight_smile:

Hi Enrico, I’m not an expert, however what I have seen is that “make clean” normally eliminates .obj,.tmp files and the like, but not the executable that was built. It is not a real drama, but with the raspberry pi, compilation unfortunately takes a lot of time even with make -j4

regards Karl

CMake is the de-facto standard build system for C++ project and it generates a clean target that removes the build artifacts, I think that’s as close as it gets to standard behavior. Of course manually written makefiles can do anything the author wants (or doesn’t want, if they mess up) :smiley:

I am sorry for your lost time – however it really seems that the right thing to do is avoiding calling make clean rather than tweaking the default cmake behavior.

Cheers,
Enrico

I’m sorry but I don’t undersand. I’ve beeen using cmake for years. I did not tweak anything. After running cmake I simply typed “make -j4” in the build directory and a few hours later after the target was built I typed “make clean” also in the build directory. The latter command among other also wiped out the “root” executable. That’s all.
As I said It was not a real problem to me and I posted my notice here only because other users might incur into the same thing as well
best regards Karl

That’s the expected behavior, at least for makefiles generated by cmake.

In order to “preserve” the result of a build, it is recommended to run the “install” target that we copy the final product in the install directory (and won’t be removed by a make clean).

Just remember that you can “make install”, but there is no “make uninstall” (in makefiles generated by cmake), so you’d better make sure that your “install directory” (e.g., use “/opt/ROOT/v6-26-02) is well separated from the “system directories” (like “/usr/...”).

There are some projects based on CMake that do implement/customize an uninstall target. See for example Add "uninstall" CMake target · lamyj/odil@5ab26b9 · GitHub (might be a nice feature for ROOT, too).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.