ipsec编译错误

ipsec-tools-0.8.0 + centOS

今天编译出现了几处错误

grabmyaddr.c:424: error: dereferencing pointer ‘sin6’ does break strict-aliasing rules
grabmyaddr.c:426: error: dereferencing pointer ‘sin6’ does break strict-aliasing rules

参考了:http://plaza.rakuten.co.jp/foreverboy/,小日本的文章 奋斗

CFLAGS = -g -O2  -Wall -Werror -Wno-unused "-fno-strict-aliasing"
加上红色的部分,第一次我看网上有这个说法还不信,后面才知道,必须在那个目录

 

还有一处错误很简单,就是指定内核头文件,细节忘了 。

 

"-fno-strict-aliasing" 编译选项
有强制类型转化,是出现问题的原因。具体应该是防止优化,是英文的:

 
      If optimization level is >= 2 in gcc-4.1, strict-aliasing is used, and this could cause probelms when a pointer is referencing to a different type of object and the object is refered thereafter by using this pointer. That is the case in this example. So you should force the compiler to not use strict-aliasing by a argument "-fno-strict-aliasing" if you want to use "-O2" or "-O3".
 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值