Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Apr 2023 00:32:34 GMT
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 576c2c36a813 - main - science/py-tensorflow: Unbreak build
Message-ID:  <202304010032.3310WYhi035924@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=576c2c36a8135b6162c4b644e49f9bd3a1d4e925

commit 576c2c36a8135b6162c4b644e49f9bd3a1d4e925
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-04-01 00:29:09 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-04-01 00:32:32 +0000

    science/py-tensorflow: Unbreak build
    
    PR:             270411
    Submitted by:   Ivan <ivan@drm.su>, Matthieu Volat <mazhe@alkumuna.eu>
    Approved by:    portmgr (unbreak)
---
 science/py-tensorflow/Makefile                     | 14 +++++++-----
 .../files/freebsd/cc_toolchain_config.bzl          |  9 ++++----
 science/py-tensorflow/files/patch-tensorflow_BUILD | 19 +++++++++++-----
 .../files/patch-tensorflow_java_BUILD              | 10 +++++++++
 .../files/patch-tensorflow_lite_BUILD              | 10 +++++++++
 .../files/patch-tensorflow_lite_build_def.bzl      | 10 +++++++++
 .../files/patch-tensorflow_lite_c_BUILD            | 10 +++++++++
 ...ch-tensorflow_lite_delegates_flex_build_def.bzl | 10 +++++++++
 ...sorflow_lite_delegates_hexagon_hexagon_nn_BUILD | 10 +++++++++
 .../files/patch-tensorflow_tensorflow.bzl          | 26 ++++++++++++++++++++++
 ...atch-tensorflow_tf_framework_version_script.lds | 12 ++++++++++
 11 files changed, 126 insertions(+), 14 deletions(-)

diff --git a/science/py-tensorflow/Makefile b/science/py-tensorflow/Makefile
index 9ce172c4d312..6fc13c34f3a8 100644
--- a/science/py-tensorflow/Makefile
+++ b/science/py-tensorflow/Makefile
@@ -22,8 +22,7 @@ BUILD_DEPENDS=	${RUN_DEPENDS} \
 		cython:lang/cython \
 		swig:devel/swig \
 		bazel:devel/bazel \
-		git:devel/git \
-		clang-devel:devel/llvm-devel
+		git:devel/git
 LIB_DEPENDS=	libnsync.so:devel/nsync \
 		libgpr.so:devel/grpc \
 		libpng.so:graphics/png \
@@ -61,12 +60,13 @@ RUN_DEPENDS=	pybind11>=2.6.2:devel/pybind11 \
 		${PYTHON_PKGNAMEPREFIX}packaging>=21.3:devel/py-packaging@${PY_FLAVOR} \
 		pybind11>=2.6.2:devel/pybind11
 
-USES=		python:3.7+ shebangfix jpeg ssl
+USES=		jpeg llvm:min=16,max=16 python:3.7+ shebangfix ssl
 USE_CXXSTD=     c++17
-SHEBANG_GLOB=	*.py
 USE_GITHUB=	yes
 USE_PYTHON=	distutils
 
+SHEBANG_GLOB=	*.py
+
 BAZEL_BOOT=	--output_user_root=${WRKDIR}/bazel_out
 
 PLIST_SUB=	TF_PORT_VERSION=${PORTVERSION}
@@ -138,7 +138,11 @@ post-patch:
 
 	@${REINPLACE_CMD} "s#%%PYTHON%%#${PYTHON_CMD}#" ${WRKSRC}/.bazelrc
 
-	@${REINPLACE_CMD} "s#%%LOCALBASE%%#${LOCALBASE}#" ${WRKDIR}/bazelrc \
+	@${REINPLACE_CMD} \
+		-e "s#%%LOCALBASE%%#${LOCALBASE}#" \
+		-e "s#%%LLVM_PREFIX%%#${LLVM_PREFIX}#g" \
+		-e "s#%%LLVM_VERSION%%#${LLVM_VERSION}#g" \
+		${WRKDIR}/bazelrc \
 		${WRKSRC}/third_party/absl/system.absl.strings.BUILD \
 		${WRKSRC}/freebsd/cc_toolchain_config.bzl \
 		${WRKSRC}/.bazelrc \
diff --git a/science/py-tensorflow/files/freebsd/cc_toolchain_config.bzl b/science/py-tensorflow/files/freebsd/cc_toolchain_config.bzl
index 38d7f122209c..ce3def7dfd66 100644
--- a/science/py-tensorflow/files/freebsd/cc_toolchain_config.bzl
+++ b/science/py-tensorflow/files/freebsd/cc_toolchain_config.bzl
@@ -75,6 +75,7 @@ def _impl(ctx):
                     flag_group(
                         flags = [
                             "-Wl,-undefined,dynamic_lookup",
+                            "-Wl,--undefined-version",
                             "-lc++",
                             "-Wl,-z,relro,-z,now",
                             "-no-canonical-prefixes",
@@ -225,17 +226,17 @@ def _impl(ctx):
     else:
         features = [supports_dynamic_linker_feature, supports_pic_feature]
     if (is_bsd):
-        cxx_builtin_include_directories = ["/usr/local/llvm-devel/lib/clang/16.0.0", "/usr/include/c++/v1", "/usr/local/include", "/usr/include"]
+        cxx_builtin_include_directories = ["%%LLVM_PREFIX%%/lib/clang/%%LLVM_VERSION%%.0.0", "%%LLVM_PREFIX%%/lib/clang/%%LLVM_VERSION%%/include", "/usr/include/c++/v1", "/usr/local/include", "/usr/include"]
     else:
         cxx_builtin_include_directories = []
     if is_bsd:
         tool_paths = [
             tool_path(name = "ar", path = "/usr/bin/ar"),
-            tool_path(name = "cpp", path = "/usr/local/llvm-devel/bin/clang-cpp"),
+            tool_path(name = "cpp", path = "%%LLVM_PREFIX%%/bin/clang-cpp"),
             tool_path(name = "dwp", path = "/usr/bin/dwp"),
-            tool_path(name = "gcc", path = "/usr/local/llvm-devel/bin/clang-16"),
+            tool_path(name = "gcc", path = "%%LLVM_PREFIX%%/bin/clang-%%LLVM_VERSION%%"),
             tool_path(name = "gcov", path = "/usr/bin/gcov"),
-            tool_path(name = "ld", path = "/usr/local/llvm-devel/bin/ld"),
+            tool_path(name = "ld", path = "%%LLVM_PREFIX%%/bin/ld"),
             tool_path(name = "nm", path = "/usr/bin/nm"),
             tool_path(name = "objcopy", path = "/usr/bin/objcopy"),
             tool_path(name = "objdump", path = "/usr/bin/objdump"),
diff --git a/science/py-tensorflow/files/patch-tensorflow_BUILD b/science/py-tensorflow/files/patch-tensorflow_BUILD
index b9e955ed7a67..1dfdce1c7da7 100644
--- a/science/py-tensorflow/files/patch-tensorflow_BUILD
+++ b/science/py-tensorflow/files/patch-tensorflow_BUILD
@@ -1,22 +1,31 @@
---- tensorflow/BUILD.orig	2022-05-22 22:28:22 UTC
-+++ tensorflow/BUILD
-@@ -938,8 +938,10 @@ tf_cc_shared_object(
+--- tensorflow/BUILD.orig	2022-05-23 00:28:22.000000000 +0200
++++ tensorflow/BUILD	2023-03-30 17:47:04.211287000 +0200
+@@ -938,8 +938,11 @@
          ],
          "//tensorflow:windows": [],
          "//tensorflow:freebsd": [
 +            "-Wl,--unresolved-symbols=ignore-all",
++            "-Wl,--undefined-version",
              "-Wl,--version-script,$(location //tensorflow:tf_framework_version_script.lds)",
              "-lexecinfo",
 +            "-L/usr/local/lib",
          ],
          "//conditions:default": [
              "-Wl,--version-script,$(location //tensorflow:tf_framework_version_script.lds)",
-@@ -1021,7 +1023,7 @@ tf_cc_shared_object(
+@@ -1021,7 +1024,7 @@
          # copybara:uncomment_end
          "//conditions:default": [
              "-z defs",
 -            "-Wl,--version-script,$(location //tensorflow/c:version_script.lds)",
-+            "-L/lib,-L/usr/lib,--unresolved-symbols=ignore-all,-Wl,--version-script,$(location //tensorflow/c:version_script.lds)",
++            "-L/lib,-L/usr/lib,--unresolved-symbols=ignore-all,-Wl,--undefined-version,-Wl,--version-script,$(location //tensorflow/c:version_script.lds)",
          ],
      }),
      per_os_targets = True,
+@@ -1054,6 +1057,7 @@
+         "//tensorflow:windows": [],
+         "//conditions:default": [
+             "-z defs",
++            "-Wl,--undefined-version",
+             "-Wl,--version-script,$(location //tensorflow:tf_version_script.lds)",
+         ],
+     }),
diff --git a/science/py-tensorflow/files/patch-tensorflow_java_BUILD b/science/py-tensorflow/files/patch-tensorflow_java_BUILD
new file mode 100644
index 000000000000..33b7db687b88
--- /dev/null
+++ b/science/py-tensorflow/files/patch-tensorflow_java_BUILD
@@ -0,0 +1,10 @@
+--- tensorflow/java/BUILD.orig	2023-03-30 17:51:23.641040000 +0200
++++ tensorflow/java/BUILD	2023-03-30 17:51:34.802406000 +0200
+@@ -446,6 +446,7 @@
+         "//tensorflow:windows": [],
+         "//conditions:default": [
+             "-z defs",
++            "-Wl,--undefined-version",
+             "-s",
+             "-Wl,--version-script,$(location {})".format(LINKER_VERSION_SCRIPT),
+         ],
diff --git a/science/py-tensorflow/files/patch-tensorflow_lite_BUILD b/science/py-tensorflow/files/patch-tensorflow_lite_BUILD
new file mode 100644
index 000000000000..8d54d284e506
--- /dev/null
+++ b/science/py-tensorflow/files/patch-tensorflow_lite_BUILD
@@ -0,0 +1,10 @@
+--- tensorflow/lite/BUILD.orig	2023-03-30 18:04:54.206396000 +0200
++++ tensorflow/lite/BUILD	2023-03-30 18:04:24.422539000 +0200
+@@ -1204,6 +1204,7 @@
+         "//tensorflow:windows": [],
+         "//conditions:default": [
+             "-Wl,-z,defs",
++            "-Wl,--undefined-version",
+             "-Wl,--version-script,$(location //tensorflow/lite:tflite_version_script.lds)",
+         ],
+     }),
diff --git a/science/py-tensorflow/files/patch-tensorflow_lite_build_def.bzl b/science/py-tensorflow/files/patch-tensorflow_lite_build_def.bzl
new file mode 100644
index 000000000000..58d62b5e5dd5
--- /dev/null
+++ b/science/py-tensorflow/files/patch-tensorflow_lite_build_def.bzl
@@ -0,0 +1,10 @@
+--- tensorflow/lite/build_def.bzl.orig	2023-03-30 17:56:40.338369000 +0200
++++ tensorflow/lite/build_def.bzl	2023-03-30 17:56:50.244995000 +0200
+@@ -172,6 +172,7 @@
+         ],
+         clean_dep("//tensorflow:windows"): [],
+         "//conditions:default": [
++            "-Wl,--undefined-version",
+             "-Wl,--version-script,$(location {})".format(linkscript),
+             "-Wl,-soname," + name,
+         ],
diff --git a/science/py-tensorflow/files/patch-tensorflow_lite_c_BUILD b/science/py-tensorflow/files/patch-tensorflow_lite_c_BUILD
new file mode 100644
index 000000000000..c88f9a6c9aa4
--- /dev/null
+++ b/science/py-tensorflow/files/patch-tensorflow_lite_c_BUILD
@@ -0,0 +1,10 @@
+--- tensorflow/lite/c/BUILD.orig	2023-03-30 18:05:35.316884000 +0200
++++ tensorflow/lite/c/BUILD	2023-03-30 18:05:48.639862000 +0200
+@@ -29,6 +29,7 @@
+         "//tensorflow:windows": [],
+         "//conditions:default": [
+             "-z defs",
++            "-Wl,--undefined-version",
+             "-Wl,--version-script,$(location //tensorflow/lite/c:version_script.lds)",
+         ],
+     }),
diff --git a/science/py-tensorflow/files/patch-tensorflow_lite_delegates_flex_build_def.bzl b/science/py-tensorflow/files/patch-tensorflow_lite_delegates_flex_build_def.bzl
new file mode 100644
index 000000000000..9b207ba77c9d
--- /dev/null
+++ b/science/py-tensorflow/files/patch-tensorflow_lite_delegates_flex_build_def.bzl
@@ -0,0 +1,10 @@
+--- tensorflow/lite/delegates/flex/build_def.bzl.orig	2023-03-30 17:57:26.322444000 +0200
++++ tensorflow/lite/delegates/flex/build_def.bzl	2023-03-30 17:58:45.005163000 +0200
+@@ -223,6 +223,7 @@
+             "//tensorflow:windows": [],
+             "//conditions:default": [
+                 "-Wl,-z,defs",
++                "-Wl,--undefined-version",
+                 "-Wl,--version-script,$(location //tensorflow/lite/delegates/flex:version_script.lds)",
+             ],
+         }),
diff --git a/science/py-tensorflow/files/patch-tensorflow_lite_delegates_hexagon_hexagon_nn_BUILD b/science/py-tensorflow/files/patch-tensorflow_lite_delegates_hexagon_hexagon_nn_BUILD
new file mode 100644
index 000000000000..010da725e1f8
--- /dev/null
+++ b/science/py-tensorflow/files/patch-tensorflow_lite_delegates_hexagon_hexagon_nn_BUILD
@@ -0,0 +1,10 @@
+--- tensorflow/lite/delegates/hexagon/hexagon_nn/BUILD.orig	2023-03-30 17:50:25.801299000 +0200
++++ tensorflow/lite/delegates/hexagon/hexagon_nn/BUILD	2023-03-30 17:50:38.457225000 +0200
+@@ -76,6 +76,7 @@
+     name = "libhexagon_interface.so",
+     linkopts = [
+         "-Wl,-soname=libhexagon_interface.so",
++        "-Wl,--undefined-version",
+         "-z defs",
+         "-Wl,--version-script,$(location //tensorflow/lite/delegates/hexagon/hexagon_nn:version_scripts.lds)",
+     ] + select({
diff --git a/science/py-tensorflow/files/patch-tensorflow_tensorflow.bzl b/science/py-tensorflow/files/patch-tensorflow_tensorflow.bzl
new file mode 100644
index 000000000000..a630a8fa1d09
--- /dev/null
+++ b/science/py-tensorflow/files/patch-tensorflow_tensorflow.bzl
@@ -0,0 +1,26 @@
+--- tensorflow/tensorflow.bzl.orig	2023-03-30 17:54:35.641567000 +0200
++++ tensorflow/tensorflow.bzl	2023-03-30 17:56:12.747346000 +0200
+@@ -2305,6 +2305,7 @@
+         ],
+         clean_dep("//tensorflow:windows"): [],
+         "//conditions:default": [
++            "-Wl,--undefined-version",
+             "-Wl,--version-script",
+             "$(location %s.lds)" % vscriptname,
+         ],
+@@ -2975,6 +2976,7 @@
+                     "/ignore:4070",
+                 ] if win_def_file else [],
+                 "//conditions:default": [
++                    "-Wl,--undefined-version",
+                     "-Wl,--version-script",
+                     "$(location %s)" % version_script_file,
+                 ],
+@@ -3035,6 +3037,7 @@
+                 ],
+                 clean_dep("//tensorflow:windows"): [],
+                 "//conditions:default": [
++                    "-Wl,--undefined-version",
+                     "-Wl,--version-script",
+                     "$(location %s)" % version_script_file,
+                 ],
diff --git a/science/py-tensorflow/files/patch-tensorflow_tf_framework_version_script.lds b/science/py-tensorflow/files/patch-tensorflow_tf_framework_version_script.lds
new file mode 100644
index 000000000000..890e1456b9ba
--- /dev/null
+++ b/science/py-tensorflow/files/patch-tensorflow_tf_framework_version_script.lds
@@ -0,0 +1,12 @@
+--- tensorflow/tf_framework_version_script.lds.orig	2023-03-30 17:42:11.255357000 +0200
++++ tensorflow/tf_framework_version_script.lds	2023-03-30 17:42:18.431845000 +0200
+@@ -3,9 +3,6 @@
+   local:
+     jpeg_*;
+     jinit_*;
+-    jdiv_round_up;
+-    jround_up;
+-    jzero_far;
+     jcopy_*;
+     jsimd_*;
+     hwloc_*;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304010032.3310WYhi035924>