-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dash-pipeline] Refactor Makefiles (#432)
* [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
Showing
10 changed files
with
134 additions
and
154 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
init_switch | ||
init_switch | ||
*.o |
Oops, something went wrong.
3bbe99f
There was a problem hiding this comment.
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.
3bbe99f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the steps when you build this ? Since pipeline on github build this Ok, are you building this as root?
3bbe99f
There was a problem hiding this comment.
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
3bbe99f
There was a problem hiding this comment.
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
3bbe99f
There was a problem hiding this comment.
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
beforemake all
? It seems that if you just avoided doing that in the first place there would be no issue.3bbe99f
There was a problem hiding this comment.
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 | };
| ^
3bbe99f
There was a problem hiding this comment.
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
3bbe99f
There was a problem hiding this comment.
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.*~ .tmp ..swp ..swo .bak sai.gv sai.svg .o.symbols doxygen.db .sodocker 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 *
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$
3bbe99f
There was a problem hiding this comment.
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
3bbe99f
There was a problem hiding this comment.
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