Created
April 1, 2023 11:04
-
-
Save NobuoTsukamoto/3c12f4f52c0ba1d31ac077a32a548774 to your computer and use it in GitHub Desktop.
VisionFive 2 libedgetpu build patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/api/allocated_buffer.h b/api/allocated_buffer.h | |
index 97740f0..4311e34 100644 | |
--- a/api/allocated_buffer.h | |
+++ b/api/allocated_buffer.h | |
@@ -16,6 +16,7 @@ | |
#define DARWINN_API_ALLOCATED_BUFFER_H_ | |
#include <functional> | |
+#include <stddef.h> | |
namespace platforms { | |
namespace darwinn { | |
diff --git a/makefile_build/Makefile b/makefile_build/Makefile | |
index ef7d290..adb20fc 100644 | |
--- a/makefile_build/Makefile | |
+++ b/makefile_build/Makefile | |
@@ -10,8 +10,6 @@ BUILDROOT ?= $(MAKEFILE_DIR)/.. | |
BUILDDIR := $(BUILDROOT)/out | |
TOBUILDDIR = $(addprefix $(BUILDDIR)/,$(1)) | |
MKDIR = if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi | |
-CC=gcc | |
-CXX=g++ | |
FLATC=flatc | |
LIBEDGETPU_CFLAGS := \ | |
@@ -20,6 +18,7 @@ LIBEDGETPU_CFLAGS := \ | |
-std=c99 | |
LIBEDGETPU_CXXFLAGS := \ | |
+ ${CXXFLAGS} \ | |
-fPIC \ | |
-Wall \ | |
-std=c++14 \ | |
@@ -30,9 +29,7 @@ LIBEDGETPU_LDFLAGS := \ | |
-shared \ | |
-Wl,--soname,libedgetpu.so.1 \ | |
-Wl,--version-script=$(BUILDROOT)/tflite/public/libedgetpu.lds \ | |
- -fuse-ld=gold \ | |
-lflatbuffers \ | |
- -labsl_flags \ | |
-labsl_flags_internal \ | |
-labsl_flags_reflection \ | |
-labsl_flags_marshalling \ | |
@@ -40,7 +37,9 @@ LIBEDGETPU_LDFLAGS := \ | |
-labsl_hashtablez_sampler \ | |
-labsl_raw_hash_set \ | |
-labsl_str_format_internal \ | |
- -lusb-1.0 | |
+ -labsl_bad_optional_access \ | |
+ -lusb-1.0 \ | |
+ -latomic | |
LIBEDGETPU_FLATC_SRCS := \ | |
$(BUILDROOT)/executable/executable.fbs \ | |
@@ -59,7 +58,6 @@ LIBEDGETPU_INCLUDES := \ | |
$(BUILDDIR)/$(BUILDROOT) | |
LIBEDGETPU_INCLUDES := $(addprefix -I,$(LIBEDGETPU_INCLUDES)) | |
-LIBEDGETPU_CSRCS := $(TFROOT)/tensorflow/lite/c/common.c | |
LIBEDGETPU_COBJS := $(call TOBUILDDIR,$(patsubst %.c,%.o,$(LIBEDGETPU_CSRCS))) | |
LIBEDGETPU_CCSRCS := \ | |
@@ -140,7 +138,8 @@ LIBEDGETPU_CCSRCS := \ | |
$(BUILDROOT)/tflite/edgetpu_c.cc \ | |
$(BUILDROOT)/tflite/edgetpu_delegate_for_custom_op.cc \ | |
$(BUILDROOT)/tflite/edgetpu_delegate_for_custom_op_tflite_plugin.cc \ | |
- $(TFROOT)/tensorflow/lite/util.cc | |
+ $(TFROOT)/tensorflow/lite/util.cc \ | |
+ $(TFROOT)/tensorflow/lite/core/c/common.cc | |
LIBEDGETPU_CCOBJS := $(call TOBUILDDIR,$(patsubst %.cc,%.o,$(LIBEDGETPU_CCSRCS))) | |
# In order to support direct and throttled mode - we need to compile two files | |
@@ -181,11 +180,6 @@ firmware: | |
@echo "} // namespace" >> $(LIBEDGETPU_FW_OUTPUT) | |
-$(LIBEDGETPU_COBJS) : $(BUILDDIR)/%.o: %.c | |
- @$(MKDIR) | |
- @echo "Compiling $<" | |
- @$(CC) $(LIBEDGETPU_CFLAGS) $(LIBEDGETPU_INCLUDES) -c $< -MD -MT $@ -MF $(@:%o=%d) -o $@ | |
- | |
$(LIBEDGETPU_CCOBJS) : $(BUILDDIR)/%.o: %.cc | |
@$(MKDIR) | |
@echo "Compiling $<" | |
@@ -201,14 +195,14 @@ $(LIBEDGETPU_STD_CCOBJS) : $(BUILDDIR)/%-throttled.o: %.cc | |
@echo "Compiling $<" | |
@$(CXX) -DTHROTTLE_EDGE_TPU $(LIBEDGETPU_CXXFLAGS) $(LIBEDGETPU_INCLUDES) -c $< -MD -MT $@ -MF $(@:%o=%d) -o $@ | |
-libedgetpu: | firmware $(LIBEDGETPU_FLATC_OBJS) $(LIBEDGETPU_COBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_MAX_CCOBJS) | |
+libedgetpu: | firmware $(LIBEDGETPU_FLATC_OBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_MAX_CCOBJS) | |
@mkdir -p $(BUILDDIR)/direct/k8 | |
@echo "Building libedgetpu.so" | |
- @$(CXX) $(LIBEDGETPU_CCFLAGS) $(LIBEDGETPU_LDFLAGS) $(LIBEDGETPU_COBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_MAX_CCOBJS) -o $(BUILDDIR)/direct/k8/libedgetpu.so.1.0 | |
+ @$(CXX) $(LIBEDGETPU_CCFLAGS) ${LDFLAGS} $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_MAX_CCOBJS) $(LIBEDGETPU_LDFLAGS) -o $(BUILDDIR)/direct/k8/libedgetpu.so.1.0 | |
@ln -sf $(BUILDDIR)/direct/k8/libedgetpu.so.1.0 $(BUILDDIR)/direct/k8/libedgetpu.so.1 | |
-libedgetpu-throttled: | firmware $(LIBEDGETPU_FLATC_OBJS) $(LIBEDGETPU_COBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_STD_CCOBJS) | |
+libedgetpu-throttled: | firmware $(LIBEDGETPU_FLATC_OBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_STD_CCOBJS) | |
@mkdir -p $(BUILDDIR)/throttled/k8 | |
@echo "Building throttled libedgetpu.so" | |
- @$(CXX) $(LIBEDGETPU_CCFLAGS) $(LIBEDGETPU_LDFLAGS) $(LIBEDGETPU_COBJS) $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_STD_CCOBJS) -o $(BUILDDIR)/throttled/k8/libedgetpu.so.1.0 | |
+ @$(CXX) $(LIBEDGETPU_CCFLAGS) ${LDFLAGS} $(LIBEDGETPU_CCOBJS) $(LIBEDGETPU_STD_CCOBJS) $(LIBEDGETPU_LDFLAGS) -o $(BUILDDIR)/throttled/k8/libedgetpu.so.1.0 | |
@ln -sf $(BUILDDIR)/throttled/k8/libedgetpu.so.1.0 $(BUILDDIR)/throttled/k8/libedgetpu.so.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment