.. include:: replace.txt .. highlight:: bash .. ======================================================================================== Current translation in Greek was done as a project of a ns3-related seminar organized by Greek Free/Open Source Software Society (ellak.gr) at University of Patras in 2014. The members of the translation team were: * Costas Deltouzos (costas.deltouzos@gmail.com) * Vasileios Dimitropoulos (vasdimitrop@upatras.gr) * Giorgos Kaffezas (kaffezas@ceid.upatras.gr) The team that is responsible for keeping the translation up-to-date consists of: # Vasileios Dimitropoulos (vasdimitrop@upatras.gr) # Giorgos Kaffezas (kaffezas@ceid.upatras.gr) # Nikos Stathopoulos (stathopou@ceid.upatras.gr) # Enea Tsanai (tsanai@ceid.upatras.gr) ---------------------------------------------------------------------------------------- > Current file was initially translated by [Vasileios Dimitropoulos]. > Last update was performed at 28-04-2015 by [Vasileios Dimitropoulos]. ======================================================================================== .. Getting Started Ξεκινώντας ---------- .. This section is aimed at getting a user to a working state starting with a machine that may never have had |ns3| installed. It covers supported platforms, prerequisites, ways to obtain |ns3|, ways to build |ns3|, and ways to verify your build and run simple programs. Η ενότητα αυτή έχει στόχο να πάρει ένα χρήστη σε μια κατάσταση εργασίας ξεκινώντας με μια μηχανή που μπορεί να μην είχε ποτέ εγκαταστήσει τον |ns3|. Καλύπτει υποστηριζόμενες πλατφόρμες, προϋποθέσεις, τους τρόπους να αποκτήσετε τον |ns3|, τους τρόπους για να οικοδομήσετε τον |ns3|, και τρόπους για να ελέγξετε την κατασκευή σας και να τρέξετε απλά προγράμματα. .. Overview Επισκόπηση ********** .. |ns3| is built as a system of software libraries that work together. User programs can be written that links with (or imports from) these libraries. User programs are written in either the C++ or Python programming languages. Ο |ns3| είναι χτισμένος ως ένα σύστημα βιβλιοθηκών λογισμικού που λειτουργούν μαζί. Τα προγράμματα χρηστών μπορούν να είναι γραμμένα τα οποία συνδέουν με (ή τις εισάγουν από) αυτές τις βιβλιοθήκες. Τα προγράμματα χρηστών γράφονται είτε σε C++ ή Python γλώσσες προγραμματισμού. .. |ns3| is distributed as source code, meaning that the target system needs to have a software development environment to build the libraries first, then build the user program. |ns3| could in principle be distributed as pre-built libraries for selected systems, and in the future it may be distributed that way, but at present, many users actually do their work by editing |ns3| itself, so having the source code around to rebuild the libraries is useful. If someone would like to undertake the job of making pre-built libraries and packages for operating systems, please contact the ns-developers mailing list. Ο |ns3| διανέμεται ως πηγαίος κώδικας, που σημαίνει ότι ο στόχος του συστήματος πρέπει να έχει ένα περιβάλλον ανάπτυξης λογισμικού για την κατασκευή αρχικά των βιβλιοθηκών, μετά χτίζετε το πρόγραμμα του χρήστη. Ο |ns3| θα μπορούσε αρχικά να διανέμεται ως προ-κατασκευασμένες βιβλιοθήκες για επιλεγμένα συστήματα, και στο μέλλον μπορεί να διανεμηθεί με αυτόν τον τρόπο, αλλά προς το παρόν, πολλοί χρήστες πραγματικά κάνουν τη δουλειά τους με την επεξεργασία του |ns3| όπως είναι, έτσι έχοντας τον πηγαίο κώδικα γύρω από την ανοικοδόμηση οι βιβλιοθήκες είναι χρήσιμες. Αν κάποιος θα ήθελε να αναλάβει την δουλειά προ-χτίζοντας βιβλιοθήκες και πακέτα για λειτουργικά συστήματα, παρακαλούμε επικοινωνήστε με τους NS-προγραμματιστές στην ενημερωτική λίστα. .. In the following, we'll look at two ways of downloading and building |ns3|. The first is to download and build an official release from the main web site. The second is to fetch and build development copies of |ns3|. We'll walk through both examples since the tools involved are slightly different. Στη συνέχεια, θα δούμε δύο τρόπους για τη λήψη και την οικοδόμηση του |ns3|. Το πρώτο είναι να κατεβάσετε και να οικοδομήσετε μια επίσημη έκδοση από την κύρια ιστοσελίδα. Το δεύτερο είναι να φέρετε και να οικοδομήσετε την ανάπτυξη αντιγράφων του |ns3|. Θα δούμε δύο παραδείγματα καθώς τα εργαλεία που περιέχονται είναι λίγο διαφορετικά. .. Downloading |ns3| Κατεβάζοντας τον |ns3| *********************** .. The |ns3| system as a whole is a fairly complex system and has a number of dependencies on other components. Along with the systems you will most likely deal with every day (the GNU toolchain, Mercurial, a text editor) you will need to ensure that a number of additional libraries are present on your system before proceeding. |ns3| provides a wiki page that includes pages with many useful hints and tips. One such page is the "Installation" page, http://www.nsnam.org/wiki/Installation. Το σύστημα του |ns3| στο σύνολό του είναι ένα αρκετά πολύπλοκο σύστημα και έχει έναν αριθμό εξαρτήσεων από άλλες συνιστώσες. Μαζί με τα συστήματα που πιθανότατα θα ασχολείστε κάθε μέρα (η εργαλειοθήκη GNU, Mercurial, έναν επεξεργαστή κειμένου - editor) θα χρειαστεί να εξασφαλίσετε ότι είναι παρών στο σύστημά σας πριν προχωρήσετε μια σειρά από πρόσθετες βιβλιοθήκες. Ο |ns3| παρέχει μία wiki σελίδα που περιλαμβάνει σελίδες με πολλές χρήσιμες συμβουλές και υποδείξεις. Μια τέτοια σελίδα είναι η σελίδα «Εγκατάσταση», http://www.nsnam.org/wiki/Installation. .. The "Prerequisites" section of this wiki page explains which packages are required to support common |ns3| options, and also provides the commands used to install them for common Linux variants. Cygwin users will have to use the Cygwin installer (if you are a Cygwin user, you used it to install Cygwin). Η ενότητα "Προϋποθέσεις" αυτής της σελίδας του wiki εξηγεί ποια πακέτα απαιτούνται για την υποστήριξη κοινών επιλογών |ns3|, και επίσης παρέχει τις εντολές που χρησιμοποιούνται για την εγκατάσταση των κοινών παραλλαγών του Linux. Οι χρήστες του Cygwin θα πρέπει να χρησιμοποιήσουν το πρόγραμμα εγκατάστασης Cygwin (αν είστε χρήστης Cygwin, το χρησιμοποιήσατε για να εγκαταστήστε Cygwin). .. You may want to take this opportunity to explore the |ns3| wiki a bit since there really is a wealth of information there. Μπορεί να θέλετε να εκμεταλλευτείτε αυτή την ευκαιρία για να εξερευνήσετε τον |ns3| στο wiki λίγο δεδομένου ότι υπάρχει πραγματικά μια πληθώρα πληροφοριών εκεί. .. From this point forward, we are going to assume that the reader is working in Linux or a Linux emulation environment (Linux, Cygwin, etc.) and has the GNU toolchain installed and verified along with the prerequisites mentioned above. We are also going to assume that you have Mercurial and Waf installed and running on the target system. Από αυτό το σημείο προς τα εμπρός, πρόκειται να υποθέσουμε ότι ο αναγνώστης εργάζεται σε Linux ή σε ένα περιβάλλον εξομοίωσης Linux (Linux, Cygwin, κ.λπ.) και έχει εγκατεστημένη την GNU εργαλειοθήκη και έχει επαληθεύσει μαζί με τις προϋποθέσεις που αναφέρονται παραπάνω. Επίσης, πρόκειται να υποθέσουμε ότι έχετε το Mercurial και το Waf εγκατεστημένο και τρέχουν στο κυρίως σύστημα. .. The |ns3| code is available in Mercurial repositories on the server http://code.nsnam.org. You can also download a tarball release at http://www.nsnam.org/release/, or you can work with repositories using Mercurial. We recommend using Mercurial unless there's a good reason not to. See the end of this section for instructions on how to get a tarball release. Ο |ns3| κώδικας είναι διαθέσιμος σε Mercurial αποθετήρια στον διακομιστή http://code.nsnam.org. Μπορείτε επίσης να κατεβάσετε μία tarball(συμπιεσμένη) έκδοση στο http://www.nsnam.org/release/, ή μπορείτε να εργαστείτε με τα αρχεία καταγραφής(αποθετήρια) χρησιμοποιώντας Mercurial. Σας προτείνουμε να χρησιμοποιείτε το Mercurial, εκτός αν υπάρχει ένας καλός λόγος για να μην τον χρησιμοποιήσετε. Δείτε το τέλος αυτής της ενότητας για οδηγίες σχετικά με το πώς να πάρετε μία συμπιεσμένη έκδοση. .. The simplest way to get started using Mercurial repositories is to use the ``ns-3-allinone`` environment. This is a set of scripts that manages the downloading and building of various subsystems of |ns3| for you. We recommend that you begin your |ns3| work in this environment. Ο απλούστερος τρόπος για να ξεκινήσετε τη χρήση αποθετήρια του Mercurial είναι να χρησιμοποιήσετε το `` ns-3-allinone`` περιβάλλον. Πρόκειται για μια σειρά από σενάρια που διαχειρίζεται το κατέβασμα και την κατασκευή των διαφόρων υποσυστημάτων του |ns-3| για σένα. Συνιστούμε να ξεκινήσετε την εργασία |ns3| σε αυτό το περιβάλλον. .. One practice is to create a directory called ``workspace`` in one's home directory under which one can keep local Mercurial repositories. Any directory name will do, but we'll assume that ``workspace`` is used herein (note: ``repos`` may also be used in some documentation as an example directory name). Μια πρακτική είναι να δημιουργήσετε ένα κατάλογο με το όνομα ``workspace`` στην αρχή κάποιου καταλόγου βάσει του οποίου μπορεί κανείς να κρατήσει τα τοπικά Mercurial αποθετήρια. Κάθε όνομα καταλόγου θα κάνει, αλλά υποθέτουμε ότι το ``workspace`` χρησιμοποιείται εδώ (σημειώστε: ``repos`` μπορεί επίσης να χρησιμοποιηθεί σε κάποια τεκμηρίωση ως ένα όνομα καταλόγου παράδειγμα). .. Downloading |ns3| Using a Tarball Κατεβάζοντας τον |ns3| χρησιμοποιώντας Tarball +++++++++++++++++++++++++++++++++++++++++++++++ .. A tarball is a particular format of software archive where multiple files are bundled together and the archive possibly compressed. |ns3| software releases are provided via a downloadable tarball. The process for downloading |ns3| via tarball is simple; you just have to pick a release, download it and decompress it. Ένα tarball είναι μία συγκεκριμένη μορφή λογισμικού αρχείο, όπου πολλαπλά αρχεία ομαδοποιούνται και το αρχείο ενδεχομένως να συμπιέζεται. Οι εκδόσεις λογισμικού του |ns3| παρέχονται μέσω ενός tarball - συμπιεσμένο αρχείο. Η διαδικασία για τη λήψη του |ns3| μέσω tarball είναι απλή: απλά πρέπει να επιλέξετε μία έκδοση, να το κατεβάσετε και να το αποσυμπιέσετε αυτό. .. Let's assume that you, as a user, wish to build |ns3| in a local directory called ``workspace``. If you adopt the ``workspace`` directory approach, you can get a copy of a release by typing the following into your Linux shell (substitute the appropriate version numbers, of course):: Ας υποθέσουμε ότι εσείς, ως χρήστης, επιθυμείτε να δημιουργήσετε τον |ns3| σε έναν τοπικό κατάλογο με την ονομασία ``workspace``. Εάν έχετε υιοθετήσει την προσέγγιση του καταλόγου ``workspace``, μπορείτε να πάρετε ένα αντίγραφο της έκδοσης, πληκτρολογώντας τα εξής στο κέλυφος του Linux σας (αντικαθιστάτε τους κατάλληλους αριθμούς έκδοσης, φυσικά):: $ cd $ mkdir workspace $ cd workspace $ wget http://www.nsnam.org/release/ns-allinone-3.22.tar.bz2 $ tar xjf ns-allinone-3.22.tar.bz2 .. If you change into the directory ``ns-allinone-3.22`` you should see a number of files:: Εάν αλλάξετε μέσα στον κατάλογο ``ns-allinone-3.22`` θα πρέπει να δείτε έναν αριθμό αρχείων:: $ ls bake constants.py ns-3.22 README build.py netanim-3.105 pybindgen-0.16.0.886 util.py .. You are now ready to build the base |ns3| distribution. Τώρα είστε έτοιμοι να οικοδομήσουμε τη διανομή της βάσης του |ns3|. .. Downloading |ns3| Using Bake Κατεβάζοντας τον |ns3| χρησιμοποιώντας Bake ++++++++++++++++++++++++++++++++++++++++++++ .. Bake is a tool for distributed integration and building, developed for the |ns3| project.  Bake can be used to fetch development versions of the |ns3| software, and to download and build extensions to the base |ns3| distribution, such as the Direct Code Execution environment, Network Simulation Cradle, ability to create new Python bindings, and others. Ο Bake είναι ένα εργαλείο για κατανεμημένη ολοκλήρωση και οικοδόμηση, που αναπτύχθηκε για το έργο του |ns3|. Ο Bake μπορεί να χρησιμοποιηθεί για να φέρει αναπτυγμένες εκδόσεις στο λογισμικό του |ns3|, και να κατεβάσετε και να οικοδομήσετε επεκτάσεις στη διανομή της βάσης του |ns3|, όπως το περιβάλλον Εκτέλεσης Άμεση Κώδικα(Direct Code Execution environment), Δίκτυο Προσομοίωσης λίκνο(Network Simulation Cradle), την ικανότητα να δημιουργήσετε νέες συνδέσεις Python, και άλλα. .. In recent |ns3| releases, Bake has been included in the release tarball. The configuration file included in the released version will allow one to download any software that was current at the time of the release. That is, for example, the version of Bake that is distributed with the ``ns-3.22`` release can be used to fetch components for that |ns3| release or earlier, but can't be used to fetch components for later releases (unless the ``bakeconf.xml`` file is updated). Σε πρόσφατες εκδόσεις |ns3|, ο Bake έχει συμπεριληφθεί στο tarball της έκδοσης. Το αρχείο των ρυθμίσεων που περιλαμβάνονται στην επίσημη έκδοση θα επιτρέψει σε κάποιον να κατεβάσει οποιοδήποτε λογισμικό που ίσχυε κατά τη στιγμή της έκδοσης. Δηλαδή, για παράδειγμα, η έκδοση του Bake που διανέμεται με την έκδοση ``ns-3.22`` μπορεί να χρησιμοποιηθεί για να φέρει τα συστατικά για αυτήν την έκδοση |ns3| ή και παλαιότερη, αλλά δεν μπορεί να χρησιμοποιηθεί για να φέρει τα συστατικά για νεότερες εκδόσεις (εκτός εάν το αρχείο ``bakeconf.xml`` είναι ενημερωμένο). .. You can also get the most recent copy of ``bake`` by typing the following into your Linux shell (assuming you have installed Mercurial):: Μπορείτε επίσης να πάρετε το πιο πρόσφατο αντίγραφο του ``bake`` πληκτρολογώντας το παρακάτω στο κέλυφος του Linux σας (αν έχετε εγκαταστήσει το Mercurial) :: $ cd $ mkdir workspace $ cd workspace $ hg clone http://code.nsnam.org/bake .. As the hg (Mercurial) command executes, you should see something like the following displayed, Καθώς η hg (Mercurial) εντολή εκτελείται, θα πρέπει να δείτε κάτι να εμφανίζεται σαν το ακόλουθο,:: ... destination directory: bake requesting all changes adding changesets adding manifests adding file changes added 339 changesets with 796 changes to 63 files updating to branch default 45 files updated, 0 files merged, 0 files removed, 0 files unresolved .. After the clone command completes, you should have a directory called ``bake``, the contents of which should look something like the following:: Αφού ολοκληρωθεί η εντολή κλώνος, θα πρέπει να έχετε έναν κατάλογο που ονομάζεται ``bake``, τα περιεχόμενα της οποίας θα πρέπει να δούμε κάτι σαν το παρακάτω :: $ ls bake bakeconf.xml doc generate-binary.py TODO bake.py examples test .. Notice that you really just downloaded some Python scripts and a Python module called ``bake``. The next step will be to use those scripts to download and build the |ns3| distribution of your choice. Σημειώστε ότι πραγματικά κατεβάσατε μερικά σενάρια Python και μία ενότητα Python που ονομάζεται ``bake``. Το επόμενο βήμα είναι να χρησιμοποιηθούν αυτά τα σενάρια για να κατεβάσετε και να οικοδομήσετε την κατανομή του |ns3| της επιλογής σας. .. There are a few configuration targets available: Υπάρχουν μερικές ρυθμίσεις ακόμα: .. 1. ``ns-3.22``: the module corresponding to the release; it will download components similar to the release tarball. 2. ``ns-3-dev``: a similar module but using the development code tree 3. ``ns-allinone-3.22``: the module that includes other optional features such as click routing, openflow for |ns3|, and the Network Simulation Cradle 4. ``ns-3-allinone``: similar to the released version of the allinone module, but for development code. 1. ``ns-3.22``: η ενότητα που αντιστοιχεί στην έκδοση, θα κατεβάσει συστατικά παρόμοια με την έκδοση tarball. 2. ``ns-3-dev``: μια παρόμοια ενότητα, αλλά χρησιμοποιώντας τον κώδικα-δένδρο ανάπτυξης 3. ``ns-allinone-3.22``: η ενότητα που περιλαμβάνει άλλα προαιρετικά χαρακτηριστικά όπως την δρομολόγηση του κλικ, τον openflow |ns-3|, και Προσομοίωση Δικτύων λίκνο(Network Simulation Cradle) 4. ``ns-3-allinone``: παρόμοια με την επίσημη έκδοση του allinone, αλλά για την ανάπτυξη κώδικα. .. The current development snapshot (unreleased) of |ns3| may be found at http://code.nsnam.org/ns-3-dev/. The developers attempt to keep these repository in consistent, working states but they are in a development area with unreleased code present, so you may want to consider staying with an official release if you do not need newly- introduced features. Το τρέχον στιγμιότυπο ανάπτυξης (ακυκλοφόρητο) του |ns3| μπορεί να βρεθεί στο http://code.nsnam.org/ns-3-dev/. Οι προγραμματιστές προσπαθούν να κρατήσουν αυτά τα αποθετήρια με συνέπεια, εργάζοντας κομμάτια αλλά είναι σε μια περιοχή ανάπτυξης με ακυκλοφόρητο κώδικα προσωρινά, οπότε μπορεί να θέλετε να εξετάσετε την διαμονή σας με την επίσημη έκδοση, εφόσον δεν χρειάζεστε νεοεισαχθέν χαρακτηριστικά. .. You can find the latest version of the code either by inspection of the repository list or by going to the `"ns-3 Releases" `_ web page and clicking on the latest release link. We'll proceed in this tutorial example with ``ns-3.22``. Μπορείτε να βρείτε την τελευταία έκδοση του κώδικα είτε με την επιθεώρηση της λίστας του χώρου αποθήκευσης ή πηγαίνοντας στην ιστοσελίδα `"ns-3 Releases" `_ και κάνοντας κλίκ στον σύνδεσμο της τελευταίας έκδοσης. Θα προχωρήσουμε σε αυτόν τον οδηγό με παράδειγμα τον ``ns-3.22``. .. We are now going to use the bake tool to pull down the various pieces of |ns3| you will be using. First, we'll say a word about running bake. Πάμε να χρησιμοποιήσουμε το εργαλείο bake για να χωρίσουμε τα διάφορα κομμάτια του |ns3| που θα χρησιμοποιείτε. Κατ 'αρχάς, θα πούμε μία λέξη για το τρέξιμο του bake. .. bake works by downloading source packages into a source directory, and installing libraries into a build directory. bake can be run by referencing the binary, but if one chooses to run bake from outside of the directory it was downloaded into, it is advisable to put bake into your path, such as follows (Linux bash shell example). First, change into the 'bake' directory, and then set the following environment variables Ο bake λειτουργεί κατεβάζοντας πακέτα πηγαίου κώδικα σε έναν κατάλογο πηγή, και εγκαθηστώντας βιβλιοθήκες σε έναν κατάλογο κατασκευής. Ο bake μπορεί να τρέξει με την παραπομπή του δυαδικού, αλλά αν κάποιος επιλέξει να τρέξει τον bake από το εξωτερικό του καταλόγου απο το οποίο έγινε λήψη, είναι συμβουλή να τοποθετήσετε το bake στη διαδρομή(path) που ξέρετε, όπως ακολουθεί (Linux κέλυφος bash παράδειγμα). Πρώτον, να αλλάξετε μέσα στον κατάλογο 'bake', και στη συνέχεια ορίστε τις ακόλουθες μεταβλητές περιβάλλοντος:: $ export BAKE_HOME=`pwd` $ export PATH=$PATH:$BAKE_HOME:$BAKE_HOME/build/bin $ export PYTHONPATH=$PYTHONPATH:$BAKE_HOME:$BAKE_HOME/build/lib .. This will put the bake.py program into the shell's path, and will allow other programs to find executables and libraries created by bake. Although several bake use cases do not require setting PATH and PYTHONPATH as above, full builds of ns-3-allinone (with the optional packages) typically do. Αυτό θα θέσει το πρόγραμμα bake.py στη διαδρομή του κελύφους, και θα επιτρέψει άλλα προγράμματα να τα βρείτε εκτελέσιμα και τις βιβλιοθήκες που έχουν δημιουργηθεί από το bake. Παρά το γεγονός ότι αρκετές περιπτώσεις το bake δεν απαιτείται η χρήση ρύθμιση της διαδρομής και PYTHONPATH όπως παραπάνω, η πλήρης έκδοση του ns-3-allinone (με τα προαιρετικά πακέτα) συνήθως χρειάζεται. .. Step into the workspace directory and type the following into your shell:: Μπείτε στο κατάλογο εργασίας και πληκτρολογήστε τα ακόλουθα στο κέλυφος :: $ ./bake.py configure -e ns-3.22 .. Next, we'll ask bake to check whether we have enough tools to download various components. Type:: Στη συνέχεια, εμείς θα ζητήσουμε από το bake να ελέγξει αν έχουμε αρκετά εργαλεία για να κατεβάσουμε διάφορα συστατικά. Τύπος :: $ ./bake.py check .. You should see something like the following, Θα πρέπει να δείτε κάτι όπως παρακάτω, :: > Python - OK > GNU C++ compiler - OK > Mercurial - OK > CVS - OK > GIT - OK > Bazaar - OK > Tar tool - OK > Unzip tool - OK > Unrar tool - is missing > 7z data compression utility - OK > XZ data compression utility - OK > Make - OK > cMake - OK > patch tool - OK > autoreconf tool - OK > Path searched for tools: /usr/lib64/qt-3.3/bin /usr/lib64/ccache /usr/local/bin /bin /usr/bin /usr/local/sbin /usr/sbin /sbin /home/tomh/bin bin .. In particular, download tools such as Mercurial, CVS, GIT, and Bazaar are our principal concerns at this point, since they allow us to fetch the code. Please install missing tools at this stage, in the usual way for your system (if you are able to), or contact your system administrator as needed to install these tools. Ειδικότερα, λήψη εργαλείων όπως το Mercurial, CVS, GIT και Bazaar είναι οι κυριότερες ανησυχίες μας σε αυτό το σημείο, διότι μας επιτρέπουν να φέρουν τον κώδικα. Παρακαλώ εγκαταστήστε τα εργαλεία που λείπουν σε αυτό το στάδιο, με το συνήθη τρόπο για το σύστημά σας (αν είστε σε θέση), ή επικοινωνήστε με τον διαχειριστή του συστήματός σας, όπως απαιτείται για την εγκατάσταση αυτών των εργαλείων. .. Next, try to download the software Μετά, προσπαθήστε να κατεβάσετε το λογισμικό :: $ ./bake.py download .. should yield something like θα πρέπει να δώσει κάτι, όπως :: >> Searching for system dependency pygoocanvas - OK >> Searching for system dependency python-dev - OK >> Searching for system dependency pygraphviz - OK >> Downloading pybindgen-0.16.0.886 - OK >> Searching for system dependency g++ - OK >> Searching for system dependency qt4 - OK >> Downloading netanim-3.105 - OK >> Downloading ns-3.22 - OK .. The above suggests that three sources have been downloaded. Check the ``source`` directory now and type ``ls``; one should see Απο τα ανωτέρω προκύπτει ότι οι τρείς πηγές έχουν ληφθεί. Ελέγξτε τώρα τον κατάλογο ``source`` και πληκτρολογείστε ``ls``, πρέπει να φανεί :: $ ls netanim-3.105 ns-3.22 pybindgen-0.16.0.886 .. You are now ready to build the |ns3| distribution. Είστε έτοιμη για την κατασκευή της διανομής του |ns-3|. .. Building |ns3| Χτίζοντας τον |ns3| ******************** .. Building with ``build.py`` Χτίζοντας με ``build.py`` +++++++++++++++++++++++++ .. When working from a released tarball, the first time you build the |ns3| project you can build using a convenience program found in the ``allinone`` directory. This program is called ``build.py``. This program will get the project configured for you in the most commonly useful way. However, please note that more advanced configuration and work with |ns3| will typically involve using the native |ns3| build system, Waf, to be introduced later in this tutorial. Δουλεύοντας απο μία έκδοση tarball, η πρώτη φορά που θα κατασκευάσετε την εργασία |ns3| μπορείτε να δημιουργήσετε χρησιμοποιώντας ένα εύχρηστο πρόγραμμα που θα βρείτε στον κατάλογο ``allinone``. Αυτό το πρόγραμμα ονομάζεται ``build.py``. Αυτό το πρόγραμμα θα πάρει την ρυθμισμένη εργασία για εσάς στο πιο χρήσιμο τρόπο. Ωστόσο, παρακαλούμε να σημειώσετε ότι πιο προηγμένες ρυθμίσεις και εργασίες με τον |ns3| τυπικά περιλαμβάνει τη χρήση του φυσικού συστήματος κατασκευής |ns3|, Waf, στο οποίο θα εισαχθούμε αργότερα στον οδηγό αυτό. .. If you downloaded using a tarball you should have a directory called something like ``ns-allinone-3.22`` under your ``~/workspace`` directory. Type the following Αν έχετε κατεβάσει χρησιμοποιώντας ένα tarball θα πρέπει να έχετε έναν κατάλογο που ονομάζεται ``ns-allinone-3.22`` κάτω από τον κατάλογο ``~/workspace``. Πληκτρολογήστε την ακόλουθη εντολή :: $ ./build.py --enable-examples --enable-tests .. Because we are working with examples and tests in this tutorial, and because they are not built by default in |ns3|, the arguments for build.py tells it to build them for us. The program also defaults to building all available modules. Later, you can build |ns3| without examples and tests, or eliminate the modules that are not necessary for your work, if you wish. Επειδή εργαζόμαστε με παραδείγματα και δοκιμές σε αυτόν τον οδηγό, και επειδή δεν έχουν κατασκευαστεί από προεπιλογή στον |ns3|, τα ορίσματα για build.py λέει να τα κατασκευάσουμε για εμάς. Το πρόγραμμα, επίσης, αποτυγχάνει την οικοδόμηση όλων των διαθέσιμων ενοτήτων. Αργότερα, μπορείτε να χτίσετε τον |ns3| χωρίς παραδείγματα και δοκιμές, ή την εξάλειψη των ενοτήτων που δεν είναι απαραίτητα για την εργασία σας, εάν το επιθυμείτε. .. You will see lots of typical compiler output messages displayed as the build script builds the various pieces you downloaded. Eventually you should see the following Θα δείτε πολλά μηνύματα εξόδου τυπικού compiler να εμφανίζονται όσο το σενάριο κατασκευής χτίζει τα διάφορα κομμάτια που κατεβάσατε. Ενδεχομένως να δείτε το παρακάτω :: Waf: Leaving directory `/path/to/workspace/ns-allinone-3.22/ns-3.22/build' 'build' finished successfully (6m25.032s) Modules built: antenna aodv applications bridge buildings config-store core csma csma-layout dsdv dsr energy fd-net-device flow-monitor internet lr-wpan lte mesh mobility mpi netanim (no Python) network nix-vector-routing olsr point-to-point point-to-point-layout propagation sixlowpan spectrum stats tap-bridge test (no Python) topology-read uan virtual-net-device wave wifi wimax Modules not built (see ns-3 tutorial for explanation): brite click openflow visualizer Leaving directory `./ns-3.22' .. Regarding the portion about modules not built Όσον αφορά το τμήμα σχετικά με τις ενότητες δεν χτίστηκε :: Modules not built (see ns-3 tutorial for explanation): brite click openflow visualizer .. This just means that some |ns3| modules that have dependencies on outside libraries may not have been built, or that the configuration specifically asked not to build them. It does not mean that the simulator did not build successfully or that it will provide wrong results for the modules listed as being built. Αυτό σημαίνει απλά ότι κάποιες ενότητες του |ns3| που έχουν εξαρτήσεις σε εξωτερικές βιβλιοθήκες μπορεί να μην έχουν κατασκευαστεί, ή ότι η διαμόρφωση ζήτησε συγκεκριμένα να μην τις κατασκευάσει. Αυτό δεν σημαίνει ότι ο προσομοιωτής δεν έχτισε με επιτυχία ή ότι θα παρέχει λανθασμένα αποτελέσματα για τις ενότητες που αναφέρονται καθώς χτίζονται. .. Building with bake Χτίζοντας με Bake +++++++++++++++++ .. If you used bake above to fetch source code from project repositories, you may continue to use it to build |ns3|. Type Εάν χρησιμοποιείτε bake παραπάνω για να φέρετε τον πηγαίο κώδικα από τα αποθετήρια εργασιών, μπορείτε να συνεχίσετε να το χρησιμοποιήσετε για να οικοδομήσετε τον |ns3|. Πληκτρολογήστε:: $ ./bake.py build .. and you should see something like και θα πρέπει να δείτε :: >> Building pybindgen-0.16.0.886 - OK >> Building netanim-3.105 - OK >> Building ns-3.22 - OK .. Hint: you can also perform both steps, download and build by calling 'bake.py deploy'. *Συμβουλή: Μπορείτε επίσης να εκτελέσετε δύο βήματα, να κατεβάσετε και να οικοδομήσετε καλώντας 'bake.py deploy'.* .. If there happens to be a failure, please have a look at what the following command tells you; it may give a hint as to a missing dependency Αν συμβαίνει να υπάρχει μια αποτυχία, παρακαλώ ρίξτε μια ματιά στα ακόλουθα, μπορεί να δώσει μια υπόδειξη ως προς τι λείπει:: $ ./bake.py show .. This will list out the various dependencies of the packages you are trying to build. Αυτό θα εμφανίσει τις διάφορες εξαρτήσεις των πακέτων που προσπαθούμε να οικοδομήσουμε. .. Building with Waf Χτίζοντας με Waf ++++++++++++++++ .. Up to this point, we have used either the `build.py` script, or the `bake` tool, to get started with building |ns3|. These tools are useful for building |ns3| and supporting libraries, and they call into the |ns3| directory to call the Waf build tool to do the actual building. Most users quickly transition to using Waf directly to configure and build |ns3|. So, to proceed, please change your working directory to the |ns3| directory that you have initially built. Μέχρι αυτό το σημείο, έχουμε χρησιμοποιήσει είτε το σενάριο `build.py`, ή το εργαλείο `bake`, για να ξεκινήσετε την οικοδόμηση του |ns3|. Τα εργαλεία αυτά είναι χρήσιμα για την ανάπτυξη του |ns3| και την υποστήριξη βιβλιοθηκών, και καλούν μέσω του καταλόγου του |ns3| το εργαλείο Waf να κάνει την πραγματική οικοδόμηση. Οι περισσότεροι χρήστες κάνουν την μετάβαση γρήγορα χρησιμοποιώντας άμεσα τον Waf για να διαμορφώσουν και να οικοδομήσουμε τον |ns3|. Έτσι, για να προχωρήσει, παρακαλούμε να αλλάξετε τον κατάλογο εργασίας σας με τον κατάλογο του |ns3| που έχετε αρχικά κατασκευάσει. .. It's not strictly required at this point, but it will be valuable to take a slight detour and look at how to make changes to the configuration of the project. Probably the most useful configuration change you can make will be to build the optimized version of the code. By default you have configured your project to build the debug version. Let's tell the project to make an optimized build. To explain to Waf that it should do optimized builds that include the examples and tests, you will need to execute the following commands Δεν είναι απολύτως απαραίτητο σε αυτό το σημείο, αλλά θα είναι χρήσιμο να κάνουμε μια μικρή παράκαμψη και να δούμε πώς να κάνετε αλλαγές στη διαμόρφωση της εργασίας. Ίσως η πιο χρήσιμη αλλαγή ρυθμίσεων που μπορείτε να κάνετε θα είναι να οικοδομήσετε τη βελτιστοποιημένη έκδοση του κώδικα. Από προεπιλογή έχετε ρυθμίσει την εργασία σας να χτίσει την έκδοση εντοπισμού σφαλμάτων. Ας πούμε ότι θα φτιάξουμε μία βελτιστοποιημένη κατασκευή για την εργασία. Για να εξηγήσουμε στο Waf ότι θα πρέπει να βελτιστοποιηθούν οι εκδόσεις που περιλαμβάνουν τα παραδείγματα και τις δοκιμές, θα πρέπει να εκτελέσετε τις ακόλουθες εντολές :: $ ./waf clean $ ./waf --build-profile=optimized --enable-examples --enable-tests configure .. This runs Waf out of the local directory (which is provided as a convenience for you). The first command to clean out the previous build is not typically strictly necessary but is good practice (but see `Build Profiles`_, below); it will remove the previously built libraries and object files found in directory ``build/``. When the project is reconfigured and the build system checks for various dependencies, you should see output that looks similar to the following Αυτό τρέχει τον Waf έξω από τον τοπικό κατάλογο (το οποίο παρέχεται ως διευκόλυνση για εσάς). Η πρώτη εντολή για να καθαρίσετε την προηγούμενη κατασκευή δεν είναι απολύτως αναγκαία, αλλά είναι καλή πρακτική (αλλά δείτε παρακάτω `Προφίλ Κατασκευών`_), θα καταργήσει τις προηγούμενες κατασκευασμένες βιβλιοθήκες και τα αρχεία αντικειμένων που βρέθηκαν στον κατάλογο ``build/``. Όταν το έργο έχει αναδιαμορφωθεί και το σύστημα κατασκευής ελέγχει για διάφορες εξαρτήσεις, θα πρέπει να δείτε κάτι που μοιάζει με το παρακάτω :: Setting top to : . Setting out to : build Checking for 'gcc' (c compiler) : /usr/bin/gcc Checking for cc version : 4.2.1 Checking for 'g++' (c++ compiler) : /usr/bin/g++ Checking boost includes : 1_46_1 Checking boost libs : ok Checking for boost linkage : ok Checking for click location : not found Checking for program pkg-config : /sw/bin/pkg-config Checking for 'gtk+-2.0' >= 2.12 : yes Checking for 'libxml-2.0' >= 2.7 : yes Checking for type uint128_t : not found Checking for type __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 : not found Checking for header netpacket/packet.h : not found Checking for header sys/ioctl.h : yes Checking for header net/if.h : not found Checking for header net/ethernet.h : yes Checking for header linux/if_tun.h : not found Checking for header netpacket/packet.h : not found Checking for NSC location : not found Checking for 'mpic++' : yes Checking for 'sqlite3' : yes Checking for header linux/if_tun.h : not found Checking for program sudo : /usr/bin/sudo Checking for program valgrind : /sw/bin/valgrind Checking for 'gsl' : yes Checking for compilation flag -Wno-error=deprecated-d... support : ok Checking for compilation flag -Wno-error=deprecated-d... support : ok Checking for compilation flag -fstrict-aliasing... support : ok Checking for compilation flag -fstrict-aliasing... support : ok Checking for compilation flag -Wstrict-aliasing... support : ok Checking for compilation flag -Wstrict-aliasing... support : ok Checking for program doxygen : /usr/local/bin/doxygen ---- Summary of optional NS-3 features: Build profile : debug Build directory : build Python Bindings : enabled BRITE Integration : not enabled (BRITE not enabled (see option --with-brite)) NS-3 Click Integration : not enabled (nsclick not enabled (see option --with-nsclick)) GtkConfigStore : enabled XmlIo : enabled Threading Primitives : enabled Real Time Simulator : enabled (librt is not available) Emulated Net Device : enabled ( include not detected) File descriptor NetDevice : enabled Tap FdNetDevice : not enabled (needs linux/if_tun.h) Emulation FdNetDevice : not enabled (needs netpacket/packet.h) PlanetLab FdNetDevice : not enabled (PlanetLab operating system not detected (see option --force-planetlab)) Network Simulation Cradle : not enabled (NSC not found (see option --with-nsc)) MPI Support : enabled NS-3 OpenFlow Integration : not enabled (Required boost libraries not found, missing: system, signals, filesystem) SQlite stats data output : enabled Tap Bridge : not enabled ( include not detected) PyViz visualizer : enabled Use sudo to set suid bit : not enabled (option --enable-sudo not selected) Build tests : enabled Build examples : enabled GNU Scientific Library (GSL) : enabled 'configure' finished successfully (1.944s) .. Note the last part of the above output. Some |ns3| options are not enabled by default or require support from the underlying system to work properly. For instance, to enable XmlTo, the library libxml-2.0 must be found on the system. If this library were not found, the corresponding |ns3| feature would not be enabled and a message would be displayed. Note further that there is a feature to use the program ``sudo`` to set the suid bit of certain programs. This is not enabled by default and so this feature is reported as "not enabled." Σημειώστε το τελευταίο μέρος της παραπάνω εξόδου. Μερικές επιλογές στον |ns3| δεν είναι ενεργοποιημένες από προεπιλογή ή απαιτούν υποστήριξη από το υποκείμενο σύστημα για να λειτουργήσει σωστά. Για παράδειγμα, για να ενεργοποιήσετε τον XmlTo, η βιβλιοθήκη LibXML-2.0 πρέπει να βρεθεί στο σύστημα. Αν δεν βρεθεί αυτή η βιβλιοθήκη, το αντίστοιχο χαρακτηριστικό του |ns3| δεν θα έπρεπε να ενεργοποιηθεί και ένα μήνυμα θα εμφανιστεί. Σημειώστε, επίσης, ότι υπάρχει ένα χαρακτηριστικό για να χρησιμοποιήσετε το πρόγραμμα ``sudo`` να ρυθμίσετε το suid κομμάτι ορισμένων προγραμμάτων. Αυτό δεν είναι ενεργοποιημένο από προεπιλογή και έτσι αυτό το χαρακτηριστικό αναφέρεται ως "όχι ενεργοποιημένο."("not enabled.") .. Now go ahead and switch back to the debug build that includes the examples and tests. Τώρα συνεχίστε και επιστρέψετε στην κατασκευή εντοπισμού σφαλμάτων που περιλαμβάνει τα παραδείγματα και δοκιμές. :: $ ./waf clean $ ./waf --build-profile=debug --enable-examples --enable-tests configure .. The build system is now configured and you can build the debug versions of the |ns3| programs by simply typing Το σύστημα κατασκευής είναι τώρα ρυθμισμένο και μπορείτε να χτίσετε τις debug εκδόσεις των προγραμμάτων |ns3| απλά πληκτρολογώντας:: $ ./waf .. Okay, sorry, I made you build the |ns3| part of the system twice, but now you know how to change the configuration and build optimized code. Εντάξει, συγγνώμη, σας έκανα να φτιάξετε το μέρος του συστήματος |ns3| δύο φορές, αλλά τώρα ξέρετε πώς να αλλάξετε τη διαμόρφωση και την κατασκευή για βελτιστοποιημένο κώδικα. .. The build.py script discussed above supports also the ``--enable-examples`` and ``enable-tests`` arguments, but in general, does not directly support other waf options; for example, this will not work: Το σενάριο build.py συζητήθηκε παραπάνω, υποστηρίζει επίσης τα ``--enable-examples`` και ``enable-tests`` ορίσματα, αλλά σε γενικές γραμμές, δεν υποστηρίζει άμεσα άλλες WAF επιλογές, για παράδειγμα, αυτό δεν θα λειτουργήσει: :: $ ./build.py --disable-python .. will result in θα οδηγήσει σε :: build.py: error: no such option: --disable-python .. However, the special operator ``--`` can be used to pass additional options through to waf, so instead of the above, the following will work: Ωστόσο, ο ειδικός φορέας ``--`` μπορεί να χρησιμοποιηθεί για να περάσουν επιπλέον επιλογές μέσω του WAF, έτσι ώστε αντί των ανωτέρω, τα ακόλουθα θα λειτουργήσουν: :: $ ./build.py -- --disable-python .. as it generates the underlying command ``./waf configure --disable-python``. δεδομένου ότι δημιουργεί τη βασική εντολή ``./waf configure --disable-python``. .. Here are a few more introductory tips about Waf. Εδώ είναι λίγο περισσότερες εισαγωγικές συμβουλές για τον Waf. .. Configure vs. Build Ρύθμιση(Διαμόρφωση) εναντίον Κατασκευής ======================================= .. Some Waf commands are only meaningful during the configure phase and some commands are valid in the build phase. For example, if you wanted to use the emulation features of |ns3|, you might want to enable setting the suid bit using sudo as described above. This turns out to be a configuration-time command, and so you could reconfigure using the following command that also includes the examples and tests. Μερικές εντολές του Waf έχουν νόημα μόνο κατά τη διάρκεια της φάσης της παραμετροποίησης και κάποιες εντολές ισχύουν κατά τη φάση της κατασκευής. Για παράδειγμα, αν θέλετε να χρησιμοποιήσετε τις λειτουργίες της εξομοίωσης του |ns3|, ίσως πρέπει να ενεργοποιήσετε αυτήν την ρύθμιση του κομματιού suid χρησιμοποιώντας την εντολή sudo, όπως περιγράφεται παραπάνω. Αυτό αποδεικνύεται ότι είναι μια εντολή διαμόρφωσης χρόνου, και έτσι θα μπορείτε να αναμορφώσετε χρησιμοποιώντας την ακόλουθη εντολή, που περιλαμβάνει επίσης τα παραδείγματα και δοκιμές. :: $ ./waf configure --enable-sudo --enable-examples --enable-tests .. If you do this, Waf will have run sudo to change the socket creator programs of the emulation code to run as root. Αν το κάνετε αυτό, το Waf θα έχει εκκινήσει το sudo για να αλλάξει τα προγράμματα (socket creator) του κώδικα εξομοίωσης να εκτελούνται ως root. .. There are many other configure- and build-time options available in Waf. To explore these options, type Υπάρχουν πολλές άλλες ρυθμίσεις- και χρόνο-κατασκευής που διατίθεται σε Waf. Για να διερευνήσετε αυτές τις επιλογές, πληκτρολογήστε :: $ ./waf --help .. We'll use some of the testing-related commands in the next section. Θα χρησιμοποιήσουμε κάποιες από τις εντολές δοκιμών που σχετίζονται με την επόμενη ενότητα. .. Build Profiles Προφίλ Κατασκευών ================= .. We already saw how you can configure Waf for ``debug`` or ``optimized`` builds Μόλις είδαμε πως μπορούμε να ρυθμίσουμε τον Waf για ``debug`` ή ``optimized`` κατασκευές :: $ ./waf --build-profile=debug .. There is also an intermediate build profile, ``release``. ``-d`` is a synonym for ``--build-profile``. Υπάρχει επίσης ένα ενδιάμεσο προφίλ κατασκευής, ``release``. `` -d`` είναι ένα συνώνυμο για `` --build-profile``. .. By default Waf puts the build artifacts in the ``build`` directory. You can specify a different output directory with the ``--out`` option, e.g. Από προεπιλογή ο Waf βάζει τα αντικείμενα κατασκευής στον κατάλογο ``build``. Μπορείτε να καθορίσετε ένα διαφορετικό κατάλογο εξόδου με την επιλογή ``--out``, π.χ. :: $ ./waf configure --out=foo .. Combining this with build profiles lets you switch between the different compile options in a clean way Συνδυάζοντας αυτό με τα προφίλ κατασκευών σας επιτρέπει να πραγματοποιήσετε εναλλαγή μεταξύ των διαφόρων επιλογών μεταγλώττισης σε ένα καθαρό τρόπο :: $ ./waf configure --build-profile=debug --out=build/debug $ ./waf build ... $ ./waf configure --build-profile=optimized --out=build/optimized $ ./waf build ... .. This allows you to work with multiple builds rather than always overwriting the last build. When you switch, Waf will only compile what it has to, instead of recompiling everything. Αυτό σας επιτρέπει να εργάζεστε με πολλαπλές κατασκευές και όχι πάντα αντικαθιστώντας την τελευταία έκδοση. Όταν αλλάζετε, ο Waf θα μεταγλωττίζει μόνο ό,τι έχει, αντί να κάνει μεταγλώττιση πάλι. .. When you do switch build profiles like this, you have to be careful to give the same configuration parameters each time. It may be convenient to define some environment variables to help you avoid mistakes Όταν κάνετε εναλλαγή προφίλ κατασκευής όπως αυτό, θα πρέπει να είστε προσεκτικοί για να δώσει τις ίδιες παραμέτρους διαμόρφωσης κάθε φορά. Μπορεί να είναι βολικό να καθορίσει κάποιες μεταβλητές περιβάλλοντος για να σας βοηθήσει να αποφύγετε τα λάθη :: $ export NS3CONFIG="--enable-examples --enable-tests" $ export NS3DEBUG="--build-profile=debug --out=build/debug" $ export NS3OPT=="--build-profile=optimized --out=build/optimized" $ ./waf configure $NS3CONFIG $NS3DEBUG $ ./waf build ... $ ./waf configure $NS3CONFIG $NS3OPT $ ./waf build .. Compilers Μεταγλωττιστές ============== .. In the examples above, Waf uses the GCC C++ compiler, ``g++``, for building |ns3|. However, it's possible to change the C++ compiler used by Waf by defining the ``CXX`` environment variable. For example, to use the Clang C++ compiler, ``clang++``, Στα παραπάνω παραδείγματα, ο Waf χρησιμοποιεί τον μεταγλωττιστή GCC C++, ``g++``, για την οικοδομή του |ns3|. Ωστόσο, είναι δυνατόν να αλλάξει τον μεταγλωττιστή του C++ που χρησιμοποιείται από τον Waf με την μεταβλητή περιβάλλοντος ``CXX``. Για παράδειγμα, για να χρησιμοποιήσετε τον μεταγλωττιστή Clang C++, ``clang++``, :: $ CXX="clang++" ./waf configure $ ./waf build .. One can also set up Waf to do distributed compilation with ``distcc`` in a similar way Κάποιος μπορεί επίσης να εγκαταστήσει τον Waf κάνοντας κατανεμημένη συλλογή με ``distcc`` με παρόμοιο τρόπο :: $ CXX="distcc g++" ./waf configure $ ./waf build .. More info on ``distcc`` and distributed compilation can be found on it's `project page `_ under Documentation section. Περισσότερες πληροφορίες για το ``distcc`` και διανέμονται σύνταξη μπορείτε να βρήτε σε αυτή την `σελίδα του έργου `_ σύμφωνα με το τμήμα του οδηγού αυτού. .. Install Εγκατάσταση =========== .. Waf may be used to install libraries in various places on the system. The default location where libraries and executables are built is in the ``build`` directory, and because Waf knows the location of these libraries and executables, it is not necessary to install the libraries elsewhere. Ο Waf μπορεί να χρησιμοποιηθεί για την εγκατάσταση βιβλιοθηκών σε διάφορα σημεία του συστήματος. Η προεπιλεγμένη θέση όπου οι βιβλιοθήκες και τα εκτελέσιμα είναι χτισμένα είναι ο κατάλογος ``build``, και επειδή ο Waf γνωρίζει τη θέση των βιβλιοθηκών αυτών και τα εκτελέσιμα, δεν είναι απαραίτητο να εγκαταστήσετε τις βιβλιοθήκες και αλλού. .. If users choose to install things outside of the build directory, users may issue the ``./waf install`` command. By default, the prefix for installation is ``/usr/local``, so ``./waf install`` will install programs into ``/usr/local/bin``, libraries into ``/usr/local/lib``, and headers into ``/usr/local/include``. Superuser privileges are typically needed to install to the default prefix, so the typical command would be ``sudo ./waf install``. When running programs with Waf, Waf will first prefer to use shared libraries in the build directory, then will look for libraries in the library path configured in the local environment. So when installing libraries to the system, it is good practice to check that the intended libraries are being used. Εάν οι χρήστες επιλέγουν να εγκαταστήσουν πράγματα έξω από το κατάλογο κατασκευής, οι χρήστες μπορούν να εκδώσουν την εντολή ``./waf install``. Από προεπιλογή, το πρόθεμα για την εγκατάσταση είναι ``/ usr / local``, έτσι ``./waf install`` θα εγκαταστήσει προγράμματα σε ``/ usr / local / bin``, βιβλιοθήκες σε ``/ usr / local / lib``, και τους τίτλους σε ``/ usr / local / include``. Τα προνόμια υπερχρήστη συνήθως απαιτούνται για την εγκατάσταση στο προεπιλεγμένο πρόθεμα, οπότε η τυπική εντολή θα είναι ``sudo ./waf install``. Όταν τα προγράμματα που εκτελούνται με τον Waf, ο Waf πρώτα θα προτιμά να χρησιμοποιεί κοινές βιβλιοθήκες στον κατάλογο κατασκευής, μετά θα κοιτάξουμε για τις βιβλιοθήκες στη ρύθμιση διαδρομή βιβλιοθήκης στο τοπικό περιβάλλον. Έτσι, κατά την εγκατάσταση των βιβλιοθηκών για το σύστημα, είναι καλή πρακτική να ελέγξετε ότι οι προβλεπόμενες βιβλιοθήκες έχουν χρησιμοποιηθεί. .. Users may choose to install to a different prefix by passing the ``--prefix`` option at configure time, such as: Οι χρήστες μπορούν να επιλέξουν να εγκαταστήσουν σε ένα διαφορετικό πρόθεμα με το πέρασμα την επιλογή ``--prefix`` σε συγκεκριμένο χρόνο, όπως: :: ./waf configure --prefix=/opt/local .. If later after the build the user issues the ``./waf install`` command, the prefix ``/opt/local`` will be used. Αν αργότερα, μετά την κατασκευή ο χρήστης εκδίδει την εντολή ``./waf install``, το πρόθεμα ``/ opt / local`` θα χρησιμοποιηθεί. .. The ``./waf clean`` command should be used prior to reconfiguring the project if Waf will be used to install things at a different prefix. Η εντολή ``./waf clean`` πρέπει να χρησιμοποιείται πριν από την αναμόρφωση του έργου, εάν το Waf θα χρησιμοποιηθεί για να εγκαταστήσει πράγματα σε ένα διαφορετικό πρόθεμα. .. In summary, it is not necessary to call ``./waf install`` to use |ns3|. Most users will not need this command since Waf will pick up the current libraries from the ``build`` directory, but some users may find it useful if their use case involves working with programs outside of the |ns3| directory. Εν ολίγοις, δεν είναι απαραίτητο να καλέσετε ``./waf install`` για να χρησιμοποιήσετε τον |ns3|. Οι περισσότεροι χρήστες δεν θα χρειαστούν αυτήν την εντολή αφού ο Waf θα πάρει τις σημερινές βιβλιοθήκες από τον κατάλογο ``build``, αλλά μερικοί χρήστες μπορεί να το βρούν χρήσιμο εάν η χρήση τους περιλαμβάνει εργασία με προγράμματα εκτός από τον κατάλογο του |ns3|. .. One Waf Ένας Waf ======== .. There is only one Waf script, at the top level of the |ns3| source tree. As you work, you may find yourself spending a lot of time in ``scratch/``, or deep in ``src/...``, and needing to invoke Waf. You could just remember where you are, and invoke Waf like this Υπάρχει μόνο ένα σενάριο Waf, στο ανώτατο επίπεδο του δέντρου πηγαίου κώδικα |ns3|. Καθώς εργάζεστε, μπορείτε να βρείτε τον εαυτό σας να ξοδέψει πολύ χρόνο σε ``scratch/``, ή βαθιά στο ``src /...``, και να χρειαστεί να επικαλεστείτε τον Waf. Θα μπορούσατε απλά να θυμάστε πού είστε, και να επικαλέσετε τον Waf όπως αυτό :: $ ../../../waf ... .. but that get's tedious, and error prone, and there are better solutions. αλλά αυτό είναι κουραστικό και επιρρεπή σε λάθη, και υπάρχουν καλύτερες λύσεις. .. If you have the full |ns3| repository this little gem is a start Εάν έχετε το πλήρη αποθετήριο |ns3| αυτό το μικρό διαμάντι είναι μια αρχή :: $ cd $(hg root) && ./waf ... .. Even better is to define this as a shell function Ακόμα καλύτερα είναι να το ορίσετε ως συνάρτηση κέλυφος :: $ function waff { cd $(hg root) && ./waf $* ; } $ waff build .. If you only have the tarball, an environment variable can help Εάν έχετε μόνο το tarball αρχείο, μια μεταβλητή περιβάλλοντος μπορεί να βοηθήσει :: $ export NS3DIR="$PWD" $ function waff { cd $NS3DIR && ./waf $* ; } $ cd scratch $ waff build .. It might be tempting in a module directory to add a trivial ``waf`` script along the lines of ``exec ../../waf``. Please don't. It's confusing to new-comers, and when done poorly it leads to subtle build errors. The solutions above are the way to go. Θα μπορούσε να είναι δελεαστικό σε μια μονάδα καταλόγου για να προσθέσετε ένα ασήμαντο σενάριο ``waf`` κατά μήκος των γραμμών του ``exec ../../waf``. Παρακαλώ μην το κάνετε. Είναι σύγχυση για τους νεοφερμένους, και όταν γίνει ανεπαρκώς οδηγεί σε λεπτά σφάλματα κατασκευής. Οι παραπάνω λύσεις είναι ο τρόπος να πάει καλά. .. Testing |ns3| Κάνοντας τέστ στον |ns3| ************************ .. You can run the unit tests of the |ns3| distribution by running the ``./test.py -c core`` script Μπορείτε να εκτελέσετε τη μονάδα των δοκιμών της διανομής του |ns3| εκτελώντας το σενάριο ``./test.py -c core`` :: $ ./test.py -c core .. These tests are run in parallel by Waf. You should eventually see a report saying that Οι δοκιμές αυτές έχουν παράλληλη πορεία με τον Waf. Θα πρέπει τελικά να δείτε μια έκθεση λέγοντας ότι :: 92 of 92 tests passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors) .. This is the important message. Αυτό είναι σημαντικό μήνυμα. .. You will also see the summary output from Waf and the test runner executing each test, which will actually look something like Θα δείτε επίσης την περίληψη εξόδου από τον Waf και τη δοκιμή του δρομέα εκτέλεσης κάθε δοκιμής, η οποία θα εξετάσει πραγματικά κάτι σαν :: Waf: Entering directory `/path/to/workspace/ns-3-allinone/ns-3-dev/build' Waf: Leaving directory `/path/to/workspace/ns-3-allinone/ns-3-dev/build' 'build' finished successfully (1.799s) Modules built: aodv applications bridge click config-store core csma csma-layout dsdv emu energy flow-monitor internet lte mesh mobility mpi netanim network nix-vector-routing ns3tcp ns3wifi olsr openflow point-to-point point-to-point-layout propagation spectrum stats tap-bridge template test tools topology-read uan virtual-net-device visualizer wifi wimax PASS: TestSuite ns3-wifi-interference PASS: TestSuite histogram ... PASS: TestSuite object PASS: TestSuite random-number-generators 92 of 92 tests passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors) .. This command is typically run by users to quickly verify that an |ns3| distribution has built correctly. (Note the order of the ``PASS: ...`` lines can vary, which is okay. What's important is that the summary line at the end report that all tests passed; none failed or crashed.) Αυτή η εντολή τυπικά τρέχει από τους χρήστες για την γρήγορη επαλήθευση ότι μια διανομή |ns3| έχει χτιστεί σωστά. (Σημειώστε τη σειρά των ``PASS: ...`` μπορεί να διαφέρουν, το οποίο είναι εντάξει. Αυτό που είναι σημαντικό είναι ότι η συνοπτική γραμμή στο τέλος ότι όλες οι δοκιμές πέρασαν, καμία δεν απέτυχε ή συνετρίβη.) .. Running a Script Τρέχοντας ένα Σενάριο ********************* .. We typically run scripts under the control of Waf. This allows the build system to ensure that the shared library paths are set correctly and that the libraries are available at run time. To run a program, simply use the ``--run`` option in Waf. Let's run the |ns3| equivalent of the ubiquitous hello world program by typing the following Εμείς συνήθως τρέχουμε σενάρια υπό τον έλεγχο του Waf. Αυτό επιτρέπει στο σύστημα κατασκευής να εξασφαλίσει ότι οι κοινές διαδρομές βιβλιοθήκης είναι σωστά ρυθμισμένες και ότι οι βιβλιοθήκες είναι διαθέσιμες κατά το χρόνο εκτέλεσης. Για να εκτελέσετε ένα πρόγραμμα, απλά χρησιμοποιήστε την επιλογή ``--run`` του Waf. Ας τρέξουμε τον |ns3| αντίστοιχο του πανταχού πρόγραμματος Hello World, πληκτρολογώντας τα εξής :: $ ./waf --run hello-simulator .. Waf first checks to make sure that the program is built correctly and executes a build if required. Waf then executes the program, which produces the following output. Ο Waf ελέγχει πρώτα για να βεβαιωθεί ότι το πρόγραμμα έχει χτιστεί σωστά και εκτελεί μια συγκέντρωση, εάν απαιτείται. Ο Waf εκτελεί τότε το πρόγραμμα, το οποίο παράγει την ακόλουθη έξοδο. :: Hello Simulator .. Congratulations! You are now an ns-3 user! Συγχαρητήρια! Τώρα είστε χρήστης του ns-3! .. What do I do if I don't see the output? **Τι μπορώ να κάνω αν δεν βλέπω την έξοδο;** .. If you see Waf messages indicating that the build was completed successfully, but do not see the "Hello Simulator" output, chances are that you have switched your build mode to ``optimized`` in the `Building with Waf`_ section, but have missed the change back to ``debug`` mode. All of the console output used in this tutorial uses a special |ns3| logging component that is useful for printing user messages to the console. Output from this component is automatically disabled when you compile optimized code -- it is "optimized out." If you don't see the "Hello Simulator" output, type the following Αν δείτε τα μηνύματα του Waf υποδεικνύοντας ότι η κατασκευή ολοκληρώθηκε με επιτυχία, αλλά δεν βλέπετε την έξοδο "Hello Simulator", οι πιθανότητες είναι ότι έχετε αλλάξει την λειτουργία κατασκευής σας στο ``optimized`` στο `Χτίζοντας με Waf`_ τμήμα, αλλά έχετε ξεχάσει την αλλαγή πίσω στη λειτουργία ``debug``. Όλοι οι έξοδοι της κονσόλας που χρησιμοποιούνται σε αυτό τον οδηγό, χρησιμοποιούν ένα ειδικό συστατικό καταγραφής |ns3| που είναι χρήσιμο για την εκτύπωση μηνυμάτων του χρήστη στην κονσόλα. Η έξοδος από το συστατικό αυτό είναι απενεργοποιημένη αυτόματα κατά τη μεταγλώττιση του βελτιστοποιημένου κώδικα -- αυτό είναι "optimized out." Εάν δεν μπορείτε να δείτε την έξοδο "Hello Simulator», πληκτρολογήστε τα ακόλουθα :: $ ./waf configure --build-profile=debug --enable-examples --enable-tests .. to tell Waf to build the debug versions of the |ns3| programs that includes the examples and tests. You must still build the actual debug version of the code by typing για να πούμε στον Waf να χτίσει τις εκδόσεις debug απο τα προγράμματα του |ns3| που περιλαμβάνει τα παραδείγματα και τις δοκιμές(τεστ). Θα πρέπει ακόμα να οικοδομήσουμε την πραγματική debug έκδοση του κώδικα πληκτρολογώντας :: $ ./waf .. Now, if you run the ``hello-simulator`` program, you should see the expected output. Τώρα, αν εκτελέσετε το πρόγραμμα ``hello-simulator``, θα πρέπει να δείτε την αναμενόμενη εξαγωγή. .. Program Arguments Τα Ορίσματα του Προγράμματος ++++++++++++++++++++++++++++ .. To feed command line arguments to an |ns3| program use this pattern Για να τροφοδοτήσει τα ορίσματα της γραμμής εντολών για ένα πρόγραμμα |ns3| χρησιμοποιήστε αυτό το μοτίβο :: $ ./waf --run --command-template="%s " .. Substitute your program name for ````, and the arguments for ````. The ``--command-template`` argument to Waf is basically a recipe for constructing the actual command line Waf should use to execute the program. Waf checks that the build is complete, sets the shared library paths, then invokes the executable using the provided command line template, inserting the program name for the ``%s`` placeholder. (I admit this is a bit awkward, but that's the way it is. Patches welcome!) Αντικαταστήστε το όνομα του προγράμματος σας για ````, και τα ορίσματα για ````. Το όρισμα ``--command-template`` στο Waf είναι βασικά μια συνταγή για την κατασκευή της πραγματικής γραμμής εντολών Waf που θα πρέπει να χρησιμοποιήσετε για να εκτελέσει το πρόγραμμα. Ο Waf ελέγχει ότι η κατασκευή έχει ολοκληρωθεί, θέτει τους κοινούς διαδρόμους(paths), μετά επικαλείται το εκτελέσιμο χρησιμοποιώντας το παρεχόμενο πρότυπο της γραμμής εντολών, εισάγοντας το όνομα του προγράμματος για την θέση ``%s``. (Ομολογώ ότι αυτό είναι λίγο περίεργο, αλλά αυτός είναι ο τρόπος. Patches ευπρόσδεκτα!) .. Another particularly useful example is to run a test suite by itself. Let's assume that a ``mytest`` test suite exists (it doesn't). Above, we used the ``./test.py`` script to run a whole slew of tests in parallel, by repeatedly invoking the real testing program, ``test-runner``. To invoke ``test-runner`` directly for a single test Ένα άλλο ιδιαίτερα χρήσιμο παράδειγμα είναι να εκτελέσετε μια σουίτα δοκιμής από μόνη της. Ας υποθέσουμε ότι υπάρχει ένα τέστ ``mytest`` σουίτα (δεν υπάρχει). Πάνω, χρησιμοποιήσαμε το σενάριο ``. / test.py`` για να εκτελέσει μια αρμαθιά από δοκιμές(τέστ) παράλληλα, κατ 'επανάληψη επίκληση του πραγματικού προγράμματος δοκιμών, ``test-runner``. Για να επικαλεστείτε το ``test-runner`` άμεσα για μία μόνο δοκιμή :: $ ./waf --run test-runner --command-template="%s --suite=mytest --verbose" .. This passes the arguments to the ``test-runner`` program. Since ``mytest`` does not exist, an error message will be generated. To print the available ``test-runner`` options Αυτό περνά τα ορίσματα για το ``test-runner``. Από τη στιγμή που το ``mytest`` δεν υπάρχει, ένα μήνυμα σφάλματος θα δημιουργηθεί. Για να εκτυπώσετε τις διαθέσιμες επιλογές ``test-runner`` :: $ ./waf --run test-runner --command-template="%s --help" .. Debugging Εντοπισμός Σφαλμάτων ++++++++++++++++++++ .. To run |ns3| programs under the control of another utility, such as a debugger (*e.g.* ``gdb``) or memory checker (*e.g.* ``valgrind``), you use a similar ``--command-template="..."`` form. Για να εκτελέσετε τα |ns3| προγράμματα υπό τον έλεγχο μιας άλλης κοινής ωφέλειας, όπως ένα πρόγραμμα εντοπισμού σφαλμάτων (*π.χ.* ``gdb``) ή ελεγκτή μνήμης (*π.χ.* ``valgrind``), μπορείτε να χρησιμοποιήσετε μια παρόμοια μορφή ``--command-template = "..."``. .. For example, to run your |ns3| program ``hello-simulator`` with the arguments ```` under the ``gdb`` debugger Για παράδειγμα, για να εκτελέσετε το |ns3| πρόγραμμα ``hello-simulator`` με τα ορίσματα ```` κάτω από τον εντοπισμό σφαλμάτων ``gdb`` :: $ ./waf --run=hello-simulator --command-template="gdb %s --args " .. Notice that the |ns3| program name goes with the ``--run`` argument, and the control utility (here ``gdb``) is the first token in the ``--commmand-template`` argument. The ``--args`` tells ``gdb`` that the remainder of the command line belongs to the "inferior" program. (Some ``gdb``'s don't understand the ``--args`` feature. In this case, omit the program arguments from the ``--command-template``, and use the ``gdb`` command ``set args``.) Παρατηρήστε ότι το όνομα του προγράμματος |ns3| πηγαίνει με το όρισμα ``--run``, και το βοηθητικό πρόγραμμα ελέγχου (εδώ ``gdb``) είναι το πρώτο συμβολικό στο όρισμα ``--commmand-template``. Το ``--args`` λέει στο ``gdb`` ότι το υπόλοιπο της γραμμής εντολών ανήκει στην «κατώτερο» πρόγραμμα. (Ορισμένοι ``gdb`` δεν καταλαβαίνουν το χαρακτηριστικό ``--args``. Σε αυτήν την περίπτωση, παραλείψτε τους ορισμούς του προγράμματος από την ``--command-template``, και να χρησιμοποιήσετε το ``gdb`` εντολή ``set args``.) .. We can combine this recipe and the previous one to run a test under the debugger Μπορούμε να συνδυάσουμε αυτή τη συνταγή και το προηγούμενο για να εκτελέσετε μια δοκιμή σύμφωνα με το πρόγραμμα εντοπισμού σφαλμάτων :: $ ./waf --run test-runner --command-template="gdb %s --args --suite=mytest --verbose" .. Working Directory Κατάλογος Εργασίας ++++++++++++++++++ .. Waf needs to run from it's location at the top of the |ns3| tree. This becomes the working directory where output files will be written. But what if you want to keep those ouf to the |ns3| source tree? Use the ``--cwd`` argument Ο Waf χρειάζεται να τρέχει από την τοποθεσία του στην κορυφή του δέντρου του |ns3|. Αυτό γίνεται ο κατάλογος εργασίας όπου θα γραφτούν τα αρχεία εξόδου. Τι γίνεται όμως αν θέλετε να διατηρήσετε αυτές τις ouf στο δέντρο |ns3| πηγαίου κώδικα; Χρησιμοποιήστε το `` --cwd`` επιχείρημα :: $ ./waf --cwd=... .. It may be more convenient to start with your working directory where you want the output files, in which case a little indirection can help Μπορεί να είναι πιο βολικό να ξεκινήσετε με τον κατάλογο εργασίας σας όπου θέλετε τα αρχεία εξόδου, οπότε μπορεί να βοηθήσει το παρακάτω :: $ function waff { CWD="$PWD" cd $NS3DIR >/dev/null ./waf --cwd="$CWD" $* cd - >/dev/null } .. This embellishment of the previous version saves the current working directory, ``cd``'s to the Waf directory, then instructs Waf to change the working directory *back* to the saved current working directory before running the program. Αυτό το στολίδι της προηγούμενης έκδοσης αποθηκεύει τον τρέχοντα κατάλογο εργασίας, ``cd`` στον κατάλογο Waf, και μετά δίνει εντολή στο Waf να αλλάξει τον κατάλογο εργασίας *πίσω* στον αποθηκευμένο τρέχοντα κατάλογο εργασίας πριν από την εκτέλεση του προγράμματος.