Hi Domen,

Unfortunately I can't seem to create an easy-to-package example for the issue. 
Since it seems that the file given to the install(...) command has to be in a 
"very different place" than the source or binary directories for the issue to 
come up. (My guess is that if the file shares some of its path with the build 
directory, CPackRPM uses a different method for dealing with it than if the two 
paths don't share any prefix.)

In our case some files are picked up from a network drive, while the build 
happens (naturally) on a local drive. I can reproduce the issue with a 
CMakeLists.txt file like:

cmake_minimum_required( VERSION 2.8 )
project( CPackRPMLinkProblem )

install( FILES /afs/cern.ch/.../some_link.txt DESTINATION . )

set( CPACK_PACKAGE_RELOCATABLE TRUE )
include( CPack )

As long as the build directory's path name ends up being longer than the path 
name of the file specified in the install(...) command, the RPM building fails. 
As it does for instance here:

http://atlas-computing.web.cern.ch/atlas-computing/links/distDirectory/nightlies/experimentalWebArea/nicos_web_areaCMAKE64BS6G49AnlOpt/NICOS_Log_rel_4/nicos_rpm_build.html

Cheers,
           Attila

> On 23 Mar 2016, at 15:57, Domen Vrankar <domen.vran...@gmail.com> wrote:
> 
> As a workaround you could set files that you would like to be excluded
> from symlink relocation with CPACK_RPM_USER_FILELIST or
> CPACK_RPM_<COMPONENT>_USER_FILELIST.
> 
> I'll have a look at how this could be solved for later versions of CPack.
> Do I understand correctly that those errors occur when a symlink is
> pointing to another simlink outside your project?
> Could you please provide a minimal example of all your cases?
> 
> Thanks,
> Domen
> 
> 
> 2016-03-23 14:13 GMT+01:00 Attila Krasznahorkay
> <attila.krasznahor...@gmail.com>:
>> Hi Brad,
>> 
>> I did. Then I get:
>> 
>> CMake Error at 
>> /afs/cern.ch/work/k/krasznaa/public/cmake/3.5.0/share/cmake-3.5/Modules/CPackRPM.cmake:981
>>  (string):
>> string begin index: 164 is out of range 0 - 156
>> Call Stack (most recent call first):
>> /afs/cern.ch/work/k/krasznaa/public/cmake/3.5.0/share/cmake-3.5/Modules/CPackRPM.cmake:1625
>>  (cpack_rpm_prepare_install_files)
>> /afs/cern.ch/work/k/krasznaa/public/cmake/3.5.0/share/cmake-3.5/Modules/CPackRPM.cmake:1787
>>  (cpack_rpm_generate_package)
>> 
>> You can find the full output here:
>> 
>> http://atlas-computing.web.cern.ch/atlas-computing/links/distDirectory/nightlies/experimentalWebArea/nicos_web_areaCMAKE64BS6G49TrgOpt/NICOS_Log_rel_3/nicos_rpm_build.html
>> 
>> Note that when I tried to build the project in a build area with a shorter 
>> path, then the RPM building succeeded. Just because by chance in that case 
>> in the expression
>> 
>> string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_)
>> 
>> the work directory length was shorter than the length of the path outside of 
>> the project.
>> 
>> Of course this is the code that we're talking about:
>> 
>> https://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/CPackRPM.cmake;h=7ffec136deabb8f28d6293cdc96e43cd4a2af70d;hb=HEAD#l994
>> 
>> Cheers,
>>             Attila
>> 
>>> On 23 Mar 2016, at 13:50, Brad King <brad.k...@kitware.com> wrote:
>>> 
>>> On 03/23/2016 08:44 AM, Attila Krasznahorkay wrote:
>>>> CMake Error at /afs/cern.ch/sw/lcg/contrib/CMake/3.3.2/...
>>> 
>>> Please try with CMake 3.5.
>>> 
>>> -Brad
>>> 
>> 

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to