Package Details: ns3 3.40-3

Git Clone URL: https://aur.archlinux.org/ns3.git (read-only, click to copy)
Package Base: ns3
Description: Discrete-event network simulator for Internet systems
Upstream URL: http://www.nsnam.org/
Licenses: GPL2
Conflicts: ns3-hg
Provides: clickrouter, cppyy, ns3
Submitter: yhfudev
Maintainer: kyechou (yhfudev)
Last Packager: kyechou
Votes: 9
Popularity: 0.48
First Submitted: 2015-10-07 15:56 (UTC)
Last Updated: 2024-07-06 17:19 (UTC)

Latest Comments

1 2 3 Next › Last »

xh-ch commented on 2024-09-05 22:15 (UTC) (edited on 2024-09-06 07:15 (UTC) by xh-ch)

There are severel problems with the build-process of the underlying project. However, I was able to successfully build it on a recent Arch-installation, by applying some patches. Note the list of problems that occured:

  • The waflib-file within this project is not compatible with any python installation starting from python3.4. This has been fixed by waf.io long time ago. But the project-maintainer need to update! My change fixes it by applying a patch to the waf-file (which is specifically NOT recommended)

  • The build-process of ns3 relies on gzcat and uses in their dockerfile just a symlink to zcat. I applied this to the PKGBUILD-file here

  • The install-step in building this package somehow misses the python-bindings (again a problem by the upstream project). I therefore added a manual installation

However, I haven't seen the NS3_BINDINGS_INSTALL_DIR was not set-error, reported previously. Also note: if you have installed the package on your system, rebuilding it will fail with a problem on applying cppyy-cling-6.27.1.patch. I haven't investigated it further, but this should be fixed as well.

None of these points have so far been reported upstream, also because I have'nt found a channel to do so. Feel free to report them.

Here are my suggested changes:

diff --git a/PKGBUILD b/PKGBUILD
index 17aadf1..6cc38a3 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -43,6 +43,7 @@ source=("https://www.nsnam.org/releases/ns-allinone-$pkgver.tar.bz2"
         "https://files.pythonhosted.org/packages/source/c/cppyy-backend/cppyy-backend-$_cppyy_backend_ver.tar.gz"
         "https://files.pythonhosted.org/packages/source/C/CPyCppyy/CPyCppyy-$_cpycppyy_ver.tar.gz"
         "ns3-scratch-nested-subdir.patch"
+        "ns3-openflow-importlib.patch"
         "cppyy-cling-6.27.1.patch"
         "brite.tar.gz::https://code.nsnam.org/BRITE/archive/tip.tar.gz"
         "openflow.tar.gz::https://code.nsnam.org/openflow/archive/tip.tar.gz"
@@ -52,6 +53,7 @@ sha256sums=('c0ba395b6fcb084c4d43d6117b28932f716b26aebb54498ce2f44c0c39be3e60'
             '51ac01c4cca28ef54544ce0b41355d885242f1a0178619bea071f5c43fd03dac'
             '19188585eda3538eb69d32fd3fa9db0cc85a6031b6ca6955efff8051b798a73e'
             '20daecc727ac793732be25d5a2977f72c8edaa5c01720d5999069936cfe9d292'
+            '8cad25914a9365fff25e1c47af3062ebc15d3bf5246e73f02090a6d21b661ef2'
             '2577f9db94474acf3f804cc9c38f1dfe8367e0e4a35888cb09407d40d372727f'
             'SKIP'
             'SKIP'
@@ -67,12 +69,24 @@ prepare() {
         -e '/split_hdr_size/d'
     patch -Np1 -i "$srcdir/ns3-scratch-nested-subdir.patch"

+    openflow_dir="$(realpath "$srcdir"/openflow-*)"
+    cd "$openflow_dir"
+    patch -Np1 -i "$srcdir/ns3-openflow-importlib.patch"
+
     # https://github.com/kohler/click/issues/493
     cd "$srcdir/click-git"
     sed -i -e '/linux_true/d' include/click/cxxprotect.h
+
+    venv_dir="$srcdir/.venv"
+    rm -rf "$venv_dir" # cleanup from potential previous builds
 }

 build() {
+    build_bin_dir="$srcdir/.bin"
+    mkdir -p "$build_bin_dir"
+    ln -sf /bin/zcat "$build_bin_dir/gzcat"
+    PATH="$PATH:$build_bin_dir"
+
     # brite
     # https://www.nsnam.org/docs/models/html/brite.html
     brite_dir="$(realpath "$srcdir"/BRITE-*)"
@@ -222,6 +236,10 @@ package() {
         -e "s,;$srcdir,,g" \
         -e "s,-I$srcdir,,g" \
         "${FILES[@]}"
+
+    # Python bindings
+    python_dir="$(ls "$pkgdir"/usr/lib/ | grep python*)"
+    install -Dm755 ./bindings/python/ns__init__.py "$pkgdir"/usr/lib/"$python_dir"/site-packages/ns/__init__.py
 }

 # vim: set ts=4 sw=4 et :
diff --git a/ns3-openflow-importlib.patch b/ns3-openflow-importlib.patch
new file mode 100644
index 0000000..5372025
--- /dev/null
+++ b/ns3-openflow-importlib.patch
@@ -0,0 +1,28 @@
+diff --git a/waf b/waf
+index 3d0f216..2b03280 100755
+--- a/waf
++++ b/waf
+@@ -30,7 +30,7 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ """
+ 
+-import os, sys, inspect
++import os, sys, inspect, fileinput
+ 
+ VERSION="2.0.18"
+ REVISION="ff4ae9f5cc05353d3dc3aeff8854ae69"
+@@ -157,6 +157,14 @@ def find_lib():
+ 
+       #unpack
+       unpack_wafdir(dir, src)
++
++      for line in fileinput.input(dir + "/waflib/Context.py", inplace=True):
++              if line.startswith('import os,re,imp,sys'):
++                      print('import os,re,sys\nimport types')
++              elif line.startswith('\tmodule=imp.new_module(WSCRIPT_FILE)'):
++                      print('\tmodule=types.ModuleType(\'WSCRIPT_FILE\')')
++              else:
++                      print(line, end='')
+       return dir
+ 
+ wafdir = find_lib()

maelstrom799 commented on 2024-02-22 04:43 (UTC)

I tried installing the package but i get this error:

Can't exec "gzcat": No such file or directory at ./click-elem2man line 1316.

To fix this i symlinked gzcat to zcat but now i get this error:

gzip: /home/maelstrom/.cache/yay/ns3/src/click-git/install/share/man/man7/FilterFailures.7click.gz: No such file or directory

And later on i get this warning:

-- NS3_BINDINGS_INSTALL_DIR was not set. The visualizer python module won't be installed with ./ns3 install.

and then the install ends abruptly with this error:

-- ---- Summary of ns-3 settings:
Build profile                 : default
Build directory               : /home/maelstrom/.cache/yay/ns3/src/ns-allinone-3.40/ns-3.40/build
Build with runtime asserts    : ON
Build with runtime logging    : ON
Build version embedding       : ON
BRITE Integration             : ON
DES Metrics event collection  : OFF (not requested)
DPDK NetDevice                : ON
Emulation FdNetDevice         : ON
Examples                      : ON
File descriptor NetDevice     : ON
GNU Scientific Library (GSL)  : ON
GtkConfigStore                : ON
LibXml2 support               : ON
MPI Support                   : ON
ns-3 Click Integration        : ON
ns-3 OpenFlow Integration     : ON
Netmap emulation FdNetDevice  : OFF (missing dependency)
PyViz visualizer              : ON
Python Bindings               : ON
SQLite support                : ON
Eigen3 support                : ON
Tap Bridge                    : ON
Tap FdNetDevice               : ON
Tests                         : ON


Modules configured to be built:
antenna                   aodv                      applications
bridge                    brite                     buildings
click                     config-store              core
csma                      csma-layout               dsdv
dsr                       energy                    fd-net-device
flow-monitor              internet                  internet-apps
lr-wpan                   lte                       mesh
mobility                  mpi                       netanim
network                   nix-vector-routing        olsr
openflow                  point-to-point            point-to-point-layout
propagation               sixlowpan                 spectrum
stats                     tap-bridge                test
topology-read             traffic-control           uan
virtual-net-device        visualizer                wifi
wimax


-- Configuring done (23.6s)
-- Generating done (1.8s)
-- Build files have been written to: /home/maelstrom/.cache/yay/ns3/src/ns-allinone-3.40/ns-3.40/cmake-cache
Finished executing the following commands:
mkdir cmake-cache
cd cmake-cache; /usr/bin/cmake -DPython3_LIBRARY_DIRS=/usr/lib -DPython3_INCLUDE_DIRS=/usr/include/python3.11 -DPython3_EXECUTABLE=/home/maelstrom/.cache/yay/ns3/src/.venv/bin/python3 -DCMAKE_BUILD_TYPE=default -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=OFF -DNS3_NATIVE_OPTIMIZATIONS=OFF -DNS3_DPDK=ON -DNS3_EIGEN=ON -DNS3_ENABLE_BUILD_VERSION=ON -DNS3_EXAMPLES=ON -DNS3_GSL=ON -DNS3_GTK3=ON -DNS3_LOG=ON -DNS3_MONOLIB=ON -DNS3_MPI=ON -DNS3_PYTHON_BINDINGS=ON -DNS3_TESTS=ON -DNS3_WITH_BRITE=/home/maelstrom/.cache/yay/ns3/src/BRITE-30338f4f63b9 -DNS3_WITH_CLICK=/home/maelstrom/.cache/yay/ns3/src/click-git/install -DNS3_WITH_OPENFLOW=/home/maelstrom/.cache/yay/ns3/src/openflow-d45e7d184151 -DCMAKE_INSTALL_PREFIX=/usr -G Ninja .. ; cd ..
[0/2] Re-checking globbed directories...
[16/1998] Linking CXX executable ns3.40-stdlib_pch_exec-default
FAILED: ns3.40-stdlib_pch_exec-default
: && /usr/bin/c++ -march=native -O3 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -O2 -g -DNDEBUG -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto    -fuse-ld=lld CMakeFiles/stdlib_pch_exec.dir/build-support/empty-main.cc.o -o ns3.40-stdlib_pch_exec-default -L/home/maelstrom/.cache/yay/ns3/src/ns-allinone-3.40/ns-3.40/build/lib  && :
ld.lld: error: undefined symbol: main
>>> referenced by /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../lib/Scrt1.o:(_start)
collect2: error: ld returned 1 exit status
[30/1998] Building CXX object src/test/CMakeF...raced/traced-callback-typedef-test-suite.cc.o
ninja: build stopped: subcommand failed.
Finished executing the following commands:
cd cmake-cache; /usr/bin/cmake --build . -j 15 ; cd ..
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: ns3-exit status 4
 -> Failed to install the following packages. Manual intervention is required:
ns3 - exit status 4

I'm not quite sure what to do for "manual intervention"

NTickiTavi commented on 2024-02-02 16:42 (UTC)

@kyechou thanks alot, the download worked 100%, I'm just not sure how to use the package to run cpp files, ns3 does not run, and if I use g++ alot of the classes are not recognized, I tried using -L ns3, also didn't work, I couldn't find any documentation for this exact package, just for the ns3 compiler as a whole, if there's some documentation that I'm missing just point me to it and I'll be out of your hair.

kyechou commented on 2024-01-28 17:13 (UTC)

Hi @NTickiTavi, thanks for letting me know! I've updated the checksum and it should be fixed now.

NTickiTavi commented on 2024-01-28 15:39 (UTC)

Hello, currently on a fresh manjaro-xfce install, used normal yay -S to install and agreed to all dependencies, but cppyy 2.4.2 always fails to verify, I tried manually getting the file and putting in the build directory, same issue, not sure if I'm doing anything wrong, just thought I'd give some feedback

kyechou commented on 2024-01-10 22:50 (UTC)

Hi @danielphan2003, I've updated the package to 3.40 and also included cppyy 2.4.2 as provided by the package. Please let me know if the Python bindings are working or not. Thanks!

danielphan2003 commented on 2023-10-05 03:34 (UTC)

The latest build (https://aur.archlinux.org/cgit/aur.git/commit/?h=ns3&id=c56f59343ba35c968e99bb30692c0ff5f69174cb) doesn't recognize Pything bindings since ns3 v3.37+ uses cppyy instead of pybindgen.

I'm not sure why manually downgrading cppyy and its dependencies doesn't make ns3 recognizes them while building, as they pinned cppyy version to v2.4.2 (https://www.nsnam.org/docs/manual/html/python.html#using-the-bindings-from-the-ns-3-source) due to an issue with callbacks on v3.0.0 (https://gitlab.com/nsnam/ns-3-dev/-/issues/908).

doclai commented on 2023-04-20 07:35 (UTC)

This is the error I got when compiling the first.cc with ns3: /usr/bin/ld: /tmp/ccLRnrJX.o: warning: relocation against_ZN3ns34Time14g_markingTimesE' in read-only section .text._ZN3ns34TimeD2Ev[_ZN3ns34TimeD5Ev]' ... /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status Anyone know how to deal with this?

kyechou commented on 2022-04-21 14:53 (UTC)

Hi @lumpus, thanks for letting me know, but the error is not related to this package. Please report the error to https://aur.archlinux.org/packages/pygoocanvas.

FabioLolix commented on 2022-04-20 19:28 (UTC)

Renaming to the same name is pointless (pygoocanvas::)