【NS3】用Bake编译NS3-DCE
·
//Install Prerequisites
sudo apt update
sudo apt install -y git g++ python3 python3-dev \
python3-pip cmake mercurial \
libc6-dev libc6-dev-i386 gdb pkg-config \
autoconf cvs bzr unzip libclang-dev indent libc6-dbg libdb-dev libpcap-dev libsysfs-dev \
flex bison libc6-dbg libssl-dev gir1.2-goocanvas-2.0 libxml2-dev llvm-dev
pip install cxxfilt
python3 -m pip install --user cppyy
//Clone bake
cd ~
git clone https://gitlab.com/nsnam/bake.git
cd bake
//Download dce
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ ./bake.py configure -e dce-ns3-1.12
or emilin@EmilinAmy:~/ns3-dce-workspace/bake-test$ ./bake.py configure -e dce-linux-dev
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ ./bake.py check
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ ./bake.py show
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ ./bake.py download
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ ./bake.py build



Errors Occur:
(0) wsl space in string problem
//add following configuration to /etc/wsl.conf and reboot wsl
# Set whether WSL supports interop processes like launching Windows apps and adding path variables. Setting these to false will block the launch of Windows processes and block adding $PATH environment variables.
[interop]
enabled=false
appendWindowsPath=false
(1) gccxml-ns3 problem (replace every gccxml-ns3 dependency in bakeconf.xml to castxml)

(2) dce-quagga-dev problem
![]()
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ sudo apt install libreadline-dev libncurses-dev zlib1g-dev bison flex build-essential
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ ./bake.py configure -e dce-ns3-1.12 -e dce-quagga-1.12
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ ./bake.py download
//Doesn't work
cd source/ns-3-dce
./test.py -s dce-quagga
//Solution II
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ ./bake.py configure -e dce-ns3-dev -e dce-quagga-dev
emilin@EmilinAmy:~/ns3-dce-workspace/bake$ ./bake.py download
(3) cmake and gcc version problem while building ns-3-dev
emilin@EmilinAmy:~/ns3-dce-workspace/bake/source/ns-3-dev$ sudo snap install cmake --channel=3.31/stable --classic
emilin@EmilinAmy:~/ns3-dce-workspace/bake/source/ns-3-dev$ cmake --version
emilin@EmilinAmy:~/ns3-dce-workspace/bake/source/ns-3-dev$ cat /etc/os-release
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y gcc-11
emilin@EmilinAmy:~/ns3-dce-workspace/bake/source/ns-3-dce$ export CXX=/usr/bin/g++-11
emilin@EmilinAmy:~/ns3-dce-workspace/bake/source/ns-3-dce$ export CC=/usr/bin/gcc-11
emilin@EmilinAmy:~/ns3-dce-workspace/bake/source/ns-3-dce$ ./waf configure --with-ns3=/home/emilin/ns3-dce-workspace/bake/source/ns-3-dev --with-glibc=/usr/include
(4) glibc and header problems while building ns-3-dce
sudo apt update
sudo apt install build-essential libc6-dev libc6-dev-i386 g++-11
sudo apt install linux-libc-dev
sudo apt install g++-11-multilib
export BAKE_HOME=`pwd`/bake
export PATH=$PATH:$BAKE_HOME
export PYTHONPATH=$PYTHONPATH:$BAKE_HOME
cd bake
./bake.py configure -e dce-linux-dev # Use 'dce-ns3-dev' for basic mode (ns-3 TCP stacks only, no Linux kernel stack)
//replace
ns3inc = bld.env['INCLUDES_NS3_CORE'][0]
//with
ns3inc = '/home/emilin/ns3-dce-workspace/bake/source/ns-3-dev/build/include/ns3'
emilin@EmilinAmy:~/ns3-dce-workspace/bake/source/ns-3-dce$ CXXFLAGS="-I/usr/include -I/usr/include/x86_64-linux-gnu -I/home/emilin/ns3-dce-workspace/bake/source/ns-3-dev/build/include/ns3" ./waf configure --with-ns3=/home/emilin/ns3-dce-workspace/bake/source/ns-3-dev --with-glibc=/usr/include
(5) errors while building net-next-nuse-4.4.0
//edit bakeconf.xml
//From
<module name="net-next-nuse-4.4.0">
<source type="git">
<attribute name="url" value="https://github.com/libos-nuse/net-next-nuse.git"/>
<attribute name="module_directory" value="net-next-nuse-4.4.0"/>
<attribute name="revision" value="libos-v4.4"/>
<attribute name="fetch_option" value=""/>
</source>
<depends_on name="bc" optional="False"/>
<build type="make">
<!-- cherry-pick change from net-next-nuse commit 66866702d65-->
<attribute name="pre_installation" value="cd $SRCDIR; sed 's/git:/https:/' arch/lib/Makefile > tmp; mv tmp arch/lib/Makefile"/>
<attribute name="supported_os" value="linux;linux2"/>
<attribute name="configure_arguments" value="defconfig ARCH=lib"/>
<attribute name="build_arguments" value="library ARCH=lib -j40"/>
<attribute name="no_installation" value="True"/>
<attribute name="post_installation" value="mkdir -p $INSTALLDIR/bin_dce; cd $INSTALLDIR/bin_dce; cp $SRCDIR/arch/lib/tools/libsim-linux-4.7.0-rc5.so ./; ln -s -f libsim-linux-4.7.0-rc5.so liblinux.so"/>
</build>
</module>
//To
<module name="net-next-nuse-4.4.0">
<source type="git">
<attribute name="url" value="https://github.com/libos-nuse/net-next-nuse.git"/>
<attribute name="module_directory" value="net-next-nuse-4.4.0"/>
<attribute name="branch" value="libos-v4.7-wip"/> #!!! this line
<attribute name="fetch_option" value=""/>
</source>
<depends_on name="bc" optional="False"/>
<build type="make">
<!-- cherry-pick change from net-next-nuse commit 66866702d65-->
<attribute name="pre_installation" value="cd $SRCDIR; sed 's/git:/https:/' arch/lib/Makefile > tmp; mv tmp arch/lib/Makefile"/>
<attribute name="supported_os" value="linux;linux2"/>
<attribute name="configure_arguments" value="defconfig ARCH=lib"/>
<attribute name="build_arguments" value="library ARCH=lib -j40"/>
<attribute name="no_installation" value="True"/>
<attribute name="post_installation" value="mkdir -p $INSTALLDIR/bin_dce; cd $INSTALLDIR/bin_dce; cp $SRCDIR/arch/lib/tools/libsim-linux-4.7.0-rc5.so ./; ln -s -f libsim-linux-4.7.0-rc5.so liblinux.so"/>
</build>
</module>
//Enable configuration file of ./bake.py -f bakeconf.xml build
//Edit bake/bake/Bake.py
def check_configuration_file(self, configFile, considersTemplate=False):
""" Checks if the configuration file exists, if not tries to use the
one on the root bake directory."""
return "/home/emilin/ns3-dce-workspace/bake/bakeconf.xml" // !!! Add this line
# If the name is not the default one... do not interfere
if configFile != "bakeconf.xml" and configFile != "bakefile.xml":
return configFile
# If the file is the default, and exists on the local directory, fine
if os.path.isfile(configFile):
return configFile
presentDir = os.path.dirname(sys.argv[0])
if not presentDir:
presentDir = "."
# if the file does not exist on the local directory
# tries the standard configuration file on the installation directory
if os.path.isfile(os.path.join(presentDir, configFile)):
return os.path.join(presentDir, configFile)
# if the standard file does not exist
# tries the generic configuration file on the installation directory
if considersTemplate and os.path.isfile(os.path.join(presentDir,
"bakeconf.xml")):
return os.path.join(presentDir,"bakeconf.xml")
# if everything else fail.... returns the same name
return configFile
options = ""
(6) 一个很重要的Fix, 对model/dce-stdio.cc文件的修改:
question regarding two security features
(7) dcemakever.c的问题
cp build/dcemakeversion build/dcemakeversion.bak
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 build/dcemakeversion
./build/dcemakeversion model/libc-ns3.version model/libpthread-ns3.version model/librt-ns3.version model/libm-ns3.version model/libdl-ns3.version
mv build/dcemakeversion.bak build/dcemakeversion
It works !!

更多推荐



所有评论(0)