【问题1】

指针转换不兼容类问题,是编译器版本更新带入的一个问题
【解决办法】
一般规避方法只需在编译前声明CFLAGS=“-Wno-error-int-conversion”;在编译NCL前我们需要修config/LINUX文件中定义的CcOptions选项,增加-Wno-error-int-conversion即可。
此外,还需在CcOptions选项内额外添加-Xlinker -zmuldefs以规避重复定义报错问题。
【问题2】

未知类型名称内联--unknown type name 'inline'
【解决方案】
因编译时采用了-ansi编译选项,inline语法高版本不兼容,此时直接去掉编译选项可以规避,但会引入新问题:

出现许多未声明标识符,确切的说是声明的标识符无法被识别。因此选择折中的方式进行处理--使用-fno-asm代替-ansi解决。
【个人总结】
①源码修改
cd ncl_ncarg-6.3.0
sed -i '35c #elif (defined(ia64) || defined(x86_64) || defined(amd64) || defined(aarch64))' common/src/libncarg_c/yMakefile
sed -i '85c #if defined(IRIX64) || defined(x86_64) || defined(__LP64__) || defined(aarch64)' ni/src/lib/nio/yMakefile
sed -i '46c EXTRA_CCOPTIONS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fsigned-char' ni/src/ncl/yMakefile
sed -i '113c #if defined(IRIX64) || defined(x86_64) || defined(ia64) || defined(__LP64__) || defined(aarch64)' ni/src/ncl/yMakefile
sed -i '168c CC_LD = clang\+\+' ni/src/ncl/yMakefile
sed -i '170c CC_LD = clang\+\+' ni/src/ncl/yMakefile
sed -i '21c #define CCompiler clang' config/LINUX
sed -i '22c #define FCompiler flang' config/LINUX
sed -i '23c #define CtoFLibraries -lflang -lm -lpgmath -lflangrti -ltirpc' config/LINUX
sed -i '24c #define CtoFLibrariesUser -lflang -lm -lpgmath -lflangrti -ltirpc' config/LINUX
sed -i '25c #define CcOptions -fno-asm -fPIC -fopenmp -Wno-error=int-conversion -Xlinker -zmuldefs ' config/LINUX
sed -i '40a void _swapshort (register char *bp, register unsigned n);' ncarview/src/lib/libncarg_ras/misc.c
sed -i '41a void _swaplong (register char *bp, register unsigned n);' ncarview/src/lib/libncarg_ras/misc.c
②配置要求
对所有使用到的依赖都应在执行./Configure -v时全部导入(lib&include),包括yum安装的依赖路径,如:
FREETYPE2:
/usr/lib64/ /usr/include/freetype2
LIBXML2:
/usr/include/libxml2/libxml /usr/include/libxml2
TIRPC:
/usr/include/tirpc
...
注意:编译NCL-6.3.0时的HDF5应选择1.8版本,如使用1.10及1.12版本都将无法正常编译。
【问题1】
指针转换不兼容类问题,是编译器版本更新带入的一个问题
【解决办法】
一般规避方法只需在编译前声明CFLAGS=“-Wno-error-int-conversion”;在编译NCL前我们需要修config/LINUX文件中定义的CcOptions选项,增加-Wno-error-int-conversion即可。
此外,还需在CcOptions选项内额外添加-Xlinker -zmuldefs以规避重复定义报错问题。
【问题2】
未知类型名称内联--unknown type name 'inline'
【解决方案】
因编译时采用了-ansi编译选项,inline语法高版本不兼容,此时直接去掉编译选项可以规避,但会引入新问题:
出现许多未声明标识符,确切的说是声明的标识符无法被识别。因此选择折中的方式进行处理--使用-fno-asm代替-ansi解决。
【个人总结】
①源码修改
cd ncl_ncarg-6.3.0
sed -i '35c #elif (defined(ia64) || defined(x86_64) || defined(amd64) || defined(aarch64))' common/src/libncarg_c/yMakefile
sed -i '85c #if defined(IRIX64) || defined(x86_64) || defined(__LP64__) || defined(aarch64)' ni/src/lib/nio/yMakefile
sed -i '46c EXTRA_CCOPTIONS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fsigned-char' ni/src/ncl/yMakefile
sed -i '113c #if defined(IRIX64) || defined(x86_64) || defined(ia64) || defined(__LP64__) || defined(aarch64)' ni/src/ncl/yMakefile
sed -i '168c CC_LD = clang\+\+' ni/src/ncl/yMakefile
sed -i '170c CC_LD = clang\+\+' ni/src/ncl/yMakefile
sed -i '21c #define CCompiler clang' config/LINUX
sed -i '22c #define FCompiler flang' config/LINUX
sed -i '23c #define CtoFLibraries -lflang -lm -lpgmath -lflangrti -ltirpc' config/LINUX
sed -i '24c #define CtoFLibrariesUser -lflang -lm -lpgmath -lflangrti -ltirpc' config/LINUX
sed -i '25c #define CcOptions -fno-asm -fPIC -fopenmp -Wno-error=int-conversion -Xlinker -zmuldefs ' config/LINUX
sed -i '40a void _swapshort (register char *bp, register unsigned n);' ncarview/src/lib/libncarg_ras/misc.c
sed -i '41a void _swaplong (register char *bp, register unsigned n);' ncarview/src/lib/libncarg_ras/misc.c
②配置要求
对所有使用到的依赖都应在执行./Configure -v时全部导入(lib&include),包括yum安装的依赖路径,如:
FREETYPE2:
/usr/lib64/ /usr/include/freetype2
LIBXML2:
/usr/include/libxml2/libxml /usr/include/libxml2
TIRPC:
/usr/include/tirpc
...
注意:编译NCL-6.3.0时的HDF5应选择1.8版本,如使用1.10及1.12版本都将无法正常编译。