[llvm] r287207 - [CMake] [Darwin] Add support for debugging tablegen dependencies

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 17:25:50 PST 2016


I'm working through fixing all the issues, but the intention behind the patch was that it wasn't enabled by default. I haven't seen any bots failing, Can you give me your CMake command so I can reproduce your failure?

-Chris

> On Nov 18, 2016, at 4:52 PM, Eric Fiselier <eric at efcs.ca> wrote:
> 
> This patch broke building Clang out-of-tree for me. Exactly for the reason the commit says, CMake now errors because of a missing intrinsics_gen target.
> Is this behavior expected? Is there a plan to fix this?
> 
> 
> @@ -645,9 +647,11 @@ endmacro(add_llvm_loadable_module name)
> 
>  macro(add_llvm_executable name)
> -  cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "" ${ARGN})
> +  cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "DEPENDS" ${ARGN})
>    llvm_process_sources( ALL_FILES ${ARG_UNPARSED_ARGUMENTS} )
> +  list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS})
>  
> FYI this is the line that causes the breakage.
>  
> 
> On Wed, Nov 16, 2016 at 9:36 PM, Chris Bieneman via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> Author: cbieneman
> Date: Wed Nov 16 22:36:59 2016
> New Revision: 287207
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=287207&view=rev <http://llvm.org/viewvc/llvm-project?rev=287207&view=rev>
> Log:
> [CMake] [Darwin] Add support for debugging tablegen dependencies
> 
> This patch adds an option to the build system LLVM_DEPENDENCY_DEBUGGING. Over time I plan to extend this to do more complex verifications, but the initial patch causes compile errors wherever there is missing a dependency on intrinsics_gen.
> 
> Because intrinsics_gen is a compile-time dependency not a link-time dependency, everything that relies on the headers generated in intrinsics_gen needs an explicit dependency.
> 
> Modified:
>     llvm/trunk/CMakeLists.txt
>     llvm/trunk/cmake/modules/AddLLVM.cmake
> 
> Modified: llvm/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=287207&r1=287206&r2=287207&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=287207&r1=287206&r2=287207&view=diff>
> ==============================================================================
> --- llvm/trunk/CMakeLists.txt (original)
> +++ llvm/trunk/CMakeLists.txt Wed Nov 16 22:36:59 2016
> @@ -151,6 +151,20 @@ if(LLVM_CCACHE_BUILD)
>    endif()
>  endif()
> 
> +option(LLVM_DEPENDENCY_DEBUGGING "Dependency debugging mode to verify correctly expressed library dependencies (Darwin only)" OFF)
> +
> +# Some features of the LLVM build may be disallowed when dependency debugging is
> +# enabled. In particular you cannot use ccache because we want to force compile
> +# operations to always happen.
> +if(LLVM_DEPENDENCY_DEBUGGING)
> +  if(NOT CMAKE_HOST_APPLE)
> +    message(FATAL_ERROR "Dependency debugging is only currently supported on Darwin hosts.")
> +  endif()
> +  if(LLVM_CCACHE_BUILD)
> +    message(FATAL_ERROR "Cannot enable dependency debugging while using ccache.")
> +  endif()
> +endif()
> +
>  option(LLVM_BUILD_GLOBAL_ISEL "Experimental: Build GlobalISel" OFF)
>  if(LLVM_BUILD_GLOBAL_ISEL)
>    add_definitions(-DLLVM_BUILD_GLOBAL_ISEL)
> 
> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=287207&r1=287206&r2=287207&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=287207&r1=287206&r2=287207&view=diff>
> ==============================================================================
> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Wed Nov 16 22:36:59 2016
> @@ -377,6 +377,8 @@ function(llvm_add_library name)
>      endif()
>    endif()
> 
> +  setup_dependency_debugging(${name} ${LLVM_COMMON_DEPENDS})
> +
>    # Generate objlib
>    if((ARG_SHARED AND ARG_STATIC) OR ARG_OBJECT)
>      # Generate an obj library for both targets.
> @@ -645,9 +647,11 @@ endmacro(add_llvm_loadable_module name)
> 
> 
>  macro(add_llvm_executable name)
> -  cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "" ${ARGN})
> +  cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "DEPENDS" ${ARGN})
>    llvm_process_sources( ALL_FILES ${ARG_UNPARSED_ARGUMENTS} )
> 
> +  list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS})
> +
>    # Generate objlib
>    if(LLVM_ENABLE_OBJLIB)
>      # Generate an obj library for both targets.
> @@ -669,6 +673,8 @@ macro(add_llvm_executable name)
>      list(APPEND ALL_FILES "${LLVM_MAIN_SRC_DIR}/cmake/dummy.cpp")
>    endif()
> 
> +  setup_dependency_debugging(${name} ${LLVM_COMMON_DEPENDS})
> +
>    if( EXCLUDE_FROM_ALL )
>      add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
>    else()
> @@ -1377,3 +1383,19 @@ function(llvm_setup_rpath name)
>                          INSTALL_RPATH "${_install_rpath}"
>                          ${_install_name_dir})
>  endfunction()
> +
> +function(setup_dependency_debugging name)
> +  if(NOT LLVM_DEPENDENCY_DEBUGGING)
> +    return()
> +  endif()
> +
> +  if("intrinsics_gen" IN_LIST ARGN)
> +    return()
> +  endif()
> +
> +  set(deny_attributes_gen "(deny file* (literal \"${LLVM_BINARY_DIR}/include/llvm/IR/Attributes.gen\"))")
> +  set(deny_intrinsics_gen "(deny file* (literal \"${LLVM_BINARY_DIR}/include/llvm/IR/Intrinsics.gen\"))")
> +
> +  set(sandbox_command "sandbox-exec -p '(version 1) (allow default) ${deny_attributes_gen} ${deny_intrinsics_gen}'")
> +  set_property(DIRECTORY PROPERTY RULE_LAUNCH_COMPILE ${sandbox_command})
> +endfunction()
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161118/7ab9f4f9/attachment.html>


More information about the llvm-commits mailing list