Page MenuHomePhabricator

Libraries added with add_llvm_loadable_module macro to have their component name
AbandonedPublic

Authored by vdmitrie on Aug 31 2018, 11:53 AM.

Details

Summary

Make targets added with add_llvm_loadable_module macro to be in their named components rather than end up in Unspecified one.

Diff Detail

Repository
rL LLVM

Event Timeline

vdmitrie created this revision.Aug 31 2018, 11:53 AM
vdmitrie added a reviewer: rnk.Sep 7 2018, 9:07 AM
rnk added a comment.Sep 7 2018, 1:02 PM

I looked at the documentation for the cmake install command, but I still have no idea what a component is or what effect this option has. Can you elaborate on that?

D51748 proposes refactoring this whole function and effectively makes the same change. Would you be able to test this to see if it helps your uses case?

In D51552#1227791, @rnk wrote:

I looked at the documentation for the cmake install command, but I still have no idea what a component is or what effect this option has. Can you elaborate on that?

Component here is named portion of installed files. We need finer grain control over installation process (specifically need to be able to install just LLVMgold.so):
cmake -DCOMPONENT=LLVMgold -P cmake_install.cmake
Now it falls into Unspecified component name with tons of other stuff.

D51748 proposes refactoring this whole function and effectively makes the same change. Would you be able to test this to see if it helps your uses case?

Unfortunately the patch "as is" failed at makefiles generation (cmake -G "Unix Makefiles" ...) with number of error messages like one below:
CMake Error at cmake/modules/LLVM-Config.cmake:105 (target_link_libraries):

Target "LLVMHello" of type MODULE_LIBRARY may not be linked into another
target.  One may link only to STATIC or SHARED libraries, or to executables
with the ENABLE_EXPORTS property set.

Call Stack (most recent call first):

cmake/modules/LLVM-Config.cmake:93 (explicit_llvm_config)
cmake/modules/AddLLVM.cmake:750 (llvm_config)
cmake/modules/AddLLVM.cmake:887 (add_llvm_executable)
examples/Kaleidoscope/CMakeLists.txt:6 (add_llvm_example)
examples/Kaleidoscope/Chapter8/CMakeLists.txt:5 (add_kaleidoscope_chapter)

What CMake arguments were you using?

What CMake arguments were you using?

cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_INSTALL_PREFIX="/your/install/dir" "/local/ll.org/source/root/llvm"

$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
$ uname -sr
Linux 3.10.0-327.el7.x86_64

I've just updated the patch with some fixes, can you try again?

I've just updated the patch with some fixes, can you try again?

The latest patch version seems to work fine. Thanks!
May suggest you to not guard against creating install target for MODULE? (if it does not create any problem)

if (NOT CMAKE_CONFIGURATION_TYPES)
  add_llvm_install_targets(install-${name}
                           DEPENDS ${name}
                           COMPONENT ${name})
endif()

Updated. If you have any more feedback you can leave it on the review for the other patch.

vdmitrie abandoned this revision.Dec 21 2018, 2:58 PM

Abandoned as issue was fixed with D51748