@@ -35,6 +35,10 @@ def options(opt):
35
35
help = ('Specify the installed directory of elf-loader' ),
36
36
dest = 'with_elf_loader' , type = 'string' ,
37
37
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 )
38
42
opt .add_option ('--with-libaspect' ,
39
43
help = ('Specify the installed directory of libaspect.so' ),
40
44
dest = 'with_libaspect' , type = 'string' ,
@@ -99,6 +103,8 @@ def configure(conf):
99
103
conf .load ('clang_compilation_database' , tooldir = ['waf-tools' ])
100
104
conf .load ('command' , tooldir = ['waf-tools' ])
101
105
106
+ conf .env .GLIBC_INSTALL_DIR = conf .options .with_glibc
107
+
102
108
if Options .options .with_ns3 is not None and os .path .isdir (Options .options .with_ns3 ):
103
109
conf .env ['NS3_DIR' ]= os .path .abspath (Options .options .with_ns3 )
104
110
if not 'PKG_CONFIG_PATH' in os .environ :
@@ -759,6 +765,20 @@ def build(bld):
759
765
'helper/freebsd-stack-helper.h' ,
760
766
]
761
767
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 )
762
782
module_source = module_source + kernel_source
763
783
module_headers = module_headers + kernel_headers
764
784
uselib = ns3waf .modules_uselib (bld , ['core' , 'network' , 'internet' , 'netlink' ])
@@ -767,7 +787,7 @@ def build(bld):
767
787
headers = module_headers ,
768
788
use = uselib ,
769
789
includes = kernel_includes ,
770
- cxxflags = ['-Wno-deprecated-declarations' ],
790
+ cxxflags = extra_cflags_root + ['-Wno-deprecated-declarations' ]+ wl_end_group ,
771
791
lib = ['dl' ])
772
792
# lib=['dl','efence'])
773
793
@@ -820,7 +840,7 @@ def build(bld):
820
840
# and forward to the dce_* code
821
841
bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' , 'model/libc-global-variables.cc' ],
822
842
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 ,
824
844
defines = ['LIBSETUP=libc_setup' ],
825
845
linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
826
846
'-Wl,--version-script=' + os .path .join ('model' , 'libc.version' ),
@@ -829,7 +849,7 @@ def build(bld):
829
849
# and forward to the dce_* code
830
850
bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' ],
831
851
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 ,
833
853
defines = ['LIBSETUP=libpthread_setup' ],
834
854
linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
835
855
'-Wl,--version-script=' + os .path .join ('model' , 'libpthread.version' ),
@@ -839,7 +859,7 @@ def build(bld):
839
859
# and forward to the dce_* code
840
860
bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' ],
841
861
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 ,
843
863
defines = ['LIBSETUP=librt_setup' ],
844
864
linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
845
865
'-Wl,--version-script=' + os .path .join ('model' , 'librt.version' ),
@@ -849,7 +869,7 @@ def build(bld):
849
869
# and forward to the dce_* code
850
870
bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' ],
851
871
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 ,
853
873
defines = ['LIBSETUP=libm_setup' ],
854
874
linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
855
875
'-Wl,--version-script=' + os .path .join ('model' , 'libm.version' ),
@@ -859,7 +879,7 @@ def build(bld):
859
879
# and forward to the dce_* code
860
880
bld .shlib (source = ['model/libc.cc' , 'model/libc-setup.cc' ],
861
881
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 ,
863
883
defines = ['LIBSETUP=libdl_setup' ],
864
884
linkflags = ['-nostdlib' , '-fno-profile-arcs' ,
865
885
'-Wl,--version-script=' + os .path .join ('model' , 'libdl.version' ),
0 commit comments