diff --git a/src/fd-net-device/wscript b/src/fd-net-device/wscript index aa6102213..1ff6ee8f9 100644 --- a/src/fd-net-device/wscript +++ b/src/fd-net-device/wscript @@ -29,29 +29,35 @@ def configure(conf): True, "FdNetDevice module enabled") - # Check if libdpdk is installed as package - have_dpdk_pkg = conf.check_cfg(package='libdpdk', uselib_store='DPDK', + # Check if dpdk environment variables are set. Also check if we have correct paths set. + env_rte_sdk = os.environ.get('RTE_SDK', '') + env_rte_target = os.environ.get('RTE_TARGET', '') + have_dpdk_src = env_rte_sdk != '' and env_rte_target != '' and \ + os.path.exists(os.path.join(env_rte_sdk, env_rte_target, 'include/rte_eal.h')) and \ + os.path.exists(os.path.join(env_rte_sdk, env_rte_target, 'lib/librte_eal.so')) + + have_dpdk_pkg = False + if not have_dpdk_src: + # Check if libdpdk is installed as package + have_dpdk_pkg = conf.check_cfg(package='libdpdk', uselib_store='DPDK', args=['--cflags', '--libs'], mandatory=False) - # Check if dpdk environment variables are set - have_dpdk_src = os.environ.get('RTE_SDK', '') != '' and \ - os.environ.get('RTE_TARGET', '') != '' conf.env['ENABLE_DPDKNETDEV'] = have_dpdk_pkg or have_dpdk_src if conf.env['ENABLE_DPDKNETDEV']: # Set DPDK Lib Mode. pkg if the package if installed or src if built from source. dpdk_lib_mode = 'pkg' if have_dpdk_pkg else 'src' - conf.env.append_value('DPDK_LIB_MODE', dpdk_lib_mode) - conf.env.append_value('DEFINES', 'NS3_DPDK') + conf.env.append_value('DPDK_LIB_MODE', [dpdk_lib_mode]) + conf.env.append_value('DEFINES', ['NS3_DPDK']) conf.report_optional_feature("DpdkNetDevice", - "DPDK NetDevice", + "DPDK NetDevice (using {0} DPDK)".format("package" if have_dpdk_pkg else "source"), True, - "DpdkNetDevice module enabled") + "DPDKNetDevice module enabled") else: conf.report_optional_feature("DpdkNetDevice", "DPDK NetDevice", False, - "libdpdk not found, $RTE_SDK and/or $RTE_TARGET environment variable not set") + "libdpdk not found, $RTE_SDK and/or $RTE_TARGET environment variable not set or incorrect") else: conf.report_optional_feature("FdNetDevice", "File descriptor NetDevice", @@ -70,12 +76,12 @@ def configure(conf): conf.env.append_value('NS3_EXECUTABLE_PATH', dir) if conf.env['ENABLE_DPDKNETDEV']: - if conf.env['DPDK_LIB_MODE'] == 'src': + if 'src' in conf.env['DPDK_LIB_MODE']: dpdk_build = os.path.join(os.environ['RTE_SDK'], os.environ['RTE_TARGET']) conf.env.append_value('CXXFLAGS', ['-I' + os.path.join(dpdk_build, 'include'), '-mssse3']) conf.env.append_value('LINKFLAGS', ['-I' + os.path.join(dpdk_build, 'include')]) conf.env.append_value('LINKFLAGS', ['-L' + os.path.join(dpdk_build, 'lib')]) - conf.env.SHLIB_MARKER += ',-lrte_eal,-lrte_ethdev,-lrte_pmd_virtio,-lrte_pmd_e1000,-lrte_pmd_ixgbe,-lrte_pmd_i40e,-lnuma,-ldl,-lrte_mempool,-lrte_mbuf,-lrte_ring' + conf.env.SHLIB_MARKER += ',-lrte_eal,-lrte_ethdev,-lrte_pmd_virtio,-lrte_pmd_e1000,-lrte_pmd_ixgbe,-lrte_pmd_i40e,-lnuma,-ldl,-lrte_mempool,-lrte_mbuf,-lrte_ring,-lrte_kvargs,-lrte_net' else: # Add this module to the list of modules that won't be built # if they are enabled. @@ -186,7 +192,7 @@ def build(bld): headers.source.extend([ 'model/dpdk-net-device.h' ]) - if bld.env['DPDK_LIB_MODE'] == 'src': + if 'src' in bld.env['DPDK_LIB_MODE']: # Add DPDK libraries to library path dpdk_build = os.path.join(os.environ['RTE_SDK'], os.environ['RTE_TARGET']) if os.environ.get('LD_LIBRARY_PATH', '') == '':