系统环境:Ubuntu16.04 kernel-4.4 gcc-5.4 g++-5.4
因为其它原因需要讲4.4内核降低,使用3.14.5版本的内核;在编译3.14.5时出现以下问题:
lib/mpi/generic_mpih-mul1.o: In function `mpihelp_add_1':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:39: multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:39: first defined here
lib/mpi/generic_mpih-mul1.o: In function `mpihelp_add':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:67: multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:67: first defined here
lib/mpi/generic_mpih-mul1.o: In function `mpihelp_sub_1':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:82: multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:82: first defined here
lib/mpi/generic_mpih-mul1.o: In function `mpihelp_sub':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:110: multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:110: first defined here
lib/mpi/generic_mpih-mul2.o: In function `mpihelp_add_1':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:39: multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:39: first defined here
lib/mpi/generic_mpih-mul2.o: In function `mpihelp_add':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:67: multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:67: first defined here
lib/mpi/generic_mpih-mul2.o: In function `mpihelp_sub_1':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:82: multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:82: first defined here
lib/mpi/generic_mpih-mul2.o: In function `mpihelp_sub':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:110: multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:110: first defined here
lib/mpi/generic_mpih-mul3.o: In function `mpihelp_add_1':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:39: multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:39: first defined here
lib/mpi/generic_mpih-mul3.o: In function `mpihelp_add':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:67: multiple definition of `mpihelp_add'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:67: first defined here
lib/mpi/generic_mpih-mul3.o: In function `mpihelp_sub_1':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:82: multiple definition of `mpihelp_sub_1'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:82: first defined here
lib/mpi/generic_mpih-mul3.o: In function `mpihelp_sub':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:110: multiple definition of `mpihelp_sub'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:110: first defined here
lib/mpi/generic_mpih-rshift.o: In function `mpihelp_add_1':
/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:39: multiple definition of `mpihelp_add_1'
lib/mpi/generic_mpih-lshift.o:/data/intel/linux-3.14.5/lib/mpi/mpi-inline.h:39: first defined here
lib/mpi/generic_mpih-rshift.o: In function `mpihelp_add':
...
解决方法:
1、修改lib/mpi-inline.h 将extern inline修改为static inline无效;
2、将编译器版本降低至4.9,如果gcc版本低于4.9可能会出现
error: unrecognized command line option '-fstack-protector-strong'
这是因为'-fstack-protector-strong'是在4.9才开始出现的,所以低于4.9就会编译不通过,测试后可行
3、打开linux-3.14.5/.config文件
CONFIG_HAVE_CC_STACKPROTECTOR=y
# CONFIG_CC_STACKPROTECTOR is not set
CONFIG_CC_STACKPROTECTOR_NONE=y
# CONFIG_CC_STACKPROTECTOR_REGULAR is not set
# CONFIG_CC_STACKPROTECTOR_STRONG is not set
将以上几个模块选项替换到相应位置,大概在第265行左右