I'm installing ns-3.37 in my Unbuntu 22.04 on Macbook, after running
./build.py --enable-examples --enable-tests
I get error message
Entering directory `/media/psf/Home/Desktop/ns-allinone-3.37/./ns-3.37'
=> /usr/bin/python3 ns3 configure --enable-examples --enable-tests
Traceback (most recent call last):
File "/media/psf/Home/Desktop/ns-allinone-3.37/ns-3.37/ns3", line 1546, in <module>
main()
File "/media/psf/Home/Desktop/ns-allinone-3.37/ns-3.37/ns3", line 1435, in main
configuration_step(current_cmake_cache_folder,
File "/media/psf/Home/Desktop/ns-allinone-3.37/ns-3.37/ns3", line 927, in configuration_step
cmake, _ = cmake_check_version()
File "/media/psf/Home/Desktop/ns-allinone-3.37/ns-3.37/ns3", line 777, in cmake_check_version
if parse_version(version) < parse_version("3.10.0"):
File "/media/psf/Home/Desktop/ns-allinone-3.37/ns-3.37/ns3", line 765, in parse_version
version = tuple(map(int, version))
ValueError: invalid literal for int() with base 10: '0-rc4'
Traceback (most recent call last):
File "/media/psf/Home/Desktop/ns-allinone-3.37/./build.py", line 155, in <module>
sys.exit(main(sys.argv))
File "/media/psf/Home/Desktop/ns-allinone-3.37/./build.py", line 146, in main
build_ns3(config, build_examples, build_tests, args, build_options)
File "/media/psf/Home/Desktop/ns-allinone-3.37/./build.py", line 65, in build_ns3
run_command(cmd) # ns3 configure ...
File "/media/psf/Home/Desktop/ns-allinone-3.37/util.py", line 25, in run_command
raise CommandError("Command %r exited with code %i" % (argv, retval))
util.CommandError: Command ['/usr/bin/python3', 'ns3', 'configure', '--enable-examples', '--enable-tests'] exited with code 1
I have installed all the required surroundings like below
$ sudo apt install build-essential autoconf automake libxmu-dev g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev libc6-dev libc6-dev-i386 libclang-dev llvm-dev automake python3-pip libxml2 libxml2-dev libboost-all-dev
Would someone please tell me how to fix this problem?
The problem is that cmake
installed on your system has version 3.x.0-rc4. This is a bug in the ./ns3
script that it cannot parse 0-rc4
parse properly and expects it to be an integer.
You can try to run apt-get update && apt-get install cmake
and see if the version of cmake changes.
If nothing else, you can comment out or remove these lines in ./ns3
:
if parse_version(version) < parse_version("3.10.0"):
print("Error: CMake found at %s but version %s is older than 3.10" % (cmake, version))
exit(1)
(https://github.com/nsnam/ns-3-dev-git/blob/9a0d17186b80902f17e4927ba7126d9f57b48c95/ns3#L840-L842)
Then you can report the bug to ns-3 developers as it is actually a bug in the ./ns3
script they maintain.