编译内核出现multiple definition of `mpihelp_add_1

系统环境: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行左右

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值