在./compile em_real >& log.compile这一步编译的时候一直报错
搜索error发现均为PIE的问题:‘can not be used when making a PIE object; recompile with -fPIC’
查看各种解决方法得知是gcc编译的问题,在编译时加-no-pie,可以解决make语句安装时PIE的问题,而在此处./configure和./compile xxx的时候解决不了
参考GitHub上 relocation R_X86_64_32S against `.rodata’ can not be used when making a PIE object #519 试图添加LDFLAGS=-no-pie,不过依然没有解决
获得启发在前一步LDFLAGS=-no-pie ./configure
之后,会看到生成一个configure.wrf文件
将其中带有flag的地方都加上-no-pie
修改了两个地方:
CFLAGS = $(CFLAGS_LOCAL) -DDM_PARALLEL -DSTUBMPI \
-DMAX_HISTORY=$(MAX_HISTORY) -DNMM_CORE=$(WRF_NMM_CORE) -no-pie
LDFLAGS = $(OMP) $(FCFLAGS) $(LDFLAGS_LOCAL) -no-pie
保存之后再进行LDFLAGS=-no-pie ./compile em_real >& log.compile
则不再有如题报错可以编译成功了
(同理,在WPS编译时也会出现此问题,在configure.wps中改为
LDFLAGS = -no-pie
CFLAGS = -no-pie
即可编译成功)