<br><br><div class="gmail_quote">On Wed, Apr 18, 2012 at 7:00 AM, Eric Noulard <span dir="ltr"><<a href="mailto:eric.noulard@gmail.com">eric.noulard@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2012/4/18 pellegrini <<a href="mailto:pellegrini@ill.fr">pellegrini@ill.fr</a>>:<br>
<div class="im">> Dear CMakers,<br>
><br>
> I introduced recently a colleague of mine to the wonders of cmake. He has a<br>
> problem that neither he or me could solve.<br>
><br>
> When he cmakes and builds his project as root and builds subsenquently its<br>
> project as himself the whole project is rebuilt even if<br>
> nothing has been changed.<br>
<br>
</div>Building as root is evil and cmake try it hard to discourage the practice<br>
by rebuilding over & over :-]<br>
<div class="im"><br>
> I may be wrong but I think this is not an actual problem with cmake but<br>
> rather a general property of make that do not consider only the<br>
> timestamp but also the owner of a file and if one of these changes, the file<br>
> is marked as having to be rebuild.<br>
<br>
</div>A nice idea suggested by Bill sometimes ago was to.<br>
<br>
<br>
0) Create a pristine git repo<br>
<br>
1) Add the source and an empty build dir to the repo<br>
commit.<br>
<br>
1) Build out of source in the build dir.<br>
add+commit all thing in the build dir.<br>
<br>
2) Try "make"<br>
then git diff or git status in order to see what have changed.<br>
<div class="im"><br>
><br>
> What do you think ? Would you see one way to escape from this feature ?<br>
<br>
</div>avoid building as root?<br>
<br>
Why would he need to build as root in the first place?<br>
Usually only the ultimate install step may need root privilege, and for that one<br>
$ sudo make install<br>
may be simple enough?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Erk<br>
Le gouvernement représentatif n'est pas la démocratie --<br>
<a href="http://www.le-message.org" target="_blank">http://www.le-message.org</a><br>
</font></span><div class="HOEnZb"><div class="h5">--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br><div><br></div><div>It may not be prohibited, but to me, it makes absolutely no sense to try to do a build as one user, and then do an incremental re-build as another user, regardless of whether one of those users is 'root' or not.</div>
<div><br></div><div>Think about it: doing a build means writing a ton of files, as the user who is doing the build. In order to switch to another user, and still have everything work, you'd need to make sure that all of those files written in the build tree by the first user are over-writeable (if necessary) by the second user. It would be a privilege analysis nightmare unless you guarantee that both users and all build tools involved write the files with a shared group where both users have equivalent group permissions.</div>
<div><br></div><div>Since that's not true in general, or by default, .... it's a good idea to avoid switching users in a build tree and expecting it to work.</div><div><br></div><div>You *could* get it to work, but I think you'd have to be very careful to get it to work well.</div>
<div><br></div><div><br></div><div>Cheers,</div><div>David</div><div><br></div>