@@ -35,6 +35,10 @@ def options(opt):
3535 help = ('Specify the installed directory of elf-loader' ),
3636 dest = 'with_elf_loader' , type = 'string' ,
3737 default = None )
38+ opt .add_option ('--with-glibc' ,
39+ help = ('Specify the installed directory of Glibc-2.25' ),
40+ dest = 'with_glibc' , type = 'string' ,
41+ default = None )
3842 opt .add_option ('--with-libaspect' ,
3943 help = ('Specify the installed directory of libaspect.so' ),
4044 dest = 'with_libaspect' , type = 'string' ,
@@ -99,6 +103,8 @@ def configure(conf):
99103 conf .load ('clang_compilation_database' , tooldir = ['waf-tools' ])
100104 conf .load ('command' , tooldir = ['waf-tools' ])
101105
106+ conf .env .GLIBC_INSTALL_DIR = conf .options .with_glibc
107+
102108 if Options .options .with_ns3 is not None and os .path .isdir (Options .options .with_ns3 ):
103109 conf .env ['NS3_DIR' ]= os .path .abspath (Options .options .with_ns3 )
104110 if not 'PKG_CONFIG_PATH' in os .environ :
@@ -759,6 +765,20 @@ def build(bld):
759765 'helper/freebsd-stack-helper.h' ,
760766 ]
761767
768+ SYSROOT = bld .env .GLIBC_INSTALL_DIR
769+ extra_cflags_root = [
770+ '-L' + SYSROOT + '/usr/lib64' ,
771+ '-I' + SYSROOT + '/include' ,
772+ '--sysroot=' + SYSROOT ,
773+ '-Wl,--start-group' ,
774+ '-Wl,-rpath=' + SYSROOT + '/lib64' ,
775+ '-Wl,--dynamic-linker=' + SYSROOT + '/lib64/ld-2.31.so'
776+ ]
777+ wl_end_group = [
778+ '-Wl,--end-group'
779+ ]
780+
781+ bld .env .append_value ('LINKFLAGS' ,extra_cflags_root + wl_end_group )
762782 module_source = module_source + kernel_source
763783 module_headers = module_headers + kernel_headers
764784 uselib = ns3waf .modules_uselib (bld , ['core' , 'network' , 'internet' , 'netlink' ])
@@ -767,7 +787,7 @@ def build(bld):
767787 headers = module_headers ,
768788 use = uselib ,
769789 includes = kernel_includes ,
770- cxxflags = ['-Wno-deprecated-declarations' ],
790+ cxxflags = extra_cflags_root + ['-Wno-deprecated-declarations' ]+ wl_end_group ,
771791 lib = ['dl' ])
772792# lib=['dl','efence'])
773793
@@ -820,7 +840,7 @@ def build(bld):
820840 # and forward to the dce_* code
821841 bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' , 'model/libc-global-variables.cc' ],
822842 target = 'lib/c-ns3' ,
823- cxxflags = ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ],
843+ cxxflags = extra_cflags_root + ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ]+ wl_end_group ,
824844 defines = ['LIBSETUP=libc_setup' ],
825845 linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
826846 '-Wl,--version-script=' + os .path .join ('model' , 'libc.version' ),
@@ -829,7 +849,7 @@ def build(bld):
829849 # and forward to the dce_* code
830850 bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' ],
831851 target = 'lib/pthread-ns3' ,
832- cxxflags = ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ],
852+ cxxflags = extra_cflags_root + ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ]+ wl_end_group ,
833853 defines = ['LIBSETUP=libpthread_setup' ],
834854 linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
835855 '-Wl,--version-script=' + os .path .join ('model' , 'libpthread.version' ),
@@ -839,7 +859,7 @@ def build(bld):
839859 # and forward to the dce_* code
840860 bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' ],
841861 target = 'lib/rt-ns3' ,
842- cxxflags = ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ],
862+ cxxflags = extra_cflags_root + ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ]+ wl_end_group ,
843863 defines = ['LIBSETUP=librt_setup' ],
844864 linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
845865 '-Wl,--version-script=' + os .path .join ('model' , 'librt.version' ),
@@ -849,7 +869,7 @@ def build(bld):
849869 # and forward to the dce_* code
850870 bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' ],
851871 target = 'lib/m-ns3' ,
852- cxxflags = ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ],
872+ cxxflags = extra_cflags_root + ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ]+ wl_end_group ,
853873 defines = ['LIBSETUP=libm_setup' ],
854874 linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
855875 '-Wl,--version-script=' + os .path .join ('model' , 'libm.version' ),
@@ -859,7 +879,7 @@ def build(bld):
859879 # and forward to the dce_* code
860880 bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' ],
861881 target = 'lib/dl-ns3' ,
862- cxxflags = ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ],
882+ cxxflags = extra_cflags_root + ['-g' , '-fno-profile-arcs' , '-fno-test-coverage' , '-Wno-builtin-declaration-mismatch' ]+ wl_end_group ,
863883 defines = ['LIBSETUP=libdl_setup' ],
864884 linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
865885 '-Wl,--version-script=' + os .path .join ('model' , 'libdl.version' ),
0 commit comments