Skip to content

Commit

Permalink
[dash-pipeline] Refactor Makefiles (#432)
Browse files Browse the repository at this point in the history
* [dash-pipeline] Refactor Makefiles

* compile everything with host user id and group
* reduce number of required libs
* simplify Makefiles
* make proper dependencies

* Trigger ptf submodule init in SAI

* [libsai] Return SAI_PORT_OPER_STATUS_UP on each port

Speeds up ptf test execution, since all ports are already up
  • Loading branch information
kcudnik authored Sep 7, 2023
1 parent 654b357 commit 3bbe99f
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 154 deletions.
58 changes: 35 additions & 23 deletions dash-pipeline/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ DASH_UID ?=4321
DASH_GUID?=4321
DASH_HOST?=dash

HOST_USER := $(shell id -u)
HOST_GROUP := $(shell id -g)

ENABLE_DOCKER_PULL ?= y

# Include file defines DOCKER_GRPC_IMG_NAME and DOCKER_GRPC_IMG_CTAG
Expand Down Expand Up @@ -71,6 +74,7 @@ DOCKER_RUN := docker run \
-v $(PWD)/tests:/tests \
--network=host \
--rm \
-u $(HOST_USER):$(HOST_GROUP) \
$(DOCKER_FLAGS)

SHA1SUM := sha1sum | awk '{print substr($$1,0,11);}'
Expand All @@ -93,20 +97,20 @@ P4_MAIN=bmv2/dash_pipeline.p4
P4_OUTDIR=bmv2/dash_pipeline.bmv2
P4_ARTIFACTS=$(P4_OUTDIR)/dash_pipeline.json $(P4_OUTDIR)/dash_pipeline_p4rt.txt

p4: $(P4_OUTDIR)/dash_pipeline.json
p4: $(P4_ARTIFACTS)

.PHONY:p4-clean
p4-clean:
-rm -rf $(P4_OUTDIR)
rm -rf $(P4_OUTDIR)

# Compile P4 into bmv2 .json fle and P4info for SAI header autogeneration
$(P4_ARTIFACTS): $(P4_SRC)
@echo "Compile P4 program $(P4_MAIN) for bmv2 ..."
mkdir -p $(P4_OUTDIR) && \
chmod o+w $(P4_OUTDIR) && \
mkdir -p $(P4_OUTDIR)
docker run \
--rm \
--name dash-p4c-$(USER) \
-u $(DASH_USER) \
-u $(HOST_USER):$(HOST_GROUP) \
$(DOCKER_FLAGS) \
-v $(PWD)/bmv2:/bmv2 \
-w / \
Expand All @@ -123,12 +127,11 @@ P4_DPDK_OUTDIR=dpdk-pna/dash_pipeline.dpdk

p4c-dpdk-pna:
@echo "Compile P4 program $(P4_MAIN) for dpdk-pna ..."
mkdir -p $(P4_DPDK_OUTDIR) && \
chmod o+w $(P4_DPDK_OUTDIR) && \
mkdir -p $(P4_DPDK_OUTDIR)
docker run \
--rm \
--name dash-p4c-dpdk-$(USER) \
-u $(DASH_USER) \
-u $(HOST_USER):$(HOST_GROUP) \
$(DOCKER_FLAGS) \
-v $(PWD)/bmv2:/bmv2 \
-v $(PWD)/dpdk-pna:/dpdk-pna \
Expand All @@ -140,7 +143,6 @@ p4c-dpdk-pna:
--p4runtime-files $(P4_DPDK_OUTDIR)/dash_pipeline.p4.p4info.txt \
$(P4_MAIN)


# p4c-dpdk -DDPDK_PNA -DPNA_CONNTRACK --dump $(P4_DPDK_OUTDIR) --pp $(P4_DPDK_OUTDIR)/dash_pipeline.pp.p4 \
# -o $(P4_DPDK_OUTDIR)/dash_pipeline.spec --arch pna --bf-rt-schema $(P4_DPDK_OUTDIR)/dash_pipeline.p4.bfrt.json \
# --p4runtime-files $(P4_DPDK_OUTDIR)/dash_pipeline.p4.p4info.txt $(P4_MAIN)
Expand All @@ -158,48 +160,57 @@ DOCKER_RUN_SAITHRIFT_BLDR =\
--name dash-saithrift-bldr-$(USER) \
-v $(PWD)/..:/dash -w /dash/dash-pipeline/SAI/saithrift \
-e SAIRPC_VENDOR_EXTRA_LIBS=$(SAIRPC_VENDOR_EXTRA_LIBS) \
-u $(DASH_UID):$(DASH_GUID) \
-e HOST_USER=$(HOST_USER) \
-e HOST_GROUP=$(HOST_GROUP) \
$(DOCKER_SAITHRIFT_BLDR_IMG) \

# TODO - create separate rules for headers, libsai.so
.PHONY:sai

sai: sai-clean sai-headers sai-meta libsai
sai: sai-headers sai-meta libsai

sai-headers: p4 docker-saithrift-bldr-image-exists | SAI/SAI
@echo "Generate SAI library headers and implementation..."
mkdir -p SAI/lib && chmod -R o+w SAI && \
mkdir -p SAI/lib
$(DOCKER_RUN) \
$(DOCKER_FLAGS) \
--name build_sai-$(USER) \
-u $(HOST_USER):$(HOST_GROUP) \
-w /SAI $(DOCKER_SAITHRIFT_BLDR_IMG) \
./generate_dash_api.sh

sai-meta:
@echo "Generate SAI metadata..."
# hack - remove scripts which cause Git ownership failures in CI pipelines
# We don't need them, they're to check that SAI headers didn't experience enum changes etc.
sed -ie '/checkenumlock.sh/d' SAI/SAI/meta/Makefile
sed -ie '/checkancestry.sh/d' SAI/SAI/meta/Makefile
sed -i.bak '/checkenumlock.sh/d' SAI/SAI/meta/Makefile
sed -i.bak '/checkancestry.sh/d' SAI/SAI/meta/Makefile
sed -i.bak '/checkstructs.sh/d' SAI/SAI/meta/Makefile
docker run \
$(DOCKER_FLAGS) \
--rm \
--name dash-saithrift-bldr-$(USER) \
-v $(PWD)/..:/dash -w /dash/dash-pipeline/SAI/SAI/meta \
-u $(HOST_USER):$(HOST_GROUP) \
-v $(PWD)/..:/dash \
-w /dash/dash-pipeline/SAI/SAI/meta \
$(DOCKER_SAITHRIFT_BLDR_IMG) \
make

# TODO - add SAI header dependencies
libsai:
libsai: SAI/lib/libsai.so

SAI/lib/libsai.so: sai-headers sai-meta
@echo "build libsai.so..."
$(DOCKER_RUN) \
$(DOCKER_FLAGS) \
-w /SAI/lib \
--name build_libsai-$(USER) \
-u $(HOST_USER):$(HOST_GROUP) \
$(DOCKER_BMV2_BLDR_IMG) \
make

.PHONY:libsai-clean
libsai-clean:
-rm -rf SAI/lib/*
rm -rf SAI/lib/*

.PHONY:sai-clean
sai-clean: SAI/SAI libsai-clean saithrift-server-clean
Expand Down Expand Up @@ -269,6 +280,7 @@ run-saithrift-server-bash:
$(DOCKER_RUN_SAITHRIFT_SRVR) \
/bin/bash

.PHONY:saithrift-server-clean
saithrift-server-clean: docker-saithrift-bldr-image-exists
$(DOCKER_RUN_SAITHRIFT_BLDR) \
make $@
Expand All @@ -278,18 +290,18 @@ saithrift-server-clean: docker-saithrift-bldr-image-exists
# SAI TEST TARGETS
###############################

.PHONY:test libsai-test
test:libsai-test
.PHONY:test
test: libsai-test

.PHONY:test-clean
test-clean:
make -C tests/libsai clean


.PHONY:libsai-test
libsai-test:SAI/SAI SAI/lib/libsai.so
chmod -R a+w tests/libsai
libsai-test: SAI/lib/libsai.so
$(DOCKER_RUN) \
--name dash-build-test-$(USER) \
-u $(HOST_USER):$(HOST_GROUP) \
-w /tests/libsai $(DOCKER_BMV2_BLDR_IMG) \
make

Expand Down
65 changes: 30 additions & 35 deletions dash-pipeline/SAI/saithrift/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,57 @@ META=../SAI/meta

SAIRPC_VENDOR_EXTRA_LIBS?=
SAIRPC_EXTRA_LIBS= "$(SAIRPC_VENDOR_EXTRA_LIBS) \
-L/lib/x86_64-linux-gnu -Wl,-rpath=/lib/x86_64-linux-gnu -lm \
-L/lib/x86_64-linux-gnu -Wl,-rpath=/lib/x86_64-linux-gnu \
-L/usr/local/lib/ -Wl,-rpath=/usr/local/lib \
-lpthread \
-lpiprotogrpc \
-lpiprotobuf \
-lprotobuf \
-lgrpc++ \
-lgrpc \
-lpiall \
-lpi_dummy \
-lpthread \
-labsl_synchronization \
-labsl_status \
-labsl_raw_hash_set \
-lgpr \
-lre2 \
-lssl \
-laddress_sorting"
-lprotobuf -lpiprotobuf -lpiprotogrpc -lgrpc++"

HUSER=hostuser
HGROUP=hostgroup

SUDO=sudo -u $(HUSER) -g $(HGROUP)

host:
sudo groupadd -f -r -g $(HOST_GROUP) $(HGROUP)
sudo useradd $(HUSER) -l -u $(HOST_USER) -g $(HOST_GROUP) -d $(shell pwd) -m -s /usr/bin/bash

# Below based on: https://github.com/opencomputeproject/SAI/blob/master/ptf/SAI_PTF_user-guide.md
# Dependencies are assumed to be installed, e.g. in the docker container
saithrift-server:
saithrift-server: host
# Copy headers to /usr/include/sai
sudo mkdir -p /usr/include/sai
sudo cp $(SAI)/inc/sai*.h /usr/include/sai/
sudo cp -a $(SAI)/inc/sai*.h /usr/include/sai/
# Following is workaround for https://github.com/opencomputeproject/SAI/issues/1537
sudo cp $(SAI)/experimental/sai*.h /usr/include/sai/
sudo cp -r $(SAI)/experimental/ /usr/include/
sudo cp -a $(SAI)/experimental/sai*.h /usr/include/sai/
sudo cp -ar $(SAI)/experimental/ /usr/include/

# Install vendor specific SAI library i.e. DASH bmv2 libsai.so in /usr/lib.
sudo cp $(LIB)/libsai.so /usr/lib

@echo "Build SAI thrift server and libraries..."
mkdir -p $(RPC_INST_DIR) && chmod a+w $(RPC_INST_DIR)
$(SUDO) mkdir -p $(RPC_INST_DIR)

cd $(SAI) && export SAITHRIFTV2=y && \
$(SUDO) bash -c 'cd $(SAI) && \
export SAITHRIFTV2=y && \
export GEN_SAIRPC_OPTS="-ve" && \
export SAIRPC_EXTRA_LIBS=$(SAIRPC_EXTRA_LIBS) && \
export SAIRPC_EXTRA_LIBS="$(shell echo $(SAIRPC_EXTRA_LIBS))" && \
make saithrift-build && \
export DESTDIR=$(RPC_INST_DIR) && make saithrift-install
export DESTDIR=$(RPC_INST_DIR) && \
make saithrift-install'

# NOTE: commands below is a workaround (WA) and needed until packaging of SAI python is fixed.
# Re-generate python SAI thrift library again
$(SUDO) bash -c 'cd $(SAI)/test/saithriftv2 && export DESTDIR=$(RPC_INST_DIR) && make install-pylib'

cd $(SAI)/test/saithriftv2 && export DESTDIR=$(RPC_INST_DIR) && make install-pylib
# Copy auto-generated python SAI thrift library to your Test controller host.
cp $(SAI)/test/saithriftv2/dist/saithrift-0.9.tar.gz $(RPC_INST_DIR)
$(SUDO) cp $(SAI)/test/saithriftv2/dist/saithrift-0.9.tar.gz $(RPC_INST_DIR)

# Copy thrift libs from builder image onto host
cp /usr/lib/libthrift*so* /usr/lib/thrift-0.11.0.tar.gz $(RPC_INST_DIR)
chmod -R a+w $(META)/generated $(META)/html $(META)/xml $(RPC_INST_DIR)
$(SUDO) cp /usr/lib/libthrift*so* /usr/lib/thrift-0.11.0.tar.gz $(RPC_INST_DIR)

saithrift-server-clean: host
$(SUDO) bash -c 'cd $(SAI) && export SAITHRIFTV2=y && make clean'
$(SUDO) rm -rf $(SAI)/test/saithriftv2/gen-cpp/
$(SUDO) rm -rf $(SAI)/test/saithriftv2/obj/
$(SUDO) rm -rf $(RPC_INST_DIR)

saithrift-server-clean:
cd $(SAI) && export SAITHRIFTV2=y && make clean
rm -rf $(SAI)/test/saithriftv2/gen-cpp/
rm -rf $(SAI)/test/saithriftv2/obj/
rm -rf $(RPC_INST_DIR)

clean: saithrift-server-clean
56 changes: 13 additions & 43 deletions dash-pipeline/SAI/templates/Makefile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,52 +50,22 @@ CXXFLAGS_COMMON+= -Wno-unused-label

# Sources from OCP SAI Repo:
SAI_DIR=../SAI/meta/
SAI_SRCS=saimetadatautils.c \
saimetadata.c \
saiserialize.c
SAI_INC=-I../SAI/meta -I../SAI/inc -I../SAI/experimental

SAI_SRC_PATHS=$(addprefix $(SAI_DIR),$(SAI_SRCS))
SAI_OBJS=$(SAI_SRCS:.c=.o)
SAI_OBJS=saimetadatautils.o saimetadata.o saiserialize.o
SAI_OBJS_PATHS=$(addprefix $(SAI_DIR)/,$(SAI_OBJS))

# DASH libsai "fixed" sources (not generated from P4 code)
DASH_FIXED_SAI_SRCS=utils.cpp \
saifixedapis.cpp \
logger.cpp \
config.cpp \
dashsai.cpp
DASH_FIXED_SAI_OBJ=$(DASH_FIXED_SAI_SRCS:.cpp=.o)
DASH_SAI_SRCS=$(wildcard *.cpp)
DASH_SAI_OBJS=$(DASH_SAI_SRCS:.cpp=.o)

# DASH libsai "generated" sources (from P4 code)
DASH_GEN_SAI_SRCS={% for api in api_names %}sai{{ api }}.cpp {% endfor %}
DASH_GEN_SAI_OBJ=$(DASH_GEN_SAI_SRCS:.cpp=.o)
%.o: %.cpp
g++ $(SAI_INC) $(GXX_FLAGS) $(CXXFLAGS_COMMON) -c $< -o $@

libsai.so: $(DASH_FIXED_SAI_SRCS) $(DASH_GEN_SAI_SRCS)
gcc \
-fPIC \
-c \
-I ../SAI/meta/ \
-I ../SAI/inc/ \
-I ../SAI/experimental/ \
$(GXX_FLAGS) \
$(SAI_SRC_PATHS)
all: libsai.so

g++ \
-fpermissive \
-c \
-I ../SAI/meta/ \
-I ../SAI/inc/ \
-I ../SAI/experimental/ \
-fPIC \
-g \
$(CXXFLAGS_COMMON) \
$(GXX_FLAGS) \
$(DASH_FIXED_SAI_SRCS) \
$(DASH_GEN_SAI_SRCS)
libsai.so: $(SAI_OBJS_PATHS) $(DASH_SAI_OBJS)
g++ -shared -g -o $@ $^

g++ \
-shared \
-g \
-o libsai.so \
$(DASH_FIXED_SAI_OBJ) \
$(DASH_GEN_SAI_OBJ) \
$(SAI_OBJS)
.PHONY: clean
clean:
rm -f *.o libsai.so
8 changes: 8 additions & 0 deletions dash-pipeline/SAI/templates/dashsai.cpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,14 @@ sai_status_t DashSai::getPortAttribute(

break;

case SAI_PORT_ATTR_OPER_STATUS:

attr->value.s32 = SAI_PORT_OPER_STATUS_UP;

DASH_LOG_NOTICE("[%d] setting SAI_PORT_ATTR_OPER_STATUS=SAI_PORT_OPER_STATUS_UP for port %lx", i, port_id);

break;

default:

if (getenv(DASH_USE_NOT_SUPPORTED))
Expand Down
6 changes: 5 additions & 1 deletion dash-pipeline/SAI/templates/saifixedapis.cpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ sai_port_api_t dash_sai_port_api_impl = {
.create_ports = 0,
.remove_ports = 0,
.set_ports_attribute = 0,
.get_ports_attribute = 0
.get_ports_attribute = 0,
.create_port_serdess = 0,
.remove_port_serdess = 0,
.set_port_serdess_attribute = 0,
.get_port_serdess_attribute = 0,
};

sai_status_t sai_api_query(
Expand Down
3 changes: 2 additions & 1 deletion dash-pipeline/tests/libsai/init_switch/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
init_switch
init_switch
*.o
Loading

10 comments on commit 3bbe99f

@AmithGspn
Copy link
Collaborator

@AmithGspn AmithGspn commented on 3bbe99f Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there is a problem with "make all" command after this commit.
@kcudnik @chrispsommers It says "useradd: UID 0 is not unique" and stops the execution of the command.

@kcudnik
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there is a problem with "make all" command after this commit. @kcudnik @chrispsommers It says "useradd: UID 0 is not unique" and stops the execution of the command.

What are the steps when you build this ? Since pipeline on github build this Ok, are you building this as root?

@AmithGspn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea I am running with command "sudo make all" I get this error

sudo groupadd -f -r -g 0 hostgroup
sudo useradd hostuser -l -u 0 -g 0 -d /dash/dash-pipeline/SAI/saithrift -m -s /usr/bin/bash
useradd: UID 0 is not unique
make: *** [Makefile:23: host] Error 4
make: *** [Makefile:265: saithrift-server] Error 2

@AmithGspn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The steps I took to run this

  1. I pulled the latest commit and ran the "sudo make all" command which gave me this error

@chrispsommers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AmithGspn Why are you using sudo before make all? It seems that if you just avoided doing that in the first place there would be no issue.

@AmithGspn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason to use sudo before make all is due to few permission issues.

g++ -I../SAI/meta -I../SAI/inc -I../SAI/experimental -ansi -fPIC -pipe -std=c++11 -Wall -Wcast-align -Wcast-qual -Wconversion -Wdisabled-optimization -Wextra -Wfloat-equal -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Wno-inline -Winvalid-pch -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wno-aggregate-return -Wno-padded -Wno-switch-enum -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wstack-protector -Wstrict-aliasing=3 -Wswitch -Wswitch-default -Wunreachable-code -Wunused -Wvariadic-macros -Wwrite-strings -Wno-switch-default -Wconversion -Wno-psabi -Wno-unused-label -M config.cpp -o config.d
cc1plus: fatal error: opening output file config.d: Permission denied
compilation terminated.
g++ -I../SAI/meta -I../SAI/inc -I../SAI/experimental -ansi -fPIC -pipe -std=c++11 -Wall -Wcast-align -Wcast-qual -Wconversion -Wdisabled-optimization -Wextra -Wfloat-equal -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Wno-inline -Winvalid-pch -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wno-aggregate-return -Wno-padded -Wno-switch-enum -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wstack-protector -Wstrict-aliasing=3 -Wswitch -Wswitch-default -Wunreachable-code -Wunused -Wvariadic-macros -Wwrite-strings -Wno-switch-default -Wconversion -Wno-psabi -Wno-unused-label -M utils.cpp -o utils.d
cc1plus: fatal error: opening output file utils.d: Permission denied
compilation terminated.
g++ -I../SAI/meta -I../SAI/inc -I../SAI/experimental -ansi -fPIC -pipe -std=c++11 -Wall -Wcast-align -Wcast-qual -Wconversion -Wdisabled-optimization -Wextra -Wfloat-equal -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Wno-inline -Winvalid-pch -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wno-aggregate-return -Wno-padded -Wno-switch-enum -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wstack-protector -Wstrict-aliasing=3 -Wswitch -Wswitch-default -Wunreachable-code -Wunused -Wvariadic-macros -Wwrite-strings -Wno-switch-default -Wconversion -Wno-psabi -Wno-unused-label -M sai_dash_hostif.cpp -o sai_dash_hostif.d
cc1plus: fatal error: opening output file sai_dash_hostif.d: Permission denied
compilation terminated.
g++ -I../SAI/meta -I../SAI/inc -I../SAI/experimental -ansi -fPIC -pipe -std=c++11 -Wall -Wcast-align -Wcast-qual -Wconversion -Wdisabled-optimization -Wextra -Wfloat-equal -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Wno-inline -Winvalid-pch -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wno-aggregate-return -Wno-padded -Wno-switch-enum -Wno-unused-parameter -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wstack-protector -Wstrict-aliasing=3 -Wswitch -Wswitch-default -Wunreachable-code -Wunused -Wvariadic-macros -Wwrite-strings -Wno-switch-default -Wconversion -Wno-psabi -Wno-unused-label -M dashsai.cpp -o dashsai.d
cc1plus: fatal error: opening output file dashsai.d: Permission denied

saidashoutboundcatopa.cpp: At global scope:
saidashoutboundcatopa.cpp:308:2: fatal error: opening dependency file saidashoutboundcatopa.d: Permission denied
308 | };
| ^

  The above listed are errors encountered without the use of sudo 

@kcudnik
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use sudo, make all with my change will build with user permissions just fine, sudo will create files that are owned by root, and docker processes will not have permissions to write them

@AmithGspn
Copy link
Collaborator

@AmithGspn AmithGspn commented on 3bbe99f Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My latest comment was executed without sudo command but still it is giving permission issues. It is throwing error.
For make clean to it throw errors

amith@amith:/DASH/dash-pipeline$ make clean
docker kill dash-saithrift-server-amith
Error response from daemon: Cannot kill container: dash-saithrift-server-amith: No such container: dash-saithrift-server-amith
make: [Makefile:287: kill-saithrift-server] Error 1 (ignored)
docker kill simple_switch-amith
Error response from daemon: Cannot kill container: simple_switch-amith: No such container: simple_switch-amith
make: [Makefile:257: kill-switch] Error 1 (ignored)
cd ../test/third-party/traffic_gen && ./undeploy_ixiac.sh
.
docker kill dash-saichallenger-client-amith
Error response from daemon: Cannot kill container: dash-saichallenger-client-amith: No such container: dash-saichallenger-client-amith
make: [Makefile:738: kill-saichallenger-client] Error 1 (ignored)
rm -rf bmv2/dash_pipeline.bmv2
Initializing SAI submodule...
git submodule update --init
Initializing SAI submodule...
cd SAI/SAI/test && git submodule update --init ptf
rm -rf SAI/lib/*
docker images --format "{{.Repository}}:{{.Tag}}" | grep sonicdash.azurecr.io/dash-saithrift-bldr:c5c74aeef3c || make docker-saithrift-bldr
sonicdash.azurecr.io/dash-saithrift-bldr:c5c74aeef3c
docker run -it --rm --name dash-saithrift-bldr-amith -v /home/amith/DASH/dash-pipeline/..:/dash -w /dash/dash-pipeline/SAI/saithrift -e SAIRPC_VENDOR_EXTRA_LIBS="" -u 4321:4321 -e HOST_USER=1000 -e HOST_GROUP=1000 sonicdash.azurecr.io/dash-saithrift-bldr:c5c74aeef3c
make saithrift-server-clean
sudo groupadd -f -r -g 1000 hostgroup
sudo useradd hostuser -l -u 1000 -g 1000 -d /dash/dash-pipeline/SAI/saithrift -m -s /usr/bin/bash
useradd: warning: the home directory /dash/dash-pipeline/SAI/saithrift already exists.
useradd: Not copying any file from skel directory into it.
sudo -u hostuser -g hostgroup bash -c 'cd /dash/dash-pipeline/SAI/saithrift/../SAI && export SAITHRIFTV2=y && make clean'
make -C meta clean
make[1]: Entering directory '/dash/dash-pipeline/SAI/SAI/meta'
rm -f *.o *
.*~ .tmp ..swp ..swo .bak sai.gv sai.svg .o.symbols doxygen.db .so
rm -f saimetadata.h saimetadatasize.h saimetadata.c saimetadatatest.c saiswig.i
rm -f saisanitycheck saimetadatatest saiserializetest saidepgraphgen sai_rpc_frontend
rm -f sai.thrift sai_rpc_server.cpp sai_adapter.py
rm -f .gcda .gcno .gcov
rm -rf xml html dist temp generated
make[1]: Leaving directory '/dash/dash-pipeline/SAI/SAI/meta'
make -C test clean
make[1]: Entering directory '/dash/dash-pipeline/SAI/SAI/test'
rm -f bin/basic_router obj/gtest.a obj/gtest_main.a obj/
.o
make -C sai_ut clean
make[2]: Entering directory '/dash/dash-pipeline/SAI/SAI/test/sai_ut'
rm -f ../bin/sai_ut_vr ../bin/sai_ut_rif ../bin/sai_ut_nh ../bin/sai_ut_nhg ../bin/sai_ut_nbr ../bin/sai_ut_route ../bin/sai_ut_fdb ../bin/sai_ut_vlan ../bin/sai_ut_lag ../bin/sai_ut_stp .o routing/.o switching/
.o
make[2]: Leaving directory '/dash/dash-pipeline/SAI/SAI/test/sai_ut'
make -C saithrift clean
make[2]: Entering directory '/dash/dash-pipeline/SAI/SAI/test/saithrift'
rm -rf ./src/obj ./src/gen-cpp ./src/gen-py saiserver dist
make[2]: Leaving directory '/dash/dash-pipeline/SAI/SAI/test/saithrift'
make -C saithriftv2 clean
make[2]: Entering directory '/dash/dash-pipeline/SAI/SAI/test/saithriftv2'
make -C ../../meta/ clean
make[3]: Entering directory '/dash/dash-pipeline/SAI/SAI/meta'
rm -f .o *~ .~ .tmp ..swp .
.swo .bak sai.gv sai
.svg .o.symbols doxygen.db *.so
rm -f saimetadata.h saimetadatasize.h saimetadata.c saimetadatatest.c saiswig.i
rm -f saisanitycheck saimetadatatest saiserializetest saidepgraphgen sai_rpc_frontend
rm -f sai.thrift sai_rpc_server.cpp sai_adapter.py
rm -f *.gcda *.gcno *.gcov
rm -rf xml html dist temp generated
make[3]: Leaving directory '/dash/dash-pipeline/SAI/SAI/meta'
rm -rf ./obj dist build saiserver MANIFEST gen-cpp gen-py sai_headers.py.bk
rm: cannot remove './obj/sai_rpc_server.o': Permission denied
rm: cannot remove './obj/saiserver.o': Permission denied
rm: cannot remove './obj/sai_types.o': Permission denied
rm: cannot remove './obj/librpcserver.a': Permission denied
rm: cannot remove './obj/sai_rpc.o': Permission denied
rm: cannot remove 'dist/saithrift-0.9.tar.gz': Permission denied
rm: cannot remove 'build/lib/sai_thrift/init.py': Permission denied
rm: cannot remove 'build/lib/sai_thrift/sai_adapter.py': Permission denied
rm: cannot remove 'build/lib/sai_thrift/sai_rpc.py': Permission denied
rm: cannot remove 'build/lib/sai_thrift/sai_headers.py': Permission denied
rm: cannot remove 'build/lib/sai_thrift/constants.py': Permission denied
rm: cannot remove 'build/lib/sai_thrift/ttypes.py': Permission denied
rm: cannot remove 'gen-cpp/sai_rpc_server.skeleton.cpp': Permission denied
rm: cannot remove 'gen-cpp/sai_types.h': Permission denied
rm: cannot remove 'gen-cpp/sai_constants.cpp': Permission denied
rm: cannot remove 'gen-cpp/sai_rpc.h': Permission denied
rm: cannot remove 'gen-cpp/sai_rpc.cpp': Permission denied
rm: cannot remove 'gen-cpp/sai_types.cpp': Permission denied
rm: cannot remove 'gen-cpp/sai_constants.h': Permission denied
rm: cannot remove 'gen-py/init.py': Permission denied
rm: cannot remove 'gen-py/sai/init.py': Permission denied
rm: cannot remove 'gen-py/sai/sai_adapter.py': Permission denied
rm: cannot remove 'gen-py/sai/sai_rpc-remote': Permission denied
rm: cannot remove 'gen-py/sai/sai_rpc.py': Permission denied
rm: cannot remove 'gen-py/sai/sai_headers.py': Permission denied
rm: cannot remove 'gen-py/sai/constants.py': Permission denied
rm: cannot remove 'gen-py/sai/ttypes.py': Permission denied
make[2]: *** [Makefile:133: clean] Error 1
make[2]: Leaving directory '/dash/dash-pipeline/SAI/SAI/test/saithriftv2'
make[1]: *** [Makefile:59: clean] Error 2
make[1]: Leaving directory '/dash/dash-pipeline/SAI/SAI/test'
make: *** [Makefile:56: clean] Error 2
make: *** [Makefile:61: saithrift-server-clean] Error 2
make: *** [Makefile:295: saithrift-server-clean] Error 2
amith@amith:~/DASH/dash-pipeline$

@kcudnik
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you clean your repo? probably there are already files created with root like this "*.d" files, please do sudo make clean, and then find for files with uid 0, you should have none

@AmithGspn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, your above suggestion helped me out. I removed the complete DASH folder and built from scratch.

Thank you @kcudnik @chrispsommers

Please sign in to comment.