llvmPackages_git: 21.0.0-unstable-2025-04-13 -> 21.0.0-unstable-2025-… (#402436)

authored by Tristan Ross and committed by GitHub dbb15ebb 0b9349d3

+148 -3
+140
pkgs/development/compilers/llvm/21/llvm/gnu-install-dirs.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index 73c4fc14f031..42284703a52c 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -1153,9 +1153,9 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "") 6 + add_subdirectory(${TENSORFLOW_AOT_PATH}/xla_aot_runtime_src 7 + ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime) 8 + install(TARGETS tf_xla_runtime EXPORT LLVMExports 9 + - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime) 10 + + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime) 11 + install(TARGETS tf_xla_runtime EXPORT LLVMDevelopmentExports 12 + - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime) 13 + + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime) 14 + set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS tf_xla_runtime) 15 + # Once we add more modules, we should handle this more automatically. 16 + if (DEFINED LLVM_OVERRIDE_MODEL_HEADER_INLINERSIZEMODEL) 17 + diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake 18 + index 52bf7ca0906a..ba2f4be17f08 100644 19 + --- a/cmake/modules/AddLLVM.cmake 20 + +++ b/cmake/modules/AddLLVM.cmake 21 + @@ -974,8 +974,8 @@ macro(add_llvm_library name) 22 + endif() 23 + install(TARGETS ${name} 24 + ${export_to_llvmexports} 25 + - LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} 26 + - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} 27 + + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} 28 + + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} 29 + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name}) 30 + 31 + if (NOT LLVM_ENABLE_IDE) 32 + @@ -2258,7 +2258,7 @@ function(llvm_install_library_symlink name dest type) 33 + set(LLVM_LINK_OR_COPY copy) 34 + endif() 35 + 36 + - set(output_dir lib${LLVM_LIBDIR_SUFFIX}) 37 + + set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) 38 + if((WIN32 OR CYGWIN) AND "${type}" STREQUAL "SHARED") 39 + set(output_dir "${CMAKE_INSTALL_BINDIR}") 40 + endif() 41 + @@ -2534,16 +2534,37 @@ function(llvm_setup_rpath name) 42 + 43 + if (APPLE) 44 + set(_install_name_dir INSTALL_NAME_DIR "@rpath") 45 + - set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) 46 + + set(_install_rpath ${extra_libdir}) 47 + elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND BUILD_SHARED_LIBS) 48 + # $ORIGIN is not interpreted at link time by aix ld. 49 + # Since BUILD_SHARED_LIBS is only recommended for use by developers, 50 + # hardcode the rpath to build/install lib dir first in this mode. 51 + # FIXME: update this when there is better solution. 52 + - set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) 53 + + set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) 54 + elseif(UNIX) 55 + + # Note that we add `extra_libdir` (aka `LLVM_LIBRARY_DIR` in our case) back 56 + + # to `_install_rpath` here. 57 + + # 58 + + # In nixpkgs we do not build and install LLVM alongside rdeps of LLVM (i.e. 59 + + # clang); instead LLVM is its own package and thus lands at its own nix 60 + + # store path. This makes it so that the default relative rpath (`../lib/`) 61 + + # does not point at the LLVM shared objects. 62 + + # 63 + + # More discussion here: 64 + + # - https://github.com/NixOS/nixpkgs/pull/235624#discussion_r1220150329 65 + + # - https://reviews.llvm.org/D146918 (16.0.5+) 66 + + # 67 + + # Note that we leave `extra_libdir` in `_build_rpath`: without FHS there is 68 + + # no potential that this will result in us pulling in the "wrong" LLVM. 69 + + # Adding this to the build rpath means we aren't forced to use 70 + + # `installCheckPhase` instead of `checkPhase` (i.e. binaries in the build 71 + + # dir, pre-install, will have the right rpath for LLVM). 72 + + # 73 + + # As noted in the differential above, an alternative solution is to have 74 + + # all rdeps of nixpkgs' LLVM (that use the AddLLVM.cmake machinery) set 75 + + # `CMAKE_INSTALL_RPATH`. 76 + set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) 77 + - set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}") 78 + + set(_install_rpath ${extra_libdir}) 79 + if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") 80 + set_property(TARGET ${name} APPEND_STRING PROPERTY 81 + LINK_FLAGS " -Wl,-z,origin ") 82 + diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake 83 + index 2d9116b08a52..2dd7cad4ec66 100644 84 + --- a/cmake/modules/AddOCaml.cmake 85 + +++ b/cmake/modules/AddOCaml.cmake 86 + @@ -147,9 +147,9 @@ function(add_ocaml_library name) 87 + endforeach() 88 + 89 + if( APPLE ) 90 + - set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}") 91 + + set(ocaml_rpath ${LLVM_LIBRARY_DIR}) 92 + elseif( UNIX ) 93 + - set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}") 94 + + set(ocaml_rpath ${LLVM_LIBRARY_DIR}) 95 + endif() 96 + list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}") 97 + 98 + diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt 99 + index ef4cfa3acdb5..7478e157a7c2 100644 100 + --- a/cmake/modules/CMakeLists.txt 101 + +++ b/cmake/modules/CMakeLists.txt 102 + @@ -130,7 +130,7 @@ set(LLVM_CONFIG_INCLUDE_DIRS 103 + ) 104 + list(REMOVE_DUPLICATES LLVM_CONFIG_INCLUDE_DIRS) 105 + 106 + -extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "lib\${LLVM_LIBDIR_SUFFIX}") 107 + +extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}") 108 + set(LLVM_CONFIG_LIBRARY_DIRS 109 + "${LLVM_CONFIG_LIBRARY_DIR}" 110 + # FIXME: Should there be other entries here? 111 + diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in 112 + index e4e1d449bf4d..3aab6ea7bf8b 100644 113 + --- a/tools/llvm-config/BuildVariables.inc.in 114 + +++ b/tools/llvm-config/BuildVariables.inc.in 115 + @@ -23,6 +23,7 @@ 116 + #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@" 117 + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" 118 + #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@" 119 + +#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@" 120 + #define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@" 121 + #define LLVM_INSTALL_PACKAGE_DIR "@LLVM_INSTALL_PACKAGE_DIR@" 122 + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" 123 + diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp 124 + index 49df8fdcb7f7..c7cb05b82821 100644 125 + --- a/tools/llvm-config/llvm-config.cpp 126 + +++ b/tools/llvm-config/llvm-config.cpp 127 + @@ -365,7 +365,11 @@ int main(int argc, char **argv) { 128 + sys::fs::make_absolute(ActivePrefix, Path); 129 + ActiveBinDir = std::string(Path); 130 + } 131 + - ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; 132 + + { 133 + + SmallString<256> Path(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX); 134 + + sys::fs::make_absolute(ActivePrefix, Path); 135 + + ActiveLibDir = std::string(Path); 136 + + } 137 + { 138 + SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR); 139 + sys::fs::make_absolute(ActivePrefix, Path); 140 +
+5
pkgs/development/compilers/llvm/common/patches.nix
··· 49 49 ]; 50 50 "llvm/gnu-install-dirs.patch" = [ 51 51 { 52 + after = "21"; 53 + path = ../21; 54 + } 55 + { 52 56 after = "20"; 57 + before = "21"; 53 58 path = ../20; 54 59 } 55 60 {
+3 -3
pkgs/development/compilers/llvm/default.nix
··· 33 33 "19.1.7".officialRelease.sha256 = "sha256-cZAB5vZjeTsXt9QHbP5xluWNQnAHByHtHnAhVDV0E6I="; 34 34 "20.1.3".officialRelease.sha256 = "sha256-sOl90iRBlD+DGJs72JrP9cJz6XmWs/5PL+uW4nt6LA0="; 35 35 "21.0.0-git".gitRelease = { 36 - rev = "ebba554a3211b0b98d3ae33ba70f9d6ceaab6ad4"; 37 - rev-version = "21.0.0-unstable-2025-04-13"; 38 - sha256 = "sha256-8LcHMrbt9qlwqbHrv1rwYI3ZC1Y5POHzx5HgyciTPuY="; 36 + rev = "ed95624e208e5bf7c3eeadfccee0fb6060a4ca98"; 37 + rev-version = "21.0.0-unstable-2025-04-27"; 38 + sha256 = "sha256-L7H/+V+rdhddNLPEbn9h4cRy+ioxUYxuMMhvORB5Q6s="; 39 39 }; 40 40 } // llvmVersions; 41 41