-
Notifications
You must be signed in to change notification settings - Fork 9
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
Use explicit INSTALL_COMMAND to suppress DESTDIR #21
Conversation
The DESTDIR environment variable is used on UNIX systems during an invocation of 'make install' to specify an alternate directory prefix for installation paths. Since this isn't a cross-platform mechanism, the CMAKE_INSTALL_PREFIX CMake variable can also be used. Unfortunately, if both of these are specified, they will both be applied. This isn't typically a problem, but can cause problems for the installation phase of ExternalProject_Add if the external project is built during an invocation of 'make install' with DESTDIR set. Since the CMAKE_INSTALL_PREFIX method is employed by the call to ExternalProject_Add instead of DESTDIR, we should specifically suppress DESTDIR if it is set so that it doesn't interfere with the installation of the external project to the staging directory. Signed-off-by: Scott K Logan <logans@cottsay.net>
As far as I can tell from reading the only Bad Stuff:tm: that results from this change is that customizing a ROS 2 build using DESTDIR alone wouldn't affect the vendor packages since the variable would be unset during installation. Is that actually the case? Are there other caveats to this approach? It seems like the best solution given that it doesn't interfere with the usual workflow. |
So we never want The problem isn't the use of I'm not aware of any circumstances where we'd want the current behavior to continue. Actually, if the external project is never built without a I'm going to open an issue to discuss how colcon should handle an externally supplied
In this example, the staging directory should be |
Here's that colcon issue I promised: colcon/colcon-cmake#103 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the best explained changes I've reviewed for some time. Thanks for the clear explanation. The solution makes sense to me.
I have one none blocking question about whether a comment belongs in the source to summarize the necessity but otherwise looks good.
The DESTDIR environment variable is used on UNIX systems during an invocation of 'make install' to specify an alternate directory prefix for installation paths. Since this isn't a cross-platform mechanism, the CMAKE_INSTALL_PREFIX CMake variable can also be used.
Unfortunately, if both of these are specified, they will both be applied. This isn't typically a problem, but can cause problems for the installation phase of ExternalProject_Add if the external project is built during an invocation of 'make install' with DESTDIR set.
Since the CMAKE_INSTALL_PREFIX method is employed by the call to ExternalProject_Add instead of DESTDIR, we should specifically suppress DESTDIR if it is set so that it doesn't interfere with the installation of the external project to the staging directory.
In this package, there is something subtle happening related to using
git
as an upstream source combined with a patching step that causes the external project to be re-built during the install phase. This is triggering the behavior described above. Each issue alone does not result in the misbehavior, but when both occur, the result is that the install phase of the external project installs the project to the wrong location -$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}
- instead of just${CMAKE_INSTALL_PREFIX}
, which corresponds to the staging directory.