Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding "requests linking to directory" cmake warning

Tags:

cmake

I am compiling an enormous code (100,000+ lines) on an Ubuntu 16.04 machine. In the process of doing so, during the cmake (v3.5.1) build process (before running make), I generate a raft of WARNINGS.

E.g.

WARNING: Target "gadgetron_moco" requests linking to directory "/usr/lib".  Targets may link only to libraries.  CMake is dropping the item.

Obviously, I can't repost the code here, but within the source code I found a moco/CMakeLists.txt. Here is a code fragment from that file:

if(CUDA_FOUND)
    add_library(gadgetron_moco SHARED
        cpuRegistrationAveragingGadget.h
        gadgetron_moco_export.h
        gpuRegistrationAveragingGadget.h
        gpuRegistrationScatteringGadget.h
        RegistrationAveragingGadget.h
        RegistrationScatteringGadget.h
        ${CPU_GADGETS}
        ${GPU_GADGETS}
      )

    set_target_properties(gadgetron_moco PROPERTIES VERSION ${GADGETRON_VERSION_STRING} SOVERSION ${GADGETRON_SOVERSION})

    target_link_libraries(gadgetron_moco
      gadgetron_gadgetbase
      gadgetron_toolbox_cpucore gadgetron_mricore ${CPU_LIBS} ${GPU_LIBS}
      ${Boost_LIBRARIES} ${ISMRMRD_LIBRARIES}
      optimized ${ACE_LIBRARIES} debug ${ACE_DEBUG_LIBRARY}
      )

    install (TARGETS gadgetron_moco DESTINATION lib COMPONENT main)
endif()

The command that I used to call cmake:

cmake -DCMAKE_INSTALL_PREFIX=/opt/gadgetron/ \
    -DCMAKE_CXX_COMPILER=/usr/bin/g++-5 \
    -DCMAKE_C_COMPILER=/usr/bin/gcc-5 \
    -DBoost_INCLUDE_DIR=/usr/include/ \
    -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-8.0/ \
    -DARMADILLO_LIBRARY=/usr/lib/ \
    -DARMADILLO_INCLUDE_DIR=/usr/include/ \
    -DMKLROOT_PATH=/opt/intel/ \
    -DZFP_INCLUDE_DIR=/opt/ZFP/inc \
    -DZFP_LIBRARY=/opt/ZFP/lib \
    -DCMAKE_PREFIX_PATH=/opt/ismrmrd/:/opt/siemens_to_ismrmrd:/usr/lib/ \
    -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ..

Question: What is the warning exactly telling me? How do I go about debugging it?

like image 718
irritable_phd_syndrome Avatar asked Nov 01 '25 11:11

irritable_phd_syndrome


1 Answers

A "library" is a --file--!

The warning is about meaning of the word "library": it is a file (/path/to/xxx.so, /path/to/xxx.a or so), not a directory.

Assuming the project is correct, the warning signals about incorrect user-specified settings.

You set a variable ARMADILLO_LIBRARY, which is intended to contain a library, but you assign /usr/lib directory to that variable.

like image 105
Tsyvarev Avatar answered Nov 04 '25 04:11

Tsyvarev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!