trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2012

Re: [trinity-devel] libkscan improper concatenation by CMake [was Re: [SOLVED] Re: tdegraphics build failure 2 : libkscan.so (linker error?)]

From: "David C. Rankin" <drankinatty@...>
Date: Wed, 07 Mar 2012 23:00:31 -0600
On 03/07/2012 03:55 PM, Serghei Amelian wrote:
> On Wednesday 07 March 2012 23:51:01 David C. Rankin wrote:
> [...]
> 
>> Serghei, All,
>>
>>   Looking at the concatenation, even if net-snmp-config included linker
>> flags in the linker --libs string, the build should not have failed.
>>
>> Linking CXX shared library libkscan.so
>> /usr/bin/ld: cannot find
>> -lsane-Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu-L/usr/lib
>> collect2: ld returned 1 exit status
>>
>>   The error above shows that the link would have succeeded if '-lsane' and
>> '-Wl' were not concatenated together. The final part of the error was:
>>
>> collect2: ld returned 1 exit status
>> make[2]: *** [libkscan/libkscan.so.1.0.0] Error 1
>> make[1]: *** [libkscan/CMakeFiles/kscan-shared.dir/all] Error 2
>> make: *** [all] Error 2
>>
>>   I don't know where the actual concatenation takes place after the
>> CMakeLists.txt is read, but it looks like whatever takes place after:
>>
>>   LINK kio-shared ${SANE_LIBRARIES}
>>
>> is where the concatenation problem arises. Where can I look at this logic?
> 
> kdegraphics/libkscan/ConfigureChecks.cmake
> 
> Check these lines:
> 
> string( REGEX REPLACE "(^| )-l" ";" SANE_LIBRARIES "${SANE_LIBRARIES}" )
> string( REPLACE " " "" SANE_LIBRARIES "${SANE_LIBRARIES}" )
> 

Hah! Now I see why you did it :)

# cleanup
if( SANE_INCLUDE_DIRS )
  string( REGEX REPLACE "(^| )-I" ";" SANE_INCLUDE_DIRS "${SANE_INCLUDE_DIRS}" )
endif( )
if( SANE_LIBRARIES )
  string( REGEX REPLACE "(^| )-l" ";" SANE_LIBRARIES "${SANE_LIBRARIES}" )
#  string( REPLACE " " "" SANE_LIBRARIES "${SANE_LIBRARIES}" )
endif( )

Commenting results in this cmake error.

CMake Error at cmake/modules/TDEMacros.cmake:662 (add_library):
  Target "kscan-shared" links to item "v4l1 " which has leading or trailing
  whitespace.  This is now an error according to policy CMP0004.
Call Stack (most recent call first):
  libkscan/CMakeLists.txt:38 (tde_add_library)

So the string REPLACE which was meant to get around this CMake error is what is
causing the run-together concatenation in the library string. I will play with
the regex and see if we can come up wit one that trims leading or trailing
whitespace for CMake, but doesn't result in run-together parameters.... :)

-- 
David C. Rankin, J.D.,P.E.