Fix TFLite builds on Windows/MacOS
Avoid using `--enable_platform_specific_config` when cross-compiling for iOS/Android, as this pulls in host build flags, which may not be appropriate (e.g., when cross-compiling for Android on a Windows host). Also fix an issue when building tensorflowlite_c for iOS. Fixes #38525. PiperOrigin-RevId: 311767770 Change-Id: I80b817fd89a6889dc78be50f1def8b899f091cb6
This commit is contained in:
parent
ff17316b19
commit
1f530076d1
11
.bazelrc
11
.bazelrc
@ -235,10 +235,15 @@ build:c++17 --cxxopt=-std=c++1z
|
||||
build:c++17 --cxxopt=-stdlib=libc++
|
||||
build:c++1z --config=c++17
|
||||
|
||||
# Enable using platform specific build settings
|
||||
# Enable using platform specific build settings, except when cross-compiling for
|
||||
# mobile platforms.
|
||||
build --enable_platform_specific_config
|
||||
build:android --noenable_platform_specific_config
|
||||
build:ios --noenable_platform_specific_config
|
||||
|
||||
# Suppress C++ compiler warnings, otherwise build logs become 10s of MBs.
|
||||
build:android --copt=-w
|
||||
build:ios --copt=-w
|
||||
build:linux --copt=-w
|
||||
build:macos --copt=-w
|
||||
build:windows --copt=/w
|
||||
@ -258,6 +263,10 @@ build:macos --define=INCLUDEDIR=$(PREFIX)/include
|
||||
# TF_SYSTEM_LIBS do not work on windows.
|
||||
|
||||
# By default, build TF in C++ 14 mode.
|
||||
build:android --cxxopt=-std=c++14
|
||||
build:android --host_cxxopt=-std=c++14
|
||||
build:ios --cxxopt=-std=c++14
|
||||
build:ios --host_cxxopt=-std=c++14
|
||||
build:linux --cxxopt=-std=c++14
|
||||
build:linux --host_cxxopt=-std=c++14
|
||||
build:macos --cxxopt=-std=c++14
|
||||
|
@ -1387,7 +1387,6 @@ def main():
|
||||
# Windows.
|
||||
environ_cp['TF_DOWNLOAD_CLANG'] = '0'
|
||||
environ_cp['TF_NEED_MPI'] = '0'
|
||||
environ_cp['TF_SET_ANDROID_WORKSPACE'] = '0'
|
||||
|
||||
if is_macos():
|
||||
environ_cp['TF_NEED_TENSORRT'] = '0'
|
||||
|
@ -22,6 +22,9 @@ package(
|
||||
tflite_cc_shared_object(
|
||||
name = "tensorflowlite_c",
|
||||
linkopts = select({
|
||||
"//tensorflow:ios": [
|
||||
"-Wl,-exported_symbols_list,$(location //tensorflow/lite/c:exported_symbols.lds)",
|
||||
],
|
||||
"//tensorflow:macos": [
|
||||
"-Wl,-exported_symbols_list,$(location //tensorflow/lite/c:exported_symbols.lds)",
|
||||
],
|
||||
|
@ -615,6 +615,9 @@ def tf_cc_shared_object(
|
||||
linkshared = 1,
|
||||
data = data + data_extra,
|
||||
linkopts = linkopts + _rpath_linkopts(name_os_full) + select({
|
||||
clean_dep("//tensorflow:ios"): [
|
||||
"-Wl,-install_name,@rpath/" + soname,
|
||||
],
|
||||
clean_dep("//tensorflow:macos"): [
|
||||
"-Wl,-install_name,@rpath/" + soname,
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user