Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ include(FindPkgConfig)
set(third_party_libraries
"bm"
"gmp"
"jsoncpp"
"libpcap"
"nanomsg"
"libxxhash"
"bmruntime"
"thrift"
)

# Initialize variables to collect sources and libraries
Expand Down Expand Up @@ -41,6 +47,23 @@ if(PKG_CONFIG_FOUND)
endforeach()
endif()

# Prefer pkg-config, but also add fallback libraries from /usr/local/lib
# to avoid unresolved BMv2/Thrift symbols when module names differ.
find_library(RUNTIMESTUBS_LIB runtimestubs PATHS /usr/local/lib)
if(RUNTIMESTUBS_LIB)
list(APPEND third_party_libs ${RUNTIMESTUBS_LIB})
endif()

find_library(BMRUNTIME_LIB bmruntime PATHS /usr/local/lib)
if(BMRUNTIME_LIB)
list(APPEND third_party_libs ${BMRUNTIME_LIB})
endif()

find_library(THRIFT_LIB thrift PATHS /usr/local/lib)
if(THRIFT_LIB)
list(APPEND third_party_libs ${THRIFT_LIB})
endif()

list(APPEND third_party_libs -L/usr/local/lib)

# Core module construction
Expand Down
6 changes: 6 additions & 0 deletions model/p4-core-pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
#include "ns3/register-access-v1model.h"
#include "ns3/simulator.h"

#undef LOG_INFO
#undef LOG_ERROR
#undef LOG_DEBUG
#undef LOG_WARN
#undef LOG_LOGIC

NS_LOG_COMPONENT_DEFINE("P4CoreV1modelPipeline");

namespace ns3
Expand Down
6 changes: 6 additions & 0 deletions model/p4-core-psa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@

NS_LOG_COMPONENT_DEFINE("P4CorePsa");

#undef LOG_INFO
#undef LOG_ERROR
#undef LOG_DEBUG
#undef LOG_WARN
#undef LOG_LOGIC

namespace ns3
{

Expand Down
6 changes: 6 additions & 0 deletions model/p4-core-v1model.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@

#define SSWITCH_VIRTUAL_QUEUE_NUM_V1MODEL 8

#undef LOG_INFO
#undef LOG_ERROR
#undef LOG_DEBUG
#undef LOG_WARN
#undef LOG_LOGIC

namespace ns3 {

class P4CoreV1model : public P4SwitchCore {
Expand Down
6 changes: 6 additions & 0 deletions model/p4-nic-pna.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
#include "ns3/p4-queue.h"
#include "ns3/p4-switch-core.h"

#undef LOG_INFO
#undef LOG_ERROR
#undef LOG_DEBUG
#undef LOG_WARN
#undef LOG_LOGIC

namespace ns3
{

Expand Down
22 changes: 22 additions & 0 deletions set_pkg_config_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ Version: 1.15.0
Libs: -L\${libdir} -lbmall
Cflags: -I\${includedir}" >/usr/local/lib/pkgconfig/bm.pc

echo "prefix=/usr/local
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=/usr/local/include/bm

Name: BMv2
Description: Behavioral Model
Version: 1.15.0
Libs: -L\${libdir} -lbmruntime
Cflags: -I\${includedir}" >/usr/local/lib/pkgconfig/bmruntime.pc

echo "prefix=/usr/lib/
exec_prefix=\${prefix}
libdir=\${exec_prefix}
Expand All @@ -32,3 +43,14 @@ Description: Behavioral Model Target Simple Switch
Version: 1.15.0
Libs: -L\${libdir} -lsimpleswitch_thrift
Cflags: -I\${includedir}" >/usr/local/lib/pkgconfig/simple_switch.pc

echo "prefix=/usr/local
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=/usr/local/include/bm

Name: psa switch
Description: Behavioral Model Target PSA Switch
Version: 1.15.0
Libs: -L\${libdir} -lpsaswitch_thrift
Cflags: -I\${includedir}" >/usr/local/lib/pkgconfig/psa_switch.pc
Empty file modified wscript
100644 → 100755
Empty file.