Compile tensorflow core absl::string_view not be defined
Describe the problem the feature is intended to solve
I'm always frustrated when bazel link thensorflow serving.so . The linker report that absl::string_view not defined , that`s confused me ,as i used nm command check absl::string_view the symbol table has defined absl::string_view
Describe alternatives you've considered
-may be env problem -may be bazel link action does not add absl path
Additional context

System information
- OS Platform and Distribution: CentOS 7.4
- TensorFlow Serving installed from: source code
- TensorFlow Serving version: 2.5.1
- Python version:3.8.12
- GCC version:7.3.0
- bazel version:3.7.2
- abseil version:lts2020.09.23
Describe the problem
When i compile tensorflow serving,the bazel report follow errors:
DEBUG: /home/xxxxx/.cache/bazel/_bazel_xxxxx/88c0b036255caa902dff8573ee49daa1/external/org_tensorflow/third_party/repo.bzl:108:14:
Warning: skipping import of repository 'icu' because it already exists.
INFO: Analyzed target //tensorflow_serving/model_servers:tensorflow_model_server (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/xxxxx/serving/tensorflow_serving/model_servers/BUILD:402:10: Couldn't build file tensorflow_serving/model_servers/tensorflow_model_server: Linking of rule '//tensorflow_serving/model_servers:tensorflow_model_server' failed (Exit 1): gcc failed: error executing command
(cd /home/xxxxx/.cache/bazel/_bazel_xxxxx/88c0b036255caa902dff8573ee49daa1/execroot/tf_serving && \
exec env - \
LD_LIBRARY_PATH=/home/xxxxx/gcc/env/lib:/home/xxxxx/gcc/env/lib64:/home/xxxxx/absel-2020-09-23/env/lib64:/lib64:/lib:/home/xxxxx/openssl/env/openssl/lib \
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/xxxxx/.local/bin:/home/xxxxx/bin \
PWD=/proc/self/cwd \
/usr/local/bin/gcc @bazel-out/k8-opt/bin/tensorflow_serving/model_servers/tensorflow_model_server-2.params)
Execution platform: @local_execution_config_platform//:platform
bazel-out/k8-opt/bin/external/org_tensorflow/tensorflow/core/profiler/utils/_objs/xplane_utils/xplane_utils.o:xplane_utils.cc:function tensorflow::profiler::FindPlanesWithNames(tensorflow::profiler::XSpace const&, : error: undefined reference to 'std::allocator<absl::lts_2020_09_23::string_view>::allocator()'
bazel-out/k8-opt/bin/external/com_github_grpc_grpc/_objs/gpr_base/string.o:string.cc:function gpr_leftpad(char const*, char, unsigned long): warning: memset used with constant zero length parameter; this could be due to transposed parameters
collect2: error: ld returned 1 exit status
Target //tensorflow_serving/model_servers:tensorflow_model_server failed to build
Exact Steps to Reproduce
I use this command to build:
bazel build --color=yes --curses=yes \ --verbose_failures \ --config=release \ --output_filter=DONT_MATCH_ANYTHING tensorflow_serving/model_servers:tensorflow_model_server
@Cazyshark Could you please refer to this bazel version updated and also check the similar issues #1781 and #60949899 and let us know if this helps.Thanks
doesn`t work,I think that may be linux-kernel problem. All libs has compiled,but when linking the target bazel report this problem(PS.undefined reference to 'std::allocatorabsl::lts_2020_09_23::string_view::allocator()') :(
Did you try bazel build --cxxopt=-std=c++17 ... as abseil/abseil-cpp/blob/master/FAQ.md suggested? Thanks!
Did you try
bazel build --cxxopt=-std=c++17 ...as abseil/abseil-cpp/blob/master/FAQ.md suggested? Thanks!
doesn`t work
Did you try
bazel build --cxxopt=-std=c++17 ...as abseil/abseil-cpp/blob/master/FAQ.md suggested? Thanks!doesn`t work
I met similar problem compiling tensorflow_model_server 2.6.2 on a aarch64 machine,it's been a long time but had you solved your problem at last ?
@Cazyshark,
The recommended approach to building from source is to use Docker. The TensorFlow Serving Docker development images encapsulate all the dependencies you need to build your own version of TensorFlow Serving. In order to build in a hermetic environment with all dependencies taken care of, we will use the run_in_docker.sh script. This script passes build commands through to a Docker container. By default, the script will build with the latest nightly Docker development image.
To build the entire tree, execute:
tools/run_in_docker.sh bazel build -c opt tensorflow_serving/...
Ref: TF Serving: Building from Source. Thank you!
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.
This issue was closed due to lack of activity after being marked stale for past 7 days.