[cmake-developers] Export files in the build tree have a total path length which is unnecessarily long

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Aug 9 19:49:40 EDT 2016


On 2016-08-09 10:11-0400 Brad King wrote:

> On 08/08/2016 02:54 PM, Alan W. Irwin wrote:
>> For all such staging areas, would it be straightforward to hash the
>> paths for the cmake-generated EXPORT files in the build tree to
>> substantially reduce their pathlengths for the absolute install
>> location case while still avoiding name collisions?
>
> Actually it looks like we already do this, but the logic forgot
> to account for the length of the file name.  Please try this fix:
>
> install(EXPORT): Fix support for mid-length install destinations on Windows
> https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c7a319ab
>

Hi Brad:

I don't have access to Windows, but I tried this fix on Linux with a
very long CMAKE_INSTALL_PREFIX (to trigger the hashing), and all seems
to be well.

software at raven> ~/cmake/install-c7a319a/bin/cmake -DCMAKE_INSTALL_PREFIX=$(pwd)/42397430947234398793874973983732987249739347293472938729487239472439782394723492374294847234927423497971498749237349723958749473934873497235987549023475/92752349572349053475945729729527234957349735209573999725497834957249524752904573975295742957349857934539709925294754973957493720274903485230252239/42397430947234398793874973983732987249739347293472938729487239472439782394723492374294847234927423497971498749237349723958749473934873497235987549023475/92752349572349053475945729729527234957349735209573999725497834957249524752904573975295742957349857934539709925294754973957493720274903485230252239/42397430947234398793874973983732987249739347293472938729487239472439782394723492374294847234927423497971498749237349723958749473934873497235987549023475/92752349572349053475945729729527234957349735209573999725497834957249524752904573975295742957349857934539709925294754973957493720274903485230252239/42397430947234398793874973983732987249739347293472938729487239472439782394723492374294847234927423497971498749237349723958749473934873497235987549023475/92752349572349053475945729729527234957349735209573999725497834957249524752904573975295742957349857934539709925294754973957493720274903485230252239/42397430947234398793874973983732987249739347293472938729487239472439782394723492374294847234927423497971498749237349723958749473934873497235987549023475/92752349572349053475945729729527234957349735209573999725497834957249524752904573975295742957349857934539709925294754973957493720274903485230252239/42397430947234398793874973983732987249739347293472938729487239472439782394723492374294847234927423497971498749237349723958749473934873497235987549023475/92752349572349053475945729729527234957349735209573999725497834957249524752904573975295742957349857934539709925294754973957493720274903485230252239/42397430947234398793874973983732987249739347293472938729487239472439782394723492374294847234927423497971498749237349723958749473934873497235987549023475/92752349572349053475945729729527234957349735209573999725497834957249524752904573975295742957349857934539709925294754973957493720274903485230252239/42397430947234398793874973983732987249739347293472938729487239472439782394723492374294847234927423497971498749237349723958749473934873497235987549023475/92752349572349053475945729729527234957349735209573999725497834957249524752904573975295742957349857934539709925294754973957493720274903485230252239/install_tree -DBUILD_TEST=ON ..
-- The Fortran compiler identification is GNU 4.9.2
-- Check for working Fortran compiler: /usr/bin/f95
-- Check for working Fortran compiler: /usr/bin/f95  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/f95 supports Fortran 90
-- Checking whether /usr/bin/f95 supports Fortran 90 -- yes
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/software/plplot/HEAD/plplot.git/cmake/test_fortran/build_dir

Despite that long install prefix (note the numbers have "/" embedded
periodically to avoid going over the individual filename length limit
on Linux), the exported files in the build-tree staging area appeared
in hashed form, e.g.,

software at raven> pwd
/home/software/plplot/HEAD/plplot.git/cmake/test_fortran/build_dir
software at raven> find $(pwd) -type f |grep -i export
/home/software/plplot/HEAD/plplot.git/cmake/test_fortran/build_dir/src_lib/CMakeFiles/Export/57a65d04a859ba876e044822264a11fe/export_test_fortran.cmake
/home/software/plplot/HEAD/plplot.git/cmake/test_fortran/build_dir/src_lib/CMakeFiles/Export/57a65d04a859ba876e044822264a11fe/export_test_fortran-noconfig.cmake

and after "make install" were installed in unhashed form (pathname
length as large as 2471 for this particular test case) without issues.

By the way, an install prefix of roughly 500 in length did not trigger
the hashing.  But I assume that lack of hashing for smaller-sized
prefixes on Linux is due to some knowledge CMake has about pathname
length limits on that platform, and hashing will be triggered for much
smaller install prefixes on MinGW-w64/MSYS2 because of the known much
smaller total pathname length limits on that platform.

By the way, you already know about this from our off-list discussions,
but for others here it will likely be September before that platform
can be tested by the guy who originally reported the issue to me to
make sure this fix solves the issue he discovered.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the cmake-developers mailing list