Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With p4c from today (11/29/2018) flexsai fails to build #896

Open
hesingh opened this issue Nov 30, 2018 · 3 comments
Open

With p4c from today (11/29/2018) flexsai fails to build #896

hesingh opened this issue Nov 30, 2018 · 3 comments

Comments

@hesingh
Copy link

hesingh commented Nov 30, 2018

I used the steps to build from https://github.com/opencomputeproject/SAI/tree/master/flexsai/p4/README.md.

The p4c used is from today. I see the following error on invoking 'make -j3' in p4c/build/

/home/hemant/bak/p4c/extensions/sai/json_stage/sai.cpp: In function ‘int main_wrapper(int, char* const*)’:
/home/hemant/bak/p4c/extensions/sai/json_stage/sai.cpp:128:18: error: ‘Py_DecodeLocale’ was not declared in this scope
py_argv[0] = Py_DecodeLocale("P4_compiler.py", NULL);
^~~~~~~~~~~~~~~
/home/hemant/bak/p4c/extensions/sai/json_stage/sai.cpp:128:18: note: suggested alternative: ‘PyEval_GetLocals’
py_argv[0] = Py_DecodeLocale("P4_compiler.py", NULL);
^~~~~~~~~~~~~~~
PyEval_GetLocals
/home/hemant/bak/p4c/extensions/sai/json_stage/sai.cpp:141:35: error: cannot convert ‘wchar_t**’ to ‘char**’ for argument ‘2’ to ‘void PySys_SetArgv(int, char**)’
PySys_SetArgv(py_argc, py_argv);
^
extensions/sai/CMakeFiles/p4c-sai.dir/build.make:62: recipe for target 'extensions/sai/CMakeFiles/p4c-sai.dir/json_stage/sai.cpp.o' failed
make[2]: *** [extensions/sai/CMakeFiles/p4c-sai.dir/json_stage/sai.cpp.o] Error 1
CMakeFiles/Makefile2:734: recipe for target 'extensions/sai/CMakeFiles/p4c-sai.dir/all' failed
make[1]: *** [extensions/sai/CMakeFiles/p4c-sai.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 98%] Linking CXX executable gtestp4c
[ 98%] Built target gtestp4c
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
hemant@ubuntu:~/bak/p4c/build$

@hesingh
Copy link
Author

hesingh commented Dec 1, 2018

The problem is that if one has python2.7 and also python 3.6m installed on their build machine, the flexsai cmake loses its brain. I had to force specific python3 path in flexsai/p4/backend/CMakeLists.txt and then compiling and linking passed. I also made one change to sai.cpp to fix compiling. Diffs are included as attached file.

diffs.txt

@hesingh
Copy link
Author

hesingh commented Dec 1, 2018

It also makes sense to remove all Python code from sai.cpp and just use C/C++ code. p4c code has long back changed to parsing options using p4c/frontend/common/options.cpp. Time permitting, I can make the code change. If anyone has cycles, please make the code change.

@hesingh
Copy link
Author

hesingh commented Dec 1, 2018

Maybe, more cleanup is needed.
Why does flexsai/p4 need this step before the build?

git checkout 6d265b2d15b927db522c08f36a60fe23784e8357

The commit is related to this PR: p4lang/p4c#1219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant