> bazel build //tensorflow/core:tensorflow
затем я создаю папку «test» и добавляю файл с именем «test.cc» с пустой основной функцией
int main(int argc, const char** argv) {
return 0
}
файл BUILD:
cc_binary(
name="test",
srcs=["test.cc"],
linkopts = [
"-lpthread",
"-lrt",
"-ldl",
"-lnsl",
"-latomic",
],
linkstatic = 1,
deps=[
"//tensorflow/core:tensorflow"
],
)
но когда я запускаю «bazel build //test:test», появляется много ошибок ссылок:
external/com_google_absl/absl/base/casts.h:161:42: error: no type named 'type' in 'struct std::enable_if'
int>::type = 0>
^
In file included from external/local_xla/xla/shape.h:29,
from external/local_xla/xla/index_util.h:24,
from external/local_xla/xla/literal.h:45,
from external/local_xla/xla/literal.cc:16:
external/local_xla/xla/literal.h: In instantiation of 'bool xla::LiteralBase::DeserializeState::ReadElements(absl::lts_20230802::Span) [with NativeT = ml_dtypes::float8_internal::float8_e4m3fn; InputIterator = const char*]':
external/local_xla/xla/literal.h
external/local_xla/xla/literal.h
external/local_xla/xla/primitive_util.h:432:34: required from 'constexpr R xla::primitive_util::FloatingPointTypeSwitch(F&&, xla::PrimitiveType) [with R = bool; F = xla::Literal::Deserialize(InputIterator, InputIterator) [with InputIterator = const char*]::::]'
external/local_xla/xla/primitive_util.h:480:40: required from 'constexpr R xla::primitive_util::ArrayTypeSwitch(F&&, xla::PrimitiveType) [with R = bool; F = xla::Literal::Deserialize(InputIterator, InputIterator) [with InputIterator = const char*]::::]'
external/local_xla/xla/literal.h
external/local_xla/xla/literal.h
external/local_xla/xla/literal.h:684:64: in 'constexpr' expansion of 'xla::primitive_util::BitWidth(((xla::PrimitiveType)primitive_type))'
external/local_xla/xla/primitive_util.h:568:54: error: 'constexpr int xla::primitive_util::internal::WidthForType(xla::PrimitiveType) [with const std::array& kWidths = xla::primitive_util::internal::kBitWidths]' called in a constant expression
return internal::WidthForType(type);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from external/local_xla/xla/literal.cc:16:
external/local_xla/xla/literal.h:686:23: error: static assertion failed
static_assert(!primitive_util::IsFloatingPointType(primitive_type));
Я не знаю, почему я успешно собрал библиотеку с помощью '//tensorflow/core:tensorflow', но выполнение двоичной команды завершилось неудачно, вот некоторые параметры моей среды:
system: Ubuntu-20.04 x64
gcc: 8.4.0
.tf_configure.bazelrc :
build --action_env PYTHON_BIN_PATH="/usr/bin/python3"
build --action_env PYTHON_LIB_PATH="/usr/lib/python3/dist-packages"
build --python_path="/usr/bin/python3"
build:opt --copt=-Wno-sign-compare
build:opt --host_copt=-Wno-sign-compare
test --test_size_filters=small,medium
test:v1 --test_tag_filters=-benchmark-test,-no_oss,-oss_excluded,-gpu,-oss_serial
test:v1 --build_tag_filters=-benchmark-test,-no_oss,-oss_excluded,-gpu
test:v2 --test_tag_filters=-benchmark-test,-no_oss,-oss_excluded,-gpu,-oss_serial,-v1only
test:v2 --build_tag_filters=-benchmark-test,-no_oss,-oss_excluded,-gpu,-v1only
Подробнее здесь: https://stackoverflow.com/questions/787 ... azel-linux