[CRIU] [PATCH 2/6] protobuf: compile opts.proto

Ruslan Kuprieiev kupruser at gmail.com
Fri Jan 16 12:55:53 PST 2015


We need our proto files to compile with both protoc and
protoc-c compilers, which requires creating google/protobuf
directory with a symlink to /usr/include/google/protobuf/
descriptor.proto to make protoc-c and generated c files happy.

Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 .gitignore                                | 2 ++
 protobuf/Makefile                         | 4 ++++
 protobuf/google/protobuf/descriptor.proto | 1 +
 pycriu/images/Makefile                    | 2 +-
 4 files changed, 8 insertions(+), 1 deletion(-)
 create mode 120000 protobuf/google/protobuf/descriptor.proto

diff --git a/.gitignore b/.gitignore
index 977c782..3f28497 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,8 @@ include/syscall.h
 include/syscall-codes.h
 protobuf/*.c
 protobuf/*.h
+protobuf/google/protobuf/*.c
+protobuf/google/protobuf/*.h
 include/version.h
 arch/x86/sys-exec-tbl.c
 arch/x86/syscalls.S
diff --git a/protobuf/Makefile b/protobuf/Makefile
index 983629e..12d07fc 100644
--- a/protobuf/Makefile
+++ b/protobuf/Makefile
@@ -63,6 +63,8 @@ proto-obj-y	+= rpc.o
 proto-obj-y	+= ext-file.o
 proto-obj-y	+= cgroup.o
 proto-obj-y	+= userns.o
+proto-obj-y	+= google/protobuf/descriptor.o # To make protoc-c happy and compile opts.proto
+proto-pbj-y	+= opts.o
 
 proto		:= $(proto-obj-y:.o=)
 proto-c		:= $(proto-obj-y:.o=.pb-c.c)
@@ -124,4 +126,6 @@ ifneq ($(MAKECMDGOALS),clean)
 endif
 
 cleanup-y += $(obj)/*.c.d $(obj)/*.pb-c.c $(obj)/*.pb-c.h
+cleanup-y += $(obj)/google/protobuf/*.pb-c.d
+cleanup-y += $(obj)/google/protobuf/*.pb-c.h
 cleanup-y += $(obj)/*.d $(obj)/*.i $(obj)/*.s $(obj)/*.o
diff --git a/protobuf/google/protobuf/descriptor.proto b/protobuf/google/protobuf/descriptor.proto
new file mode 120000
index 0000000..07a4c9a
--- /dev/null
+++ b/protobuf/google/protobuf/descriptor.proto
@@ -0,0 +1 @@
+/usr/include/google/protobuf/descriptor.proto
\ No newline at end of file
diff --git a/pycriu/images/Makefile b/pycriu/images/Makefile
index 6aa115e..579b6fa 100644
--- a/pycriu/images/Makefile
+++ b/pycriu/images/Makefile
@@ -10,7 +10,7 @@ proto-py-modules := $(foreach m,$(proto),$(subst -,_,$(notdir $(m:.proto=_pb2)))
 # Unfortunately, we can't drop ugly _pb2 suffixes here, because
 # some _pb2 files depend on others _pb2 files.
 protobuf:
-	$(Q) protoc -I=$(SRC_DIR)/protobuf --python_out=./ $(proto)
+	$(Q) protoc -I=$(SRC_DIR)/protobuf -I=/usr/include/ --python_out=./ $(proto)
 
 magic.py: $(SRC_DIR)/scripts/magic-gen.py $(SRC_DIR)/include/magic.h
 	$(E) "  GEN  " $@
-- 
2.1.0



More information about the CRIU mailing list