Skip to content

Instantly share code, notes, and snippets.

@momeara
Created October 15, 2018 19:44
Show Gist options
  • Save momeara/2edb2d606ea9490d3bbb358ed2b57855 to your computer and use it in GitHub Desktop.
Save momeara/2edb2d606ea9490d3bbb358ed2b57855 to your computer and use it in GitHub Desktop.
Changes to tensorflow checkout to build on momeara's workstation
iff --git a/.bazelrc b/.bazelrc
index d5d2030..c27c68e 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -86,3 +86,4 @@ build --define=LIBDIR=$(PREFIX)/lib
build --define=INCLUDEDIR=$(PREFIX)/include
# Do not commit the tf_configure.bazelrc line
+import %workspace%/.tf_configure.bazelrc
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl
index dead44c..1ccdd16 100644
--- a/tensorflow/tensorflow.bzl
+++ b/tensorflow/tensorflow.bzl
@@ -367,7 +367,7 @@ def tf_cc_shared_object(
srcs = [],
deps = [],
data = [],
- linkopts = [],
+ linkopts = ["-lrt"],
framework_so = tf_binary_additional_srcs(),
kernels = [],
**kwargs):
@@ -403,7 +403,7 @@ def tf_cc_binary(
srcs = [],
deps = [],
data = [],
- linkopts = [],
+ linkopts = ["-lrt"],
copts = tf_copts(),
kernels = [],
**kwargs):
@@ -460,7 +460,7 @@ def tf_gen_op_wrapper_cc(
tf_cc_binary(
name = tool,
copts = tf_copts(),
- linkopts = if_not_windows(["-lm", "-Wl,-ldl"]),
+ linkopts = if_not_windows(["-lm", "-lrt", "-Wl,-ldl"]),
linkstatic = 1, # Faster to link this one-time-use binary dynamically
deps = [op_gen] + deps,
)
@@ -625,7 +625,7 @@ def tf_gen_op_wrapper_py(
hidden_file = None,
generated_target_name = None,
op_whitelist = [],
- cc_linkopts = [],
+ cc_linkopts = [ "-lrt"],
api_def_srcs = []):
if (hidden or hidden_file) and op_whitelist:
fail("Cannot pass specify both hidden and op_whitelist.")
@@ -636,7 +636,7 @@ def tf_gen_op_wrapper_py(
deps = [str(Label("//tensorflow/core:" + name + "_op_lib"))]
tf_cc_binary(
name = tool_name,
- linkopts = if_not_windows(["-lm", "-Wl,-ldl"]) + cc_linkopts,
+ linkopts = if_not_windows(["-lm", "-lrt", "-Wl,-ldl"]) + cc_linkopts,
copts = tf_copts(),
linkstatic = 1, # Faster to link this one-time-use binary dynamically
deps = ([
@@ -1297,6 +1297,7 @@ def _py_wrap_cc_impl(ctx):
args += [src.path]
outputs = [ctx.outputs.cc_out, ctx.outputs.py_out]
ctx.action(
+ use_default_shell_env = True,
executable = ctx.executable._swig,
arguments = args,
inputs = list(inputs),
diff --git a/third_party/gpus/crosstool/CROSSTOOL_hipcc.tpl b/third_party/gpus/crosstool/CROSSTOOL_hipcc.tpl
index 0e175b3..f6db33b 100644
--- a/third_party/gpus/crosstool/CROSSTOOL_hipcc.tpl
+++ b/third_party/gpus/crosstool/CROSSTOOL_hipcc.tpl
@@ -52,7 +52,7 @@ toolchain {
cxx_flag: "-std=c++11"
linker_flag: "-Wl,-no-as-needed"
linker_flag: "-lstdc++"
- #linker_flag: "-B/usr/bin/"
+ #linker_flag: "-B/nfs/home/momeara/opt/bin/"
linker_flag: "-B/opt/rocm/hcc/compiler/bin"
%{host_compiler_includes}
diff --git a/third_party/gpus/cuda_configure.bzl b/third_party/gpus/cuda_configure.bzl
index 69f4599..768de79 100644
--- a/third_party/gpus/cuda_configure.bzl
+++ b/third_party/gpus/cuda_configure.bzl
@@ -1316,7 +1316,7 @@ def _create_local_cuda_repository(repository_ctx):
if should_download_clang:
cuda_defines["%{linker_bin_path_flag}"] = ""
else:
- cuda_defines["%{linker_bin_path_flag}"] = 'flag: "-B/usr/bin"'
+ cuda_defines["%{linker_bin_path_flag}"] = 'flag: "-B/nfs/home/momeara/opt/bin"'
if is_cuda_clang:
cuda_defines["%{host_compiler_path}"] = str(cc)
diff --git a/third_party/sycl/crosstool/CROSSTOOL.tpl b/third_party/sycl/crosstool/CROSSTOOL.tpl
index f8e50ef..a745531 100755
--- a/third_party/sycl/crosstool/CROSSTOOL.tpl
+++ b/third_party/sycl/crosstool/CROSSTOOL.tpl
@@ -41,7 +41,7 @@ toolchain {
cxx_flag: "%{c++_std}"
linker_flag: "-Wl,-no-as-needed"
linker_flag: "-lstdc++"
- linker_flag: "-B/usr/bin/"
+ linker_flag: "-B/nfs/home/momeara/opt/bin/"
# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
@@ -152,7 +152,7 @@ toolchain {
cxx_flag: "-std=c++11"
linker_flag: "-Wl,-no-as-needed"
linker_flag: "-lstdc++"
- linker_flag: "-B/usr/bin/"
+ linker_flag: "-B/nfs/home/momeara/opt/bin/"
# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
diff --git a/third_party/toolchains/gpus/crosstool/CROSSTOOL b/third_party/toolchains/gpus/crosstool/CROSSTOOL
index b8eeb31..f2b4877 100644
--- a/third_party/toolchains/gpus/crosstool/CROSSTOOL
+++ b/third_party/toolchains/gpus/crosstool/CROSSTOOL
@@ -216,7 +216,7 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
flag_group {
- flag: "-B/usr/bin/"
+ flag: "-B/nfs/home/momeara/opt/bin/"
}
}
}
@@ -464,7 +464,7 @@ toolchain {
action: "c++-link-dynamic-library"
action: "c++-link-nodeps-dynamic-library"
flag_group {
- flag: "-B/usr/bin/"
+ flag: "-B/nfs/home/momeara/opt/bin/"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment