trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2012

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 15:51:01 -0600
On 03/07/2012 02:42 PM, David C. Rankin wrote:
> On 03/07/2012 01:04 PM, David C. Rankin wrote:
>> On 03/07/2012 11:08 AM, Serghei Amelian wrote:
>>> On Wednesday 07 March 2012 18:55:51 David C. Rankin wrote:
>>> [...]
>>>
>>>> LIBSANE_LIBS='-lsane
>>>> -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu -L/usr/lib
>>>> -lnetsnmp -lcrypto -lm -ldl -lv4l1   -lm -ltiff -ljpeg  -lgphoto2
>>>> -lgphoto2_port -lm -lexif -lusb     -lavahi-common -lavahi-client    -lusb 
>>>> '
>>>>
>>>> LIBSANE_LDFLAGS='-L/usr/lib
>>>> -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu
>>>> -Wl,-rpath,/usr/lib'
>>>>
>>>> LIBSANE_INCLUDES=''
>>>>
>>>>   I have no idea how '-lsane-Wl' is ending up crammed together. Any
>>>> thoughts from the gurus?
>>>
>>> cmake expects only a library list from sane-config.
>>>
>>
>> Well, that could explain it :p
>>
>>   That would also be consistent with the man page for sane-config:
>>
>>        --libs  Print the additional libraries that are necessary to link a SANE
>> frontend to libsane.
>>
>>   I'll sed those out and follow up with arch on the behavior of sane. What is
>> the output of your:
>>
>> sane-config --libs
>>
>> ?
>>
> 
> Tim, all:
> 
> net-snmp-config --libs includes NON library information which causes packages
> built later that depend on it (eg: sane) to fail to link due to extraneous
> library information. I opened a bug report with Arch:
> 
> https://bugs.archlinux.org/task/28817
> 

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?

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