named-data-ndnSIM / ndnSIM

ndnSIM: NS-3 based NDN simulator
GNU General Public License v3.0
107 stars 163 forks source link

ndnSIM 2.7 Compilation failed, SyntaxError: invalid syntax #92

Closed SifatTaj closed 5 years ago

SifatTaj commented 5 years ago

I am new to ndnSIM. I have been trying to compile ndnSIM 2.7 in my macOS and Linux machine. I am following the guide on http://ndnsim.net/current/getting-started.html

When I try to build without Python bindings, it compiles successfully, but with python I am getting the following error.

Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/usr/lib/python2.7/py_compile.py", line 117, in compile
    raise py_exc
py_compile.PyCompileError:   File "/usr/local/lib/python2.7/dist-packages/visualizer/base.py", line 134
    print("Could not load plugin %r: %s" % (filename, str(ex)), file=sys.stderr)
                                                                    ^
SyntaxError: invalid syntax

Can anyone please help me fix it?

My configuration,

Setting top to                           : /home/taj/ndnSIM/ns-3 
Setting out to                           : /home/taj/ndnSIM/ns-3/build 
Checking for 'gcc' (C compiler)          : /usr/bin/gcc 
Checking for cc version                  : 7.4.0 
Checking for 'g++' (C++ compiler)        : /usr/bin/g++ 
Checking supported compiler CXXFLAGS     : -std=c++14 
Checking supported optimizations CXXFLAGS : -O0 
Checking supported debug CXXFLAGS         : -ggdb -g3 
Checking supported warnings CXXFLAGS      : -Wall -Wno-error=deprecated-declarations -fstrict-aliasing -Wstrict-aliasing 
Checking for compilation flag -Wl,--soname=foo support : ok 
Checking for compilation flag -std=c++14 support       : ok 
Checking for program 'python'                          : /usr/bin/python 
Checking for python version >= 2.3                     : 2.7.15 
python-config                                          : /usr/bin/python-config 
Asking python-config for pyembed '--cflags --libs --ldflags' flags : yes 
Testing pyembed configuration                                      : yes 
Asking python-config for pyext '--cflags --libs --ldflags' flags   : yes 
Testing pyext configuration                                        : yes 
Checking for compilation flag -fvisibility=hidden support          : ok 
Checking for compilation flag -Wno-array-bounds support            : ok 
Checking for pybindgen location                                    : ../pybindgen (guessed) 
Checking for python module 'pybindgen'                             : 0.19.0.post4+g823d8b2 
Checking for pybindgen version                                     : 0.19.0.post4+g823d8b2 
Checking for code snippet                                          : yes 
Checking for types uint64_t and unsigned long equivalence          : no 
Checking for code snippet                                          : no 
Checking for types uint64_t and unsigned long long equivalence     : yes 
Checking for the apidefs that can be used for Python bindings      : gcc-LP64 
Checking for internal GCC cxxabi                                   : complete 
Checking for python module 'pygccxml'                              : 1.9.1 
Checking for pygccxml version                                      : 1.9.1 
Checking for program 'castxml'                                     : /usr/bin/castxml 
Checking for castxml version                                       : 0.1 
Checking boost includes                                            : 1_65_1 
Checking boost libs                                                : ok 
Checking for boost linkage                                         : ok 
Checking for click location                                        : not found 
Checking for program 'pkg-config'                                  : /usr/bin/pkg-config 
Checking for 'gtk+-3.0'                                            : not found 
Checking for 'libxml-2.0'                                          : not found 
checking for uint128_t                                             : not found 
checking for __uint128_t                                           : yes 
Checking high precision implementation                             : 128-bit integer (default) 
Checking for header stdint.h                                       : yes 
Checking for header inttypes.h                                     : yes 
Checking for header sys/inttypes.h                                 : not found 
Checking for header sys/types.h                                    : yes 
Checking for header sys/stat.h                                     : yes 
Checking for header dirent.h                                       : yes 
Checking for header stdlib.h                                       : yes 
Checking for header signal.h                                       : yes 
Checking for header pthread.h                                      : yes 
Checking for header stdint.h                                       : yes 
Checking for header inttypes.h                                     : yes 
Checking for header sys/inttypes.h                                 : not found 
Checking for library rt                                            : yes 
Checking for header sys/ioctl.h                                    : yes 
Checking for header net/if.h                                       : yes 
Checking for header net/ethernet.h                                 : yes 
Checking for header linux/if_tun.h                                 : yes 
Checking for header netpacket/packet.h                             : yes 
Checking for NSC location                                          : not found 
Checking for program 'doxygen'                                     : not found 
Checking for program 'tar'                                         : /bin/tar 
Checking for program 'sphinx-build'                                : not found 
Checking for std::to_string                                        : yes 
Checking for library pthread                                       : yes 
Checking for 'sqlite3'                                             : yes 
Checking for OpenSSL lib                                           : "OpenSSL 1.1.0g-fips  2 Nov 2017" 
Checking if OpenSSL library works                                  : yes 
Checking for OpenFlow location                                     : not found 
Checking for 'sqlite3'                                             : yes 
Checking for header linux/if_tun.h                                 : yes 
Checking for python module 'gi'                                    : 3.26.1 
Checking for python module 'gi.repository.GObject'                 : ok 
Checking for python module 'cairo'                                 : ok 
Checking for python module 'pygraphviz'                            : 1.4rc1 
Checking for python module 'gi.repository.Gtk'                     : ok 
Checking for python module 'gi.repository.Gdk'                     : ok 
Checking for python module 'gi.repository.Pango'                   : ok 
Checking for python module 'gi.repository.GooCanvas'               : ok 
Checking for program 'sudo'                                        : /usr/bin/sudo 
Checking for program 'valgrind'                                    : not found 
Checking for 'gsl'                                                 : not found 
python-config                                                      : not found 
Checking for program 'doxygen'                                     : not found 
---- Summary of optional NS-3 features:
Build profile                 : debug
Build directory               : 
BRITE Integration             : not enabled (BRITE not enabled (see option --with-brite))
DES Metrics event collection  : not enabled (defaults to disabled)
Emulation FdNetDevice         : enabled
Examples                      : enabled
File descriptor NetDevice     : enabled
GNU Scientific Library (GSL)  : not enabled (GSL not found)
Gcrypt library                : not enabled (libgcrypt not found: you can use libgcrypt-config to find its location.)
GtkConfigStore                : not enabled (library 'gtk+-3.0 >= 3.0' not found)
MPI Support                   : not enabled (option --enable-mpi not selected)
NS-3 Click Integration        : not enabled (nsclick not enabled (see option --with-nsclick))
NS-3 OpenFlow Integration     : not enabled (OpenFlow not enabled (see option --with-openflow))
Network Simulation Cradle     : not enabled (NSC not found (see option --with-nsc))
PlanetLab FdNetDevice         : not enabled (PlanetLab operating system not detected (see option --force-planetlab))
PyViz visualizer              : enabled
Python API Scanning Support   : enabled
Python Bindings               : enabled
Real Time Simulator           : enabled
SQlite stats data output      : enabled
Tap Bridge                    : enabled
Tap FdNetDevice               : enabled
Tests                         : not enabled (defaults to disabled)
Threading Primitives          : enabled
Use sudo to set suid bit      : not enabled (option --enable-sudo not selected)
XmlIo                         : not enabled (library 'libxml-2.0 >= 2.7' not found)
ndnSIM                        : enabled
spirosmastorakis commented 5 years ago

Please follow the latest instructions: http://ndnsim.net/current/

SifatTaj commented 5 years ago

Please follow the latest instructions: http://ndnsim.net/current/

Followed the latest instructions. Still the same issue

SifatTaj commented 5 years ago

I've fixed the issue. I had to edit the base.py file located in ndnSIM/ns-3/src/visualizer/visualizer

Change file=sys.stderr with file(sys.stderr) in line 134 and 139