Closed seanyen closed 4 years ago
This change would add each of the directories to the environment variables even if they aren't being populated. I don't think that is desired.
Did you run catkin_make run_tests
as the first command without a normal build before?
Did you run
catkin_make run_tests
as the first command without a normal build before?
I am running catkin_make
first and then catkin_make run_tests
.
The thing I observed is that the setup_cached.bat
gets generated fairly earlier even before any files get copied to devel\bin
when catkin_make
is invoked. And the later catkin_make run_tests
won't trigger setup_cached.bat
to be regenerated neither.
Btw, removing the check added in https://github.com/ros/catkin/pull/777 helps fix this problem, but it is probably going to have some side-effects (roswtf
tests?).
The goal is to only add paths to environment variable where necessary. So removing the previous check wouldn't be good since it add non-existing directories and this patch only creates the directories unconditionally (basically the check) and adding unnecessary paths in some cases.
I would prefer a solution which still maintain the original goal to only add paths to environment variable when necessary.
Closing this pull request first before I (or anyone) figure out a better solution.
The Problem
This is manifesting when running
catkin_make run_tests
and I saw some shared libraries are not found whenrostest
runs the ROS nodes in my workspace. It tuned out that<catkin_ws>\devel\bin
(where the DLL lives) should be captured bycatkin/python/catkin/environment_cache.py
insetup_cached.bat
and later pass to the processes runningrostest
, but it didn't.So, as I trace upward, I found when
generate_cached_setup.py
gets invoked, at that moment devel space is empty but only contains the common files (env.*
andsetup.*
) added bycatkin
. Therefore, as this particular logic gets exercised inside the call stack fromgenerate_cached_setup.py
, it will skip adding thebin
andlib
subfolder to the%PATH%
, because those subfolders doesn't yet exist. As a result, the<catkin_ws>\devel\bin
doesn't get added and passed torostest
later.Why is it not a problem to Linux? On Linux, there is a concept or
RPATH\RUNPATH
,which is backed inside the binaries, for the loader to know where to search the shared objects. On Windows, the shared library search-order system is different and by the convention we used in ROS, the search path needs to be added to%PATH%
.Proposal Solution
I believe there is a reason to keep this check, so I go another route to force the basic layout to be created ahead in the devel space, so later they will be added by
_setup_util.py
.And please consider to back-port to
kinetic-devel
. Thanks!