[CMake] CMake 2.4.2 Cygwin shouldn't have -ldl

Brandon J. Van Every bvanevery at gmail.com
Thu Jun 1 13:48:15 EDT 2006


William A. Hoffman wrote:
> At 01:22 PM 6/1/2006, Brandon J. Van Every wrote:
>   
>> Brad King wrote:
>>     
>>> Brandon J. Van Every wrote:
>>>       
>>>> I built a CMake 2.4.2 for Cygwin from sources.  I used the "Unix linefeed" download, cmake-2.4.2.tar.gz.  I used an earlier Cygwin CMake package to build it.  Now I am using this Cygwin CCMake 2.4.2 to generate my Chicken build.  When it comes time to link a .dll, it fails with:
>>>>
>>>> Linking C shared library libchicken.dll
>>>> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find
>>>> -ldl
>>>> collect2: ld returned 1 exit status
>>>> make[2]: *** [libchicken.dll] Error 1
>>>> make[1]: *** [CMakeFiles/libchicken.dir/all] Error 2
>>>> make: *** [all] Error 2
>>>>         
>>> If libchicken is trying to link to -ldl this is probably because you are telling to do so somewhere in your CMakeLists.txt code.
>>>       
>> Hm!  You know, there is a conditional -ldl in there.  I haven't noticed that in a long time.  I wonder why it's giving this behavior on Cygwin when previously it didn't.  I will investigate.
>>     
>
> There is a variable CMAKE_DL_LIBS, that you can use without an if.
>
>  TARGET_LINK_LIBRARIES(chicken ... ${CMAKE_DL_LIBS})
>   
I have investigated, and I'm not convinced that the -ldl is coming from 
my code.  My code is:

CHECK_INCLUDE_FILE(dl.h HAVE_DL_H)
IF(HAVE_DL_H)
  ADD_DEFINITIONS(-DHAVE_DL_H)
  SET(EXTRA_LIBS ${EXTRA_LIBS} ldl)
ENDIF(HAVE_DL_H)

There is no dl.h on any hard drive of my system.  Which is to be 
expected, as it's a Linux thing.  I think the -ldl more likely from 
building CMake 2.4.2 on Cygwin incorrectly.  I will await your canonical 
version and see if the problem goes away.


Cheers,
Brandon Van Every

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060601/e608a9dc/attachment.html


More information about the CMake mailing list