pytorch / xla

Enabling PyTorch on XLA Devices (e.g. Google TPU)
https://pytorch.org/xla
Other
2.45k stars 462 forks source link

Got error when build xla from source #4666

Open aws-bowencc opened 1 year ago

aws-bowencc commented 1 year ago

Hi! I am trying to build xla wheel by following the setup guide here: https://github.com/pytorch/xla/blob/master/CONTRIBUTING.md

I skipped building torch by pip install torch==1.13.0 into virtualenv, and then run env BUILD_CPP_TESTS=0 python setup.py bdist_wheel under pytorch/xla. I got the following error:

ERROR: /home/ubuntu/pytorch/xla/third_party/tensorflow/tensorflow/compiler/xla/xla_client/BUILD:42:20: Linking tensorflow/compiler/xla/xla_client/libxla_computation_client.so failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc @bazel-out/k8-opt/bin/tensorflow/compiler/xla/xla_client/libxla_computation_client.so-2.params
bazel-out/k8-opt/bin/tensorflow/core/profiler/convert/_objs/xplane_to_tools_data/xplane_to_tools_data.pic.o:xplane_to_tools_data.cc:function tensorflow::profiler::ConvertMultiXSpacesToToolData(tensorflow::profiler::SessionSnapshot const&, std::basic_string_view<char, std::char_traits<char> >, absl::lts_20220623::flat_hash_map<std::string, std::variant<int, std::string>, absl::lts_20220623::container_internal::StringHash, absl::lts_20220623::container_internal::StringEq, std::allocator<std::pair<std::string const, std::variant<int, std::string> > > > const&): error: undefined reference to 'tensorflow::profiler::ConvertHloProtoToToolData(tensorflow::profiler::SessionSnapshot const&, std::basic_string_view<char, std::char_traits<char> >, absl::lts_20220623::flat_hash_map<std::string, std::variant<int, std::string>, absl::lts_20220623::container_internal::StringHash, absl::lts_20220623::container_internal::StringEq, std::allocator<std::pair<std::string const, std::variant<int, std::string> > > > const&)'
collect2: error: ld returned 1 exit status
Target //tensorflow/compiler/xla/xla_client:libxla_computation_client.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1657.036s, Critical Path: 351.63s
INFO: 9274 processes: 746 internal, 8528 local.
FAILED: Build did NOT complete successfully
Failed to build external libraries: ['/home/ubuntu/pytorch/xla/build_torch_xla_libs.sh', '-O', '-D_GLIBCXX_USE_CXX11_ABI=0', 'bdist_wheel']
JackCaoG commented 1 year ago

did you do

./script/apply_patch.sh

before building pytorch/xla?