pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

rust: reverse the change in LLVM which created the $ORIGIN issue.



Module Name:	pkgsrc-wip
Committed By:	Havard Eidnes <he%NetBSD.org@localhost>
Pushed By:	he
Date:		Sat Jul 22 17:20:52 2023 +0000
Changeset:	ce49c419d8725d7ce84ae99d193f5c4c424fd0d5

Modified Files:
	rust/distinfo
	rust/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
Removed Files:
	rust/TODO

Log Message:
rust: reverse the change in LLVM which created the $ORIGIN issue.

This restores our ability to cross-build inside pkgsrc.
The $ORIGIN handling is problematical because cwrappers
interferes with its use.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=ce49c419d8725d7ce84ae99d193f5c4c424fd0d5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 rust/TODO                                          | 59 ----------------------
 rust/distinfo                                      |  2 +-
 ...c_llvm-project_llvm_cmake_modules_AddLLVM.cmake | 38 +++++++++++++-
 3 files changed, 37 insertions(+), 62 deletions(-)

diffs:
diff --git a/rust/TODO b/rust/TODO
deleted file mode 100644
index 2427731e71..0000000000
--- a/rust/TODO
+++ /dev/null
@@ -1,59 +0,0 @@
-Sort out cross compilation issues, which build the internal LLVM.
-This currently fails with
-
--- Installing: /usr/pkgsrc/wip/rust/work/rustc-1.71.0-src/build/x86_64-unknown-netbsd/llvm/bin/llvm-tblgen
-CMake Error at utils/TableGen/cmake_install.cmake:50 (file):
-  file RPATH_CHANGE could not write new RPATH:
-
-    $ORIGIN/../lib
-
-  to the file:
-
-    /usr/pkgsrc/wip/rust/work/rustc-1.71.0-src/build/x86_64-unknown-netbsd/llvm/bin/llvm-tblgen
-
-  The current RPATH is:
-
-    /usr/pkg/lib
-
-  which does not contain:
-
-    $ORIGIN/../lib:
-
-  as was expected.
-Call Stack (most recent call first):
-  cmake_install.cmake:63 (include)
-
-I suspect we are running afoul of cwrapper, which tends to drop arguments
-which contains relative paths.  work/.work.log has as the two last entries
-
-[*] c++ -O2 ... -o ../../bin/llvm-reduce '-Wl,-rpath,$ORIGIN/../lib:'
-
-while the last line has
-
-<.> /usr/pkgsrc/wip/rust/work/.gcc/bin/g++ ... \
-	-o ../../bin/llvm-reduce ../../lib/libLLVMAArch64AsmParser.a ...
-
-i.e. the entry with $ORIGIN is dropped by cwrappers.
-
-This is evidently done by e.g.
-
-  if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/llvm-tblgen" AND
-     NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/llvm-tblgen")
-    file(RPATH_CHANGE
-         FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/llvm-tblgen"
-         OLD_RPATH "\$ORIGIN/../lib:"
-         NEW_RPATH "$ORIGIN/../lib")
-    if(CMAKE_INSTALL_DO_STRIP)
-      execute_process(COMMAND "/usr/pkgsrc/wip/rust/work/.tools/bin/strip" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/llvm-tblgen")
-    endif()
-  endif()
-
-which is replicate in lots of cmake_install.cmake files which have been
-dropped in the target build tree, i.e.
-
-work/rustc-1.71.0-src/build/x86_64-unknown-netbsd/llvm/build/...
-
-In all there are some 80 files mentioning RPATH_CHANGE.
-
-It is not self-evident where this is coming from, it looks like
-the cmake_install.cmake files are automatically generated.
diff --git a/rust/distinfo b/rust/distinfo
index d6504e54ec..cda092baf6 100644
--- a/rust/distinfo
+++ b/rust/distinfo
@@ -141,7 +141,7 @@ SHA1 (patch-src_bootstrap_compile.rs) = 71b58c0e14b820dafc48ce087292267e7d2eed0f
 SHA1 (patch-src_bootstrap_lib.rs) = f6918e0939b6fe63ae9b524d4c809375149efb15
 SHA1 (patch-src_bootstrap_llvm.rs) = 49cbd9c695bd1f6c635300490e69baefcc80323c
 SHA1 (patch-src_llvm-project_llvm_CMakeLists.txt) = 7abfabb6ec70df229a69355f8c76825610165c37
-SHA1 (patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake) = 67de0d9fc105ef7ea7a0d96fa25fc779c2b89024
+SHA1 (patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake) = e1b2eb2f0b3cf1cf87b443656ae306b3242f6b12
 SHA1 (patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h) = cb011fc19957883c01725797f7c85ed1b20f96f1
 SHA1 (patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h) = 39d76e6659143d154ae690ac70781b698a2023d8
 SHA1 (patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h) = 67e93f198258a5b59580be20ff47ce58b146c5d5
diff --git a/rust/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake b/rust/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
index 5f0c06e437..b213c40364 100644
--- a/rust/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
+++ b/rust/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
@@ -2,9 +2,14 @@ $NetBSD: patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake,v 1.3 2020/08/0
 
 On Darwin, use correct install-name for shared libraries.
 
---- src/llvm-project/llvm/cmake/modules/AddLLVM.cmake.orig	2020-09-22 17:14:20.000000000 +0000
+Undo some of the RPATH magic so that cross-building
+works inside pkgsrc again (indirectly eliminates $ORIGIN rpath
+handling / editing, $ORIGIN handling is partially undone by cwrappers
+in pkgsrc).
+
+--- src/llvm-project/llvm/cmake/modules/AddLLVM.cmake.orig	2023-07-12 03:33:01.000000000 +0000
 +++ src/llvm-project/llvm/cmake/modules/AddLLVM.cmake
-@@ -2117,7 +2117,7 @@ function(llvm_setup_rpath name)
+@@ -2311,7 +2311,7 @@ function(llvm_setup_rpath name)
    endif()
  
    if (APPLE)
@@ -13,3 +18,32 @@ On Darwin, use correct install-name for shared libraries.
      set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
    elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND BUILD_SHARED_LIBS)
      # $ORIGIN is not interpreted at link time by aix ld.
+@@ -2320,8 +2320,7 @@ function(llvm_setup_rpath name)
+     # FIXME: update this when there is better solution.
+     set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+   elseif(UNIX)
+-    set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+-    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}")
++    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+     if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+       set_property(TARGET ${name} APPEND_STRING PROPERTY
+                    LINK_FLAGS " -Wl,-z,origin ")
+@@ -2335,16 +2334,9 @@ function(llvm_setup_rpath name)
+     return()
+   endif()
+ 
+-  # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set and not
+-  # building for macOS or AIX, as those platforms seemingly require it.
+-  # On AIX, the tool chain doesn't support modifying rpaths/libpaths for XCOFF
+-  # on install at the moment, so BUILD_WITH_INSTALL_RPATH is required.
++  # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set.
+   if("${CMAKE_BUILD_RPATH}" STREQUAL "")
+-    if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|AIX")
+-      set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
+-    else()
+-      set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}")
+-    endif()
++    set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
+   endif()
+ 
+   set_target_properties(${name} PROPERTIES


Home | Main Index | Thread Index | Old Index