Add gmp library and openssl to ns3

375 views
Skip to first unread message

Rihab Boussada

unread,
Jan 6, 2017, 7:39:22 AM1/6/17
to ns-3-users
Hello,
I want to execute my code under ns3. It work with this command: "


gcc -Wall -static test.c -o test2 -I/usr/local/include/pbc -L/usr/local/lib -lpbc -lgmp -lcrypto"


I tried this link http://shieldroute.blogspot.se/2012/08/extending-ns3-with-your-module-and.html but it doesn't work.

Please help me it is urgent.

regards

Noel Farrugia

unread,
Jan 10, 2017, 1:36:13 AM1/10/17
to ns-3-users
You need to modify the wscript file and attach the necessary libraries or else you'll get the errors that the libraries aren't found.

This is a sample wscript that should get you going
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

import os

def build(bld):

    # Location of the library path
    lib_path = '<library path location>'
    # Adding the static version of the library
    bld.read_stlib('<library name i.e the -lxxx without the -l', paths=[lib_path + 'lib'])
    # If you have a dynamic library use 
    bld.read_shlib(....)

    def set_properties(obj):
        # Adding the include folders directory for the library
        obj.includes = ['#', lib_path + 'include']
        # Adding the library together with the ns-3 dependencies
        obj.use = obj.ns3_module_dependencies + ['<library name, again i.e -lxxx without the -l']
        obj.install_path = None

    all_modules = [mod[len("ns3-"):] for mod in bld.env['NS3_ENABLED_MODULES']]
    obj = bld.create_ns3_program('TestSource', all_modules)
    obj.source = ['TestSource.cc']
    set_properties(obj)

Cheers,
Noel

donia....@etudiant-isi.utm.tn

unread,
Jul 20, 2017, 7:06:43 AM7/20/17
to ns-3-users
hello,
i have the same problem .which file wscript i need to modify? @Noel Farrugia
help please
yours faithfully

Noel Farrugia

unread,
Jul 20, 2017, 10:25:45 AM7/20/17
to ns-3-users
Hello,

You need to modify the wscript file that is located in the same directory as the simulation file you're trying to build.
Kindly give us more details if you want further help.

Regards,
Noel

donia....@etudiant-isi.utm.tn

unread,
Aug 14, 2017, 6:33:01 AM8/14/17
to ns-3-users
Good morning,
can you please send me your email @Noel
Regards

Noel Farrugia

unread,
Aug 14, 2017, 6:40:38 AM8/14/17
to ns-3-users
Good Morning,

What do you mean you cannot edit the wscript file? Again please
provide further information otherwise we cannot help.

Regards,
Noel

>Good morning,
>I still have the same problem,i could not edit the wscript file.
>please i need a quick response, i would be really grateful.
>Regards
> --
> Posting to this group should follow these guidelines
> https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ns-3-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ns-3-users/cvRbmcJ_AlM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ns-3-users+...@googlegroups.com.
> To post to this group, send email to ns-3-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ns-3-users.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages