Re-add science/py-tensorflow: Computation using data flow graphs for scalable machine learning

Many thanks to Anthony who was highly persistent and skillful in getting the Tensorflow build on FreeBSD!

PR:		226400
Submitted by:	Anthony <amzo1337@gmail.com>
This commit is contained in:
Yuri Victorovich
2019-08-06 15:28:01 +00:00
parent 2ff81ff30f
commit 069ecdaf12
31 changed files with 731 additions and 1 deletions

1
MOVED
View File

@@ -10353,7 +10353,6 @@ security/shibboleth2-sp|security/shibboleth-sp|2018-08-07|Project updated to ver
security/opensaml2|security/opensaml|2018-08-07|Project updated to version 3, so the 2 suffix is not valid anymore
devel/lldb38|devel/llvm38|2018-08-08|METAPORT removed
lang/clang38|devel/llvm38|2018-08-08|METAPORT removed
science/py-tensorflow||2018-08-08|Has expired: build broken
devel/bazel-clang38|devel/bazel|2018-08-08|Slave port depends on obsolete LLVM version
security/libbeid|security/beid|2018-08-12|No longer just a library
editors/joe2|editors/joe|2018-08-12|Patches from editors/joe2 have been integrated into editors/joe

View File

@@ -279,6 +279,7 @@
SUBDIR += py-scipy
SUBDIR += py-scoria
SUBDIR += py-spglib
SUBDIR += py-tensorflow
SUBDIR += py-veusz
SUBDIR += py-ws2300
SUBDIR += pybrain

View File

@@ -0,0 +1,162 @@
# $FreeBSD$
PORTNAME= tensorflow
DISTVERSIONPREFIX= v
DISTVERSION= 1.14.0
CATEGORIES= science python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
DIST_SUBDIR= ${PORTNAME}
EXTRACT_ONLY= tensorflow-tensorflow-v1.14.0_GH0.tar.gz
MAINTAINER= amzo1337@gmail.com
COMMENT= Computation using data flow graphs for scalable machine learning
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
ONLY_FOR_ARCHS= amd64
BUILD_DEPENDS= ${RUN_DEPENDS} \
${PYTHON_PKGNAMEPREFIX}grpcio-tools>=1.22.0:devel/py-grpcio-tools@${PY_FLAVOR} \
bash:shells/bash \
cython:lang/cython \
swig3.0:devel/swig30 \
bazel:devel/bazel
LIB_DEPENDS= libsnappy.so:archivers/snappy \
liblmdb.so:databases/lmdb \
libsqlite3.so:databases/sqlite3 \
libicuio.so:devel/icu \
libjsoncpp.so:devel/jsoncpp \
libpcre.so:devel/pcre \
libnsync.so:devel/nsync \
libprotobuf.so:devel/protobuf \
libprotobuf-c.so:devel/protobuf-c \
libre2.so:devel/re2 \
libgif.so:graphics/giflib \
libpng.so:graphics/png \
libgpr.so:devel/grpc \
libcurl.so:ftp/curl \
libgoogle_cloud_cpp_common.so:devel/google-cloud-cpp \
libflatbuffers.so:devel/flatbuffers \
libdouble-conversion.so:devel/double-conversion
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}absl>=0.7.1:devel/py-absl@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}astor>=0.5:devel/py-astor@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}gast>=0.2.2:devel/py-gast@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}numpy>=1.11.2:math/py-numpy@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}google-pasta>=0.1.7:devel/py-google-pasta@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}protobuf>=3.7.1:devel/py-protobuf@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}six>=1.10.0:devel/py-six@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}termcolor>=1.1.0:devel/py-termcolor@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}grpcio>=1.22.0:devel/py-grpcio@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}keras>=2.2.4:math/py-keras@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}wrapt>=1.11.2:devel/py-wrapt@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}wheel>=0.30.0:devel/py-wheel@${PY_FLAVOR}
USES= python:3.6 shebangfix jpeg ssl
SHEBANG_GLOB= *.py
USE_GITHUB= yes
USE_PYTHON= distutils
OPTIONS_DEFINE= CPU_OPTS
CPU_OPTS_DESC= Enable CPU optimisations
BAZEL_BOOT= --output_user_root=${WRKDIR}/bazel_out
PLIST_SUB= TF_PORT_VERSION=${PORTVERSION}
.include "Makefile.MASTER_SITES"
.include <bsd.port.pre.mk>
.if !${PORT_OPTIONS:MCPU_OPTS}
CPU_TARGET=x86-64
.else
CPU_TARGET=native
.endif
post-patch:
# Set up a local repository with our pre-downloaded packages
# This prevents bazel downloading the files without modifying
# the bzl files.
@${MKDIR} ${WRKDIR}/bazel-cache
@${MKDIR} ${WRKDIR}/bazel-distdir
.for file in ${DISTFILES:C/\:(.*)//}
@${ECHO} "Moving ${file} to ${WRKDIR}/bazel-cache"
@${CP} ${DISTDIR}/${DIST_SUBDIR}/${file} ${WRKDIR}/bazel-distdir
.endfor
@cd ${WRKSRC} && \
${REINPLACE_CMD} "s#--batch#${BAZEL_BOOT}\', \'--batch#" \
configure.py
@${CP} ${PATCHDIR}/bazelrc ${WRKDIR}/bazelrc
@${REINPLACE_CMD} "s#%%BAZEL_DIR%%#${WRKDIR}#" ${WRKDIR}/bazelrc
@${REINPLACE_CMD} "s#%%BAZEL_DIST%%#${WRKDIR}#" ${WRKDIR}/bazelrc
@${REINPLACE_CMD} "s#%%LOCALBASE%%#${LOCALBASE}#" ${WRKDIR}/bazelrc \
${WRKSRC}/tensorflow/tensorflow.bzl ${WRKSRC}/.bazelrc \
${WRKSRC}/tensorflow/core/BUILD \
${WRKSRC}/third_party/systemlibs/protobuf.bzl
do-configure:
@cd ${WRKSRC} && ${SETENV} \
PYTHON_BIN_PATH=${PYTHON_CMD} \
PYTHON_LIB_PATH="${PYTHON_SITELIBDIR}" \
TF_NEED_JEMALLOC=0 \
TF_NEED_KAFKA=0 \
TF_NEED_OPENCL_SYCL=0 \
TF_NEED_AWS=0 \
TF_NEED_GCP=0 \
TF_NEED_HDFS=0 \
TF_NEED_S3=0 \
TF_ENABLE_XLA=0 \
TF_NEED_GDR=0 \
TF_NEED_VERBS=0 \
TF_NEED_OPENCL=0 \
TF_NEED_MPI=0 \
TF_NEED_TENSORRT=0 \
TF_NEED_NGRAPH=0 \
TF_NEED_IGNITE=0 \
TF_NEED_ROCM=0 \
TF_NEED_CUDA=0 \
TF_SET_ANDROID_WORKSPACE=0 \
TF_DOWNLOAD_CLANG=0 \
TF_NEED_NCCL=0 \
TF_NEED_OPENCL=0 \
TF_IGNORE_MAX_BAZEL_VERSION=1 \
CC_OPT_FLAGS="-march=${CPU_TARGET} -I${LOCALBASE}/include" \
PREFIX="${LOCALBASE}" \
TF_SYSTEM_LIBS="absl_py astor_archive boringssl com_github_googleapis_googleapis com_github_googlecloudplatform_google_cloud_cpp com_google_protobuf \
com_google_protobuf_cc com_googlesource_code_re2 curl cython double_conversion enum34_archive flatbuffers gast_archive gif_archive \
grpc hwloc icu jpeg jsoncpp_git keras_applications_archive lmdb nasm nsync org_sqlite pasta pcre png_archive protobuf_archive \
six_archive snappy swig termcolor_archive wrapt zlib_archive" \
./configure
do-build:
@cd ${WRKSRC} && \
bazel --bazelrc="${WRKDIR}/bazelrc" ${BAZEL_BOOT} build ${BAZEL_COPT} --host_copt="-I${LOCALBASE}/include" \
--host_linkopt="-L${LOCALBASE}/lib" --linkopt="-L${LOCALBASE}/lib" --config=opt \
--incompatible_no_support_tools_in_action_inputs=false \
--verbose_failures -s \
//tensorflow:libtensorflow.so \
//tensorflow:libtensorflow_cc.so \
//tensorflow:install_headers \
//tensorflow/tools/pip_package:build_pip_package
@cd ${WRKSRC} && ${SETENV} TMPDIR=${WRKDIR} \
bazel-bin/tensorflow/tools/pip_package/build_pip_package \
${WRKDIR}/whl
do-install:
@${MKDIR} ${STAGEDIR}/${PYTHON_SITELIBDIR}
@${MKDIR} ${WRKDIR}/tmp
@${UNZIP_NATIVE_CMD} -d ${WRKDIR}/tmp ${WRKDIR}/whl/${PORTNAME}-${PORTVERSION}-*.whl
@${FIND} ${WRKDIR}/tmp -name "*.so*" | ${XARGS} ${STRIP_CMD}
cd ${WRKDIR}/tmp && ${COPYTREE_SHARE} ${PORTNAME}-${PORTVERSION}.dist-info \
${STAGEDIR}${PYTHON_SITELIBDIR}
cd ${WRKDIR}/tmp/${PORTNAME}-${PORTVERSION}.data/purelib && \
${COPYTREE_SHARE} . ${STAGEDIR}${PYTHON_SITELIBDIR}
post-install: # autoplist: thousands of files, all under ${PYTHON_SITELIBDIR}
@cd ${STAGEDIR}${PREFIX} && \
${FIND} ${PYTHON_SITELIBDIR:C|^${LOCALBASE}/||} -type f -or -type l | grep -v "egg-info/" >> ${TMPPLIST}
.include <bsd.port.post.mk>

View File

@@ -0,0 +1,34 @@
# $FreeBSD$
DISTFILES+= v0.18.tar.gz:mkldnn \
daf381e8535a1f1f1b8a75966a74e7cca63dee89.tar.gz:abseil \
a0d250e79c79.tar.gz:eigen \
12fed0cd7cfcd9e169bf1925bc3a7a58725fdcc3.zip:gemmlowp \
816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz:farmhash \
cf1e44edb908e9616030cc83d085989b8e6cd6df.tar.gz:closure \
94d31935a2c94fe7e7c7379a0f3393e181928ff7.tar.gz:toolchain \
b8ff6a85ec359db3fd5657accd3e524daf12016d.tar.gz:docker \
0.6.0.tar.gz:skylib \
rules_swift.0.9.0.tar.gz:swift \
fft.tgz:fft \
1200fe90bb174a6224a525ee60148671a786a71f.tar.gz:neon \
fd3d9af80465e4383162e4a7c5e2f406e82dd968.tar.gz:highway \
license.rst.txt:license \
backports.weakref-1.0rc1.tar.gz:weakref
MASTER_SITES+= https://github.com/intel/mkl-dnn/archive/:mkldnn \
https://github.com/abseil/abseil-cpp/archive/:abseil \
https://bitbucket.org/eigen/eigen/get/:eigen \
https://github.com/google/gemmlowp/archive/:gemmlowp \
https://github.com/google/farmhash/archive/:farmhash \
https://github.com/bazelbuild/rules_closure/archive/:closure \
http://mirror.tensorflow.org/github.com/bazelbuild/bazel-toolchains/archive/:toolchain \
https://github.com/bazelbuild/rules_docker/archive/:docker \
https://github.com/bazelbuild/bazel-skylib/archive/:skylib \
https://github.com/bazelbuild/rules_swift/releases/download/0.9.0/:swift \
http://www.kurims.kyoto-u.ac.jp/~ooura/:fft \
http://mirror.tensorflow.org/github.com/intel/ARM_NEON_2_x86_SSE/archive/:neon \
http://mirror.tensorflow.org/github.com/google/highwayhash/archive/:highway \
http://mirror.tensorflow.org/docs.python.org/2.7/_sources/:license \
https://pypi.python.org/packages/bc/cc/3cdb0a02e7e96f6c70bd971bc8a90b8463fda83e264fa9c5c1c98ceabd81/:weakref

View File

@@ -0,0 +1,33 @@
TIMESTAMP = 1564939361
SHA256 (tensorflow/v0.18.tar.gz) = 38a1c02104ee9f630c1ad68164119cd58ad0aaf59e04ccbe7bd5781add7bfbea
SIZE (tensorflow/v0.18.tar.gz) = 1497239
SHA256 (tensorflow/daf381e8535a1f1f1b8a75966a74e7cca63dee89.tar.gz) = 56cd3fbbbd94468a5fff58f5df2b6f9de7a0272870c61f6ca05b869934f4802a
SIZE (tensorflow/daf381e8535a1f1f1b8a75966a74e7cca63dee89.tar.gz) = 1275955
SHA256 (tensorflow/a0d250e79c79.tar.gz) = 0dde8fb87f5dad2e409c9f4ea1bebc54e694cf4f3b633081b0d51a55c00f9c9f
SIZE (tensorflow/a0d250e79c79.tar.gz) = 2468318
SHA256 (tensorflow/12fed0cd7cfcd9e169bf1925bc3a7a58725fdcc3.zip) = 6678b484d929f2d0d3229d8ac4e3b815a950c86bb9f17851471d143f6d4f7834
SIZE (tensorflow/12fed0cd7cfcd9e169bf1925bc3a7a58725fdcc3.zip) = 935628
SHA256 (tensorflow/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz) = 6560547c63e4af82b0f202cb710ceabb3f21347a4b996db565a411da5b17aba0
SIZE (tensorflow/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz) = 467122
SHA256 (tensorflow/cf1e44edb908e9616030cc83d085989b8e6cd6df.tar.gz) = e0a111000aeed2051f29fcc7a3f83be3ad8c6c93c186e64beb1ad313f0c7f9f9
SIZE (tensorflow/cf1e44edb908e9616030cc83d085989b8e6cd6df.tar.gz) = 462798
SHA256 (tensorflow/94d31935a2c94fe7e7c7379a0f3393e181928ff7.tar.gz) = 109a99384f9d08f9e75136d218ebaebc68cc810c56897aea2224c57932052d30
SIZE (tensorflow/94d31935a2c94fe7e7c7379a0f3393e181928ff7.tar.gz) = 505681
SHA256 (tensorflow/b8ff6a85ec359db3fd5657accd3e524daf12016d.tar.gz) = 4abb48f56b838957c9c72ac511b44f79612fcf39d08338fad14a8e3f6b0572ea
SIZE (tensorflow/b8ff6a85ec359db3fd5657accd3e524daf12016d.tar.gz) = 460121
SHA256 (tensorflow/0.6.0.tar.gz) = eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867
SIZE (tensorflow/0.6.0.tar.gz) = 29330
SHA256 (tensorflow/rules_swift.0.9.0.tar.gz) = 9efe9699e9765e6b4a5e063e4a08f6b163cccaf0443f775d935baf5c3cd6ed0e
SIZE (tensorflow/rules_swift.0.9.0.tar.gz) = 105918
SHA256 (tensorflow/fft.tgz) = 52bb637c70b971958ec79c9c8752b1df5ff0218a4db4510e60826e0cb79b5296
SIZE (tensorflow/fft.tgz) = 72213
SHA256 (tensorflow/1200fe90bb174a6224a525ee60148671a786a71f.tar.gz) = 213733991310b904b11b053ac224fee2d4e0179e46b52fe7f8735b8831e04dcc
SIZE (tensorflow/1200fe90bb174a6224a525ee60148671a786a71f.tar.gz) = 100612
SHA256 (tensorflow/fd3d9af80465e4383162e4a7c5e2f406e82dd968.tar.gz) = 9c3e0e87d581feeb0c18d814d98f170ff23e62967a2bd6855847f0b2fe598a37
SIZE (tensorflow/fd3d9af80465e4383162e4a7c5e2f406e82dd968.tar.gz) = 138574
SHA256 (tensorflow/license.rst.txt) = e76cacdf0bdd265ff074ccca03671c33126f597f39d0ed97bc3e5673d9170cf6
SIZE (tensorflow/license.rst.txt) = 45132
SHA256 (tensorflow/backports.weakref-1.0rc1.tar.gz) = 8813bf712a66b3d8b85dc289e1104ed220f1878cf981e2fe756dfaabe9a82892
SIZE (tensorflow/backports.weakref-1.0rc1.tar.gz) = 7761
SHA256 (tensorflow/tensorflow-tensorflow-v1.14.0_GH0.tar.gz) = aa2a6a1daafa3af66807cfe0bc77bfe1144a9a53df9a96bab52e3e575b3047ed
SIZE (tensorflow/tensorflow-tensorflow-v1.14.0_GH0.tar.gz) = 41335204

View File

@@ -0,0 +1,17 @@
startup --batch
build --strip=never
build --verbose_failures --noshow_loading_progress
test --verbose_test_summary --verbose_failures --noshow_loading_progress
build --spawn_strategy=local --genrule_strategy=local
test --spawn_strategy=local --genrule_strategy=local
# make bazel only fetch distfiles from the cache
fetch --repository_cache="%%BAZEL_DIR%%/bazel-cache/" --distdir="%%BAZEL_DIST%%/bazel-distdir/"
build --repository_cache="%%BAZEL_DIR%%/bazel-cache/" --distdir="%%BAZEL_DIST%%/bazel-distdir/"
build --define=PREFIX=%%LOCALBASE%%
build --define=LIBDIR=%%LOCALBASE%%/lib
build --config=noaws --config=nohdfs --config=noignite --config=nokafka

View File

@@ -0,0 +1,11 @@
--- .bazelrc.orig 2019-07-13 21:45:36.138413000 +0100
+++ .bazelrc 2019-07-13 21:46:25.898491000 +0100
@@ -101,7 +101,7 @@
build:c++1z --cxxopt=-stdlib=libc++
# Default paths for TF_SYSTEM_LIBS
-build --define=PREFIX=/usr
+build --define=PREFIX=%%LOCALBASE%%
build --define=LIBDIR=$(PREFIX)/lib
build --define=INCLUDEDIR=$(PREFIX)/include

View File

@@ -0,0 +1,24 @@
--- tensorflow/contrib/boosted_trees/BUILD.orig 2019-07-07 15:35:52.034885000 +0100
+++ tensorflow/contrib/boosted_trees/BUILD 2019-07-07 15:50:02.149725000 +0100
@@ -27,6 +27,10 @@
":stats_accumulator_ops_kernels",
":training_ops_kernels",
],
+ linkopts = select({
+ "//tensorflow:freebsd": ["-lm", "-lexecinfo",],
+ }),
+
alwayslink = 1,
)
@@ -40,6 +44,10 @@
":stats_accumulator_ops_op_lib",
":training_ops_op_lib",
],
+ linkopts = select({
+ "//tensorflow:freebsd": ["-lm", "-lexecinfo",],
+ }),
+
)
py_library(

View File

@@ -0,0 +1,13 @@
--- tensorflow/contrib/ignite/kernels/client/ignite_plain_client_unix.cc.orig 2019-07-07 13:40:21.593527000 +0100
+++ tensorflow/contrib/ignite/kernels/client/ignite_plain_client_unix.cc 2019-07-07 13:40:59.586340000 +0100
@@ -20,6 +20,10 @@
#include <sys/socket.h>
#include <unistd.h>
+#ifdef __FreeBSD__
+#include <netinet/in.h>
+#endif
+
#include <iostream>
#include <map>

View File

@@ -0,0 +1,49 @@
--- ./tensorflow/contrib/makefile/Makefile.orig 2019-07-08 16:51:36.748365000 +0100
+++ ./tensorflow/contrib/makefile/Makefile 2019-07-08 16:51:21.774903000 +0100
@@ -60,12 +60,15 @@
ifeq ($(UNAME_S),Linux)
HOST_OS := LINUX
endif
+ ifeq ($(UNAME_S),FreeBSD)
+ HOST_OS := FREEBSD
+ endif
ifeq ($(UNAME_S),Darwin)
HOST_OS := OSX
endif
endif
-HOST_ARCH := $(shell if [[ $(shell uname -m) =~ i[345678]86 ]]; then echo x86_32; else echo $(shell uname -m); fi)
+HOST_ARCH := $(shell if uname -m | grep -q i[345678]86; then echo x86_32; elif uname -m | grep -q amd64; then echo x86_64; else uname -m; fi)
# Where compiled objects are stored.
HOST_OBJDIR := $(MAKEFILE_DIR)/gen/host_obj/
@@ -111,6 +114,9 @@
ifeq ($(HOST_OS),LINUX)
HOST_LIBS += -ldl -lpthread
endif
+ifeq ($(HOST_OS),FREEBSD)
+ HOST_LIBS += -lexecinfo -lpthread
+endif
# If we're on a Pi, link in pthreads and dl
ifeq ($(HOST_OS),PI)
@@ -248,7 +254,7 @@
LDFLAGS += -all_load
endif
# Make sure that we don't strip global constructors on Linux.
-ifeq ($(TARGET),LINUX)
+ifeq ($(TARGET),LINUX,FREEBSD)
ifeq ($(HAS_GEN_HOST_PROTOC),true)
LIBFLAGS += -L$(MAKEFILE_DIR)/gen/protobuf-host/lib
export LD_LIBRARY_PATH=$(MAKEFILE_DIR)/gen/protobuf-host/lib
@@ -261,6 +267,10 @@
ifeq ($(TARGET),LINUX)
LIBS += -ldl -lpthread
endif
+ifeq ($(TARGET),FREEBSD)
+ LIBS += -lexecinfo -lpthread
+endif
+
# If we're cross-compiling for the Raspberry Pi, use the right gcc.
ifeq ($(TARGET),PI)
CXXFLAGS += $(ANDROID_TYPES) -DRASPBERRY_PI

View File

@@ -0,0 +1,47 @@
--- tensorflow/core/BUILD.orig 2019-06-18 23:48:23.000000000 +0100
+++ tensorflow/core/BUILD 2019-07-14 09:27:38.471527000 +0100
@@ -2412,7 +2412,7 @@
copts = tf_copts(),
defines = LIB_INTERNAL_DEFINES,
linkopts = select({
- "//tensorflow:freebsd": [],
+ "//tensorflow:freebsd": ["-lexecinfo",],
"//tensorflow:windows": [],
"//tensorflow:android": [],
"//conditions:default": [
@@ -2512,7 +2512,7 @@
hdrs = ["lib/gif/gif_io.h"],
copts = tf_copts(),
linkopts = select({
- "//tensorflow:freebsd": [],
+ "//tensorflow:freebsd": ["-lexecinfo",],
"//tensorflow:windows": [],
"//conditions:default": ["-ldl"],
}),
@@ -2536,7 +2536,7 @@
],
copts = tf_copts(),
linkopts = select({
- "//tensorflow:freebsd": [],
+ "//tensorflow:freebsd": ["-lexecinfo",],
"//tensorflow:windows": [],
"//conditions:default": ["-ldl"],
}),
@@ -2566,7 +2566,7 @@
],
copts = tf_copts(),
linkopts = select({
- "//tensorflow:freebsd": [],
+ "//tensorflow:freebsd": ["-lexecinfo",],
"//tensorflow:windows": [],
"//conditions:default": ["-ldl"],
}),
@@ -2897,7 +2897,7 @@
hdrs = FRAMEWORK_INTERNAL_PUBLIC_HEADERS,
copts = tf_copts(),
linkopts = select({
- "//tensorflow:freebsd": ["-lm"],
+ "//tensorflow:freebsd": ["-lm", "-lexecinfo",],
"//tensorflow:windows": [],
"//conditions:default": [
"-ldl",

View File

@@ -0,0 +1,14 @@
--- tensorflow/core/platform/cloud/gcs_dns_cache.cc.orig 2019-06-18 23:48:23.000000000 +0100
+++ tensorflow/core/platform/cloud/gcs_dns_cache.cc 2019-07-06 18:15:09.827112000 +0100
@@ -24,6 +24,11 @@
#endif
#include <sys/types.h>
+#ifdef __FreeBSD__
+#include <sys/socket.h>
+#include <netinet/in.h>
+#endif
+
namespace tensorflow {
namespace {

View File

@@ -0,0 +1,13 @@
--- tensorflow/core/platform/default/build_config.bzl.orig 2019-07-06 21:55:11.899673000 +0100
+++ tensorflow/core/platform/default/build_config.bzl 2019-07-06 21:56:04.571430000 +0100
@@ -796,9 +796,7 @@
"//tensorflow:ios": [],
"//tensorflow:windows": [],
"//tensorflow:macos": [],
- "//conditions:default": [
- "@hwloc",
- ],
+ "//tensorflow:freebsd": [],
})
def tf_additional_numa_copts():

View File

@@ -0,0 +1,31 @@
--- tensorflow/core/platform/posix/env.cc.orig 2019-06-18 23:48:23.000000000 +0100
+++ tensorflow/core/platform/posix/env.cc 2019-07-06 21:03:28.090735000 +0100
@@ -28,6 +28,10 @@
#include <thread>
#include <vector>
+#ifdef __FREEBSD__
+#include <pthread.h>
+#endif
+
#include "tensorflow/core/lib/core/error_codes.pb.h"
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/load_library.h"
@@ -113,7 +117,7 @@
// Has to be casted to long first, else this error appears:
// static_cast from 'pthread_t' (aka 'pthread *') to 'int32' (aka 'int')
// is not allowed
- return static_cast<int32>(static_cast<int64>(pthread_self()));
+ return static_cast<int32>((int64)(pthread_self()));
#else
return static_cast<int32>(pthread_self());
#endif
@@ -129,7 +133,7 @@
return true;
}
}
-#if defined(__ANDROID__) || defined(__EMSCRIPTEN__)
+#if defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__FreeBSD__)
return false;
#else
char buf[100];

View File

@@ -0,0 +1,21 @@
--- tensorflow/core/protobuf/autotuning.proto.orig 2019-06-18 23:48:23.000000000 +0100
+++ tensorflow/core/protobuf/autotuning.proto 2019-07-30 11:45:04.342068000 +0100
@@ -11,14 +11,14 @@
import "google/protobuf/duration.proto";
message CudnnVersion {
- int32 major = 1;
- int32 minor = 2;
+ int32 major_val = 1;
+ int32 minor_val = 2;
int32 patch = 3;
}
message ComputeCapability {
- int32 major = 1;
- int32 minor = 2;
+ int32 major_val = 1;
+ int32 minor_val = 2;
}
message AutotuneResult {

View File

@@ -0,0 +1,13 @@
--- /dev/null 2019-07-08 14:38:21.999045000 +0100
+++ tensorflow/lite/experimental/micro/tools/make/targets/freebsd_makefile.inc 2019-07-08 14:37:33.196932000 +0100
@@ -0,0 +1,10 @@
+# Settings for x86 on FreeBSD
+ifeq ($(TARGET), freebsd)
+ ifeq ($(TARGET_ARCH), x86_64)
+ PLATFORM_FLAGS = \
+ -DTF_LITE_DISABLE_X86_NEON
+ CXXFLAGS += $(PLATFORM_FLAGS)
+ CCFLAGS += $(PLATFORM_FLAGS)
+ endif
+endif
+

View File

@@ -0,0 +1,11 @@
--- tensorflow/lite/kernels/internal/BUILD.orig 2019-07-09 13:22:19.397153000 +0100
+++ tensorflow/lite/kernels/internal/BUILD 2019-07-09 13:22:38.288994000 +0100
@@ -607,7 +607,7 @@
":neon_tensor_utils",
],
"//conditions:default": [
- ":portable_tensor_utils",
+ ":neon_tensor_utils",
],
}),
)

View File

@@ -0,0 +1,19 @@
--- tensorflow/lite/tools/make/Makefile.orig 2019-07-08 14:04:30.373727000 +0100
+++ tensorflow/lite/tools/make/Makefile 2019-07-08 16:44:36.249811000 +0100
@@ -16,12 +16,15 @@
ifeq ($(UNAME_S),Linux)
HOST_OS := linux
endif
+ ifeq ($(UNAME_S),FreeBSD)
+ HOST_OS := freebsd
+ endif
ifeq ($(UNAME_S),Darwin)
HOST_OS := osx
endif
endif
-HOST_ARCH := $(shell if uname -m | grep -q i[345678]86; then echo x86_32; else uname -m; fi)
+HOST_ARCH := $(shell if uname -m | grep -q i[345678]86; then echo x86_32; elif uname -m | grep -q amd64; then echo x86_64; else uname -m; fi)
# Override these on the make command line to target a specific architecture. For example:
# make -f tensorflow/lite/tools/make/Makefile TARGET=rpi TARGET_ARCH=armv7l

View File

@@ -0,0 +1,19 @@
--- /dev/null 2019-07-08 14:12:50.536743000 +0100
+++ tensorflow/lite/tools/make/targets/freebsd_makefile.inc 2019-07-08 14:11:35.495868000 +0100
@@ -0,0 +1,16 @@
+# Settings for FreeBSD.
+ifeq ($(TARGET), freebsd)
+ CXXFLAGS += \
+ -fPIC \
+ -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
+ -pthread
+ CFLAGS += \
+ -fPIC \
+ -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
+ -pthread
+ # TODO(petewarden): In the future we may want to add architecture-specific
+ # flags like -msse4.2
+ LIBS += -lexecinfo
+endif
+
+

View File

@@ -0,0 +1,65 @@
--- tensorflow/tensorflow.bzl.orig 2019-06-18 23:48:23.000000000 +0100
+++ tensorflow/tensorflow.bzl 2019-07-13 13:57:17.579194000 +0100
@@ -287,6 +287,7 @@
"-Wno-sign-compare",
"-fno-exceptions",
"-ftemplate-depth=900",
+ "-I%%LOCALBASE%%/include",
]) +
if_cuda(["-DGOOGLE_CUDA=1"]) +
if_tensorrt(["-DGOOGLE_TENSORRT=1"]) +
@@ -603,7 +604,7 @@
],
),
data = depset(data + added_data_deps),
- linkopts = linkopts + _rpath_linkopts(name_os),
+ linkopts = linkopts + ["-lexecinfo", "-lgpr"] + _rpath_linkopts(name),
visibility = visibility,
**kwargs
)
@@ -657,7 +658,7 @@
tf_cc_binary(
name = tool,
copts = tf_copts(),
- linkopts = if_not_windows(["-lm", "-Wl,-ldl"]),
+ linkopts = if_not_windows(["-lm", "-Wl, -lexecinfo"]),
linkstatic = 1, # Faster to link this one-time-use binary dynamically
deps = [op_gen] + deps,
)
@@ -839,7 +840,7 @@
tf_cc_binary(
name = tool_name,
copts = tf_copts(),
- linkopts = if_not_windows(["-lm", "-Wl,-ldl"]) + cc_linkopts,
+ linkopts = if_not_windows(["-L%%LOCALBASE%%/lib", "-lm", "-Wl, -lexecinfo"]) + cc_linkopts,
linkstatic = 1, # Faster to link this one-time-use binary dynamically
visibility = [clean_dep("//tensorflow:internal")],
deps = ([
@@ -954,8 +955,9 @@
"//conditions:default": [
"-lpthread",
"-lm",
+ "-lexecinfo",
],
- }) + linkopts + _rpath_linkopts(name),
+ }) + linkopts + ["-lexecinfo"] + _rpath_linkopts(name),
deps = deps + tf_binary_dynamic_kernel_deps(kernels) + if_mkl_ml(
[
clean_dep("//third_party/mkl:intel_binary_blob"),
@@ -1103,7 +1105,7 @@
]) + if_rocm_is_configured([
clean_dep("//tensorflow/core:gpu_lib"),
]),
- linkopts = if_not_windows(["-lpthread", "-lm"]) + linkopts + _rpath_linkopts(name),
+ linkopts = if_not_windows(["-lpthread", "-lm", "-lexecinfo",]) + linkopts + _rpath_linkopts(name),
linkstatic = linkstatic or select({
# cc_tests with ".so"s in srcs incorrectly link on Darwin
# unless linkstatic=1.
@@ -1784,6 +1786,7 @@
linkopts = linkopts + select({
"//conditions:default": [
"-lm",
+ "-lexecinfo",
],
clean_dep("//tensorflow:windows"): [],
clean_dep("//tensorflow:macos"): [],

View File

@@ -0,0 +1,18 @@
--- tensorflow/tools/lib_package/BUILD.orig 2019-07-06 21:58:28.528046000 +0100
+++ tensorflow/tools/lib_package/BUILD 2019-07-06 21:58:46.410184000 +0100
@@ -152,7 +152,6 @@
"@gemmlowp//:LICENSE",
"@gif_archive//:COPYING",
"@highwayhash//:LICENSE",
- "@hwloc//:COPYING",
"@icu//:icu4c/LICENSE",
"@jpeg//:LICENSE.md",
"@lmdb//:LICENSE",
@@ -223,7 +222,6 @@
"@gemmlowp//:LICENSE",
"@gif_archive//:COPYING",
"@highwayhash//:LICENSE",
- "@hwloc//:COPYING",
"@icu//:icu4j/main/shared/licenses/LICENSE",
"@jpeg//:LICENSE.md",
"@lmdb//:LICENSE",

View File

@@ -0,0 +1,10 @@
--- tensorflow/tools/pip_package/BUILD.orig 2019-07-06 22:03:09.438361000 +0100
+++ tensorflow/tools/pip_package/BUILD 2019-07-06 22:03:18.385021000 +0100
@@ -175,7 +175,6 @@
"@gemmlowp//:LICENSE",
"@gif_archive//:COPYING",
"@highwayhash//:LICENSE",
- "@hwloc//:COPYING",
"@icu//:icu4c/LICENSE",
"@jpeg//:LICENSE.md",
"@keras_applications_archive//:LICENSE",

View File

@@ -0,0 +1,10 @@
--- tensorflow/workspace.bzl.orig 2019-07-11 15:46:44.460265000 +0100
+++ tensorflow/workspace.bzl 2019-07-11 15:47:14.104299000 +0100
@@ -346,6 +346,7 @@
],
sha256 = "8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1",
build_file = clean_dep("//third_party:enum34.BUILD"),
+ system_build_file = clean_dep("//third_party/systemlibs:enum34.BUILD"),
strip_prefix = "enum34-1.1.6/enum",
)

View File

@@ -0,0 +1,13 @@
--- third_party/aws/BUILD.bazel.orig 2019-07-07 15:57:49.887118000 +0100
+++ third_party/aws/BUILD.bazel 2019-07-07 15:58:39.817675000 +0100
@@ -27,7 +27,9 @@
"@org_tensorflow//tensorflow:raspberry_pi_armeabi": glob([
"aws-cpp-sdk-core/source/platform/linux-shared/*.cpp",
]),
- "//conditions:default": [],
+ "//conditions:default":glob([
+ "aws-cpp-sdk-core/source/platform/linux-shared/*.cpp",
+ ]),
}) + glob([
"aws-cpp-sdk-core/include/**/*.h",
"aws-cpp-sdk-core/source/*.cpp",

View File

@@ -0,0 +1,17 @@
--- /dev/null 2019-07-11 15:43:12.610969000 +0100
+++ third_party/systemlibs/enum34.BUILD 2019-07-11 15:42:45.040593000 +0100
@@ -0,0 +1,14 @@
+# Description:
+# enum34 provides a backport of the enum module for Python 2.
+
+licenses(["notice"]) # MIT
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+py_library(
+ name = "enum",
+ visibility = ["//visibility:public"],
+)

View File

@@ -0,0 +1,11 @@
--- third_party/systemlibs/grpc.BUILD.orig 2019-06-18 23:48:23.000000000 +0100
+++ third_party/systemlibs/grpc.BUILD 2019-07-13 14:03:35.671155000 +0100
@@ -7,7 +7,7 @@
cc_library(
name = "grpc",
- linkopts = ["-lgrpc"],
+ linkopts = ["-lgrpc", "-lgpr"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,11 @@
--- third_party/systemlibs/protobuf.bzl.orig 2019-07-26 12:28:57.790848000 +0100
+++ third_party/systemlibs/protobuf.bzl 2019-07-26 12:29:42.978059000 +0100
@@ -76,7 +76,7 @@
source_dir = _SourceDir(ctx)
gen_dir = _GenDir(ctx)
if source_dir:
- import_flags = ["-I" + source_dir, "-I" + gen_dir]
+ import_flags = ["-I%%LOCALBASE%%/include", "-I" + source_dir, "-I" + gen_dir]
else:
import_flags = ["-I."]

View File

@@ -0,0 +1,11 @@
--- third_party/systemlibs/swig.BUILD.orig 2019-07-13 11:28:32.539254000 +0100
+++ third_party/systemlibs/swig.BUILD 2019-07-13 11:28:47.485432000 +0100
@@ -13,7 +13,7 @@
genrule(
name = "lnswiglink",
outs = ["swiglink"],
- cmd = "ln -s $$(which swig) $@",
+ cmd = "ln -s $$(which swig3.0) $@",
)
sh_binary(

View File

@@ -0,0 +1,10 @@
--- third_party/systemlibs/syslibs_configure.bzl.orig 2019-07-11 15:43:32.713320000 +0100
+++ third_party/systemlibs/syslibs_configure.bzl 2019-07-11 15:43:54.448882000 +0100
@@ -21,6 +21,7 @@
"curl",
"cython",
"double_conversion",
+ "enum34_archive",
"flatbuffers",
"gast_archive",
"gif_archive",

View File

@@ -0,0 +1,11 @@
--- third_party/gpus/rocm_configure.bzl.orig 2019-06-18 23:48:23.000000000 +0100
+++ third_party/gpus/rocm_configure.bzl 2019-07-06 21:35:41.445803000 +0100
@@ -308,7 +308,7 @@
Returns:
The platform-specific name of the library.
"""
- if cpu_value in ("Linux"):
+ if cpu_value in ("Linux", "FreeBSD"):
if static:
return "lib%s.a" % lib
else:

View File

@@ -0,0 +1,12 @@
TensorFlow is an open source software library for numerical computation using
data flow graphs. Nodes in the graph represent mathematical operations, while
the graph edges represent the multidimensional data arrays (tensors)
communicated between them. The flexible architecture allows you to deploy
computation to one or more CPUs or GPUs in a desktop, server, or mobile device
with a single API. TensorFlow was originally developed by researchers and
engineers working on the Google Brain Team within Google's Machine Intelligence
research organization for the purposes of conducting machine learning and deep
neural networks research, but the system is general enough to be applicable in
a wide variety of other domains as well.
WWW: https://www.tensorflow.org