diff --git a/flexsai/p4/backend/CMakeLists.txt b/flexsai/p4/backend/CMakeLists.txt index e352c20..b6d4336 100644 --- a/flexsai/p4/backend/CMakeLists.txt +++ b/flexsai/p4/backend/CMakeLists.txt @@ -72,8 +72,12 @@ add_library(saibackend ${SAI_BACKEND_SRCS}) add_dependencies(saibackend genIR) # for flextrum (json=>c api) add python support: -find_package(PythonLibs REQUIRED) +find_package(PythonInterp REQUIRED) +set(Python_ADDITIONAL_VERSIONS 3.6m) +find_package(PythonLibs 3 REQUIRED) +set (PYTHON_INCLUDE_DIRS /usr/include/python3.6m) include_directories(${PYTHON_INCLUDE_DIRS}) +set (PYTHON_LIBRARIES /usr/lib/x86_64-linux-gnu/libpython3.6m.so) add_executable(p4c-sai ${SAI_SRCS}) target_link_libraries (p4c-sai saibackend ${P4C_LIBRARIES} ${P4C_LIB_DEPS} ${PYTHON_LIBRARIES}) diff --git a/flexsai/p4/backend/json_stage/p4c_python.cpp b/flexsai/p4/backend/json_stage/p4c_python.cpp index 591e37b..a59097d 100644 --- a/flexsai/p4/backend/json_stage/p4c_python.cpp +++ b/flexsai/p4/backend/json_stage/p4c_python.cpp @@ -1,2 +1,2 @@ - std::string compiler_path = "/home/yonatanp/p4_16/p4c/extensions/sai"; + std::string compiler_path = "/home/hemant/bak/p4c/extensions/sai"; diff --git a/flexsai/p4/backend/json_stage/sai.cpp b/flexsai/p4/backend/json_stage/sai.cpp index e5feec0..e504c3b 100644 --- a/flexsai/p4/backend/json_stage/sai.cpp +++ b/flexsai/p4/backend/json_stage/sai.cpp @@ -138,7 +138,7 @@ int main_wrapper(int argc, char *const argv[]) { Py_SetProgramName(Py_DecodeLocale("sai_json_compiler", NULL)); Py_Initialize(); - PySys_SetArgv(py_argc, py_argv); + PySys_SetArgvEx(py_argc, py_argv, 0); std::string compiler = compiler_path + "/output_stage/P4_compiler.py"; FILE *fd = fopen(compiler.c_str(), "r"); // SAISRCDIR will be replaced in cmake