tf_lite.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. diff --git a/tensorflow/lite/tools/make/Makefile b/tensorflow/lite/tools/make/Makefile
  2. index c7ddff5844..1082644043 100644
  3. --- a/tensorflow/lite/tools/make/Makefile
  4. +++ b/tensorflow/lite/tools/make/Makefile
  5. @@ -48,11 +48,7 @@ INCLUDES += -I/usr/local/include
  6. # These are the default libraries needed, but they can be added to or
  7. # overridden by the platform-specific settings in target makefiles.
  8. -LIBS := \
  9. --lstdc++ \
  10. --lpthread \
  11. --lm \
  12. --lz \
  13. +LIBS := -lm \
  14. -ldl
  15. # There are no rules for compiling objects for the host system (since we don't
  16. @@ -84,14 +80,18 @@ endif # ifeq ($(HOST_ARCH),$(TARGET_ARCH))
  17. endif # ifeq ($(HOST_OS),$(TARGET))
  18. endif
  19. +LIBFLAGS += -s TOTAL_STACK=1048576 \
  20. + -Wl,--export=__data_end -Wl,--export=__heap_base \
  21. + -s ERROR_ON_UNDEFINED_SYMBOLS=0
  22. +
  23. # This library is the main target for this makefile. It will contain a minimal
  24. # runtime that can be linked in to other programs.
  25. LIB_NAME := libtensorflow-lite.a
  26. # Benchmark static library and binary
  27. BENCHMARK_LIB_NAME := benchmark-lib.a
  28. -BENCHMARK_BINARY_NAME := benchmark_model
  29. -BENCHMARK_PERF_OPTIONS_BINARY_NAME := benchmark_model_performance_options
  30. +BENCHMARK_BINARY_NAME := benchmark_model.wasm
  31. +BENCHMARK_PERF_OPTIONS_BINARY_NAME := benchmark_model_performance_options.wasm
  32. # A small example program that shows how to link against the library.
  33. MINIMAL_SRCS := \
  34. @@ -277,12 +277,16 @@ LIB_PATH := $(LIBDIR)$(LIB_NAME)
  35. BENCHMARK_LIB := $(LIBDIR)$(BENCHMARK_LIB_NAME)
  36. BENCHMARK_BINARY := $(BINDIR)$(BENCHMARK_BINARY_NAME)
  37. BENCHMARK_PERF_OPTIONS_BINARY := $(BINDIR)$(BENCHMARK_PERF_OPTIONS_BINARY_NAME)
  38. -MINIMAL_BINARY := $(BINDIR)minimal
  39. +MINIMAL_BINARY := $(BINDIR)minimal.wasm
  40. LABEL_IMAGE_BINARY := $(BINDIR)label_image
  41. -CXX := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}g++
  42. -CC := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}gcc
  43. -AR := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}ar
  44. +# CXX := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}g++
  45. +# CC := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}gcc
  46. +# AR := $(CC_PREFIX)${TARGET_TOOLCHAIN_PREFIX}ar
  47. +
  48. +CXX := em++
  49. +CC := emcc
  50. +AR := emar
  51. MINIMAL_OBJS := $(addprefix $(OBJDIR), \
  52. $(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(MINIMAL_SRCS))))
  53. diff --git a/tensorflow/lite/tools/make/targets/linux_makefile.inc b/tensorflow/lite/tools/make/targets/linux_makefile.inc
  54. index 222cef9e5f..eea89a38f0 100644
  55. --- a/tensorflow/lite/tools/make/targets/linux_makefile.inc
  56. +++ b/tensorflow/lite/tools/make/targets/linux_makefile.inc
  57. @@ -2,12 +2,10 @@
  58. ifeq ($(TARGET), linux)
  59. CXXFLAGS += \
  60. -fPIC \
  61. - -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
  62. - -pthread
  63. + -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK
  64. CFLAGS += \
  65. -fPIC \
  66. - -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
  67. - -pthread
  68. + -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK
  69. # TODO(petewarden): In the future we may want to add architecture-specific
  70. # flags like -msse4.2
  71. LIBS += -ldl