[Xorp-users] xorp-1.1 build failure on Gentoo AMD64
pavlin@icir.org
pavlin@icir.org
Sun, 08 May 2005 12:30:52 -0700
----Next_Part(Sun_May__8_12:30:33_2005_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
> XORP-1.1 fails to compile on AMD64 Gentoo. Any idea?
>
> make[3]: Entering directory `/usr/local/src/Routing/xorp-1.1/fea'
> source='fticonfig_entry_get_netlink.cc'
> object='fticonfig_entry_get_netlink.lo' libtool=yes \
> depfile='.deps/fticonfig_entry_get_netlink.Plo'
> tmpdepfile='.deps/fticonfig_entry_get_netlink.TPlo' \
> depmode=gcc3 /bin/sh ../config/depcomp \
> /bin/sh ../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I.. -I..
> -g -W -Wall -Wwrite-strings -Wca st-qual -Werror -Wpointer-arith
> -Wcast-align -Woverloaded-virtual -ftemplate-depth-22 -pipe -c -o
> fticonfig _entry_get_netlink.lo `test -f fticonfig_entry_get_netlink.cc
> || echo './'`fticonfig_entry_get_netlink.cc
> g++ -DHAVE_CONFIG_H -I. -I. -I.. -I.. -g -W -Wall -Wwrite-strings
> -Wcast-qual -Werror -Wpointer-arith -Wcas t-align -Woverloaded-virtual
> -ftemplate-depth-22 -pipe -c fticonfig_entry_get_netlink.cc -MT
> fticonfig_entr y_get_netlink.lo -MD -MP -MF
> .deps/fticonfig_entry_get_netlink.TPlo -o fticonfig_entry_get_netlink.o
> fticonfig_entry_get_netlink.cc: In member function `virtual bool
> FtiConfigEntryGetNetlink::lookup_route_by_ dest(const IPvX&, FteX&)':
> fticonfig_entry_get_netlink.cc:317: warning: int format, different type
> arg (arg 4)
> make[3]: *** [fticonfig_entry_get_netlink.lo] Error 1
> make[3]: Leaving directory `/usr/local/src/Routing/xorp-1.1/fea'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory `/usr/local/src/Routing/xorp-1.1/fea'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/usr/local/src/Routing/xorp-1.1'
> make: *** [all] Error 2
Sigh, this is a casting error. Below is a patch (committed to CVS)
that should fix the problem. Note that it fixes similar problems in
other places as well, but without access to an AMD64 Linux box I
cannot guarantee there aren't other similar compilation problems.
Please let us know if there are other compilation errors.
Thanks,
Pavlin
----Next_Part(Sun_May__8_12:30:33_2005_809)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="linux_amd64.patch"
Index: fticonfig_entry_get_netlink.cc
===================================================================
RCS file: /usr/local/share/doc/apache/cvs/xorp/fea/fticonfig_entry_get_netlink.cc,v
retrieving revision 1.28
diff -u -p -r1.28 fticonfig_entry_get_netlink.cc
--- fticonfig_entry_get_netlink.cc 25 Mar 2005 02:53:01 -0000 1.28
+++ fticonfig_entry_get_netlink.cc 8 May 2005 19:21:32 -0000
@@ -314,8 +314,9 @@ FtiConfigEntryGetNetlink::lookup_route_b
// Add the 'ipaddr' address as an attribute
rta_len = RTA_LENGTH(IPvX::addr_size(family));
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = RTM_RTA(rtmsg);
rtattr->rta_type = RTA_DST;
Index: fticonfig_entry_set_netlink.cc
===================================================================
RCS file: /usr/local/share/doc/apache/cvs/xorp/fea/fticonfig_entry_set_netlink.cc,v
retrieving revision 1.22
diff -u -p -r1.22 fticonfig_entry_set_netlink.cc
--- fticonfig_entry_set_netlink.cc 25 Mar 2005 02:53:03 -0000 1.22
+++ fticonfig_entry_set_netlink.cc 8 May 2005 19:21:32 -0000
@@ -257,8 +257,9 @@ FtiConfigEntrySetNetlink::add_entry(cons
// Add the destination address as an attribute
rta_len = RTA_LENGTH(fte.net().masked_addr().addr_size());
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = RTM_RTA(rtmsg);
rtattr->rta_type = RTA_DST;
@@ -271,8 +272,9 @@ FtiConfigEntrySetNetlink::add_entry(cons
if (fte.nexthop() != IPvX::ZERO(family)) {
rta_len = RTA_LENGTH(fte.nexthop().addr_size());
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = (struct rtattr*)(((char*)(rtattr)) + RTA_ALIGN((rtattr)->rta_len));
rtattr->rta_type = RTA_GATEWAY;
@@ -318,8 +320,9 @@ FtiConfigEntrySetNetlink::add_entry(cons
int int_if_index = if_index;
rta_len = RTA_LENGTH(sizeof(int_if_index));
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = (struct rtattr*)(((char*)(rtattr)) +
RTA_ALIGN((rtattr)->rta_len));
@@ -334,8 +337,9 @@ FtiConfigEntrySetNetlink::add_entry(cons
int int_priority = fte.metric();
rta_len = RTA_LENGTH(sizeof(int_priority));
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = (struct rtattr*)(((char*)(rtattr)) + RTA_ALIGN((rtattr)->rta_len));
rtattr->rta_type = RTA_PRIORITY;
@@ -454,8 +458,9 @@ FtiConfigEntrySetNetlink::delete_entry(c
// Add the destination address as an attribute
rta_len = RTA_LENGTH(fte.net().masked_addr().addr_size());
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = RTM_RTA(rtmsg);
rtattr->rta_type = RTA_DST;
Index: ifconfig_set_netlink.cc
===================================================================
RCS file: /usr/local/share/doc/apache/cvs/xorp/fea/ifconfig_set_netlink.cc,v
retrieving revision 1.21
diff -u -p -r1.21 ifconfig_set_netlink.cc
--- ifconfig_set_netlink.cc 25 Mar 2005 02:53:08 -0000 1.21
+++ ifconfig_set_netlink.cc 8 May 2005 19:21:32 -0000
@@ -472,8 +472,9 @@ IfConfigSetNetlink::config_interface(con
ifinfomsg->ifi_change = 0xffffffff;
if (NLMSG_ALIGN(nlh->nlmsg_len) > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len));
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len)));
}
nlh->nlmsg_len = NLMSG_ALIGN(nlh->nlmsg_len);
@@ -612,8 +613,9 @@ IfConfigSetNetlink::set_interface_mac_ad
// Add the MAC address as an attribute
rta_len = RTA_LENGTH(ETH_ALEN);
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = IFLA_RTA(ifinfomsg);
rtattr->rta_type = IFLA_ADDRESS;
@@ -721,8 +723,9 @@ IfConfigSetNetlink::set_interface_mtu(co
unsigned int uint_mtu = mtu;
rta_len = RTA_LENGTH(sizeof(unsigned int));
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = IFLA_RTA(ifinfomsg);
rtattr->rta_type = IFLA_MTU;
@@ -876,8 +879,9 @@ IfConfigSetNetlink::add_vif_address(cons
// Add the address as an attribute
rta_len = RTA_LENGTH(addr.addr_size());
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = IFA_RTA(ifaddrmsg);
rtattr->rta_type = IFA_LOCAL;
@@ -890,8 +894,9 @@ IfConfigSetNetlink::add_vif_address(cons
// Set the p2p or broadcast address
rta_len = RTA_LENGTH(dst_or_bcast.addr_size());
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = (struct rtattr*)(((char*)(rtattr)) + RTA_ALIGN((rtattr)->rta_len));
rtattr->rta_type = IFA_UNSPEC;
@@ -1019,8 +1024,9 @@ IfConfigSetNetlink::delete_vif_address(c
// Add the address as an attribute
rta_len = RTA_LENGTH(addr.addr_size());
if (NLMSG_ALIGN(nlh->nlmsg_len) + rta_len > sizeof(buffer)) {
- XLOG_FATAL("AF_NETLINK buffer size error: %d instead of %d",
- sizeof(buffer), NLMSG_ALIGN(nlh->nlmsg_len) + rta_len);
+ XLOG_FATAL("AF_NETLINK buffer size error: %u instead of %u",
+ XORP_UINT_CAST(sizeof(buffer)),
+ XORP_UINT_CAST(NLMSG_ALIGN(nlh->nlmsg_len) + rta_len));
}
rtattr = IFA_RTA(ifaddrmsg);
rtattr->rta_type = IFA_LOCAL;
Index: netlink_socket.cc
===================================================================
RCS file: /usr/local/share/doc/apache/cvs/xorp/fea/netlink_socket.cc,v
retrieving revision 1.30
diff -u -p -r1.30 netlink_socket.cc
--- netlink_socket.cc 25 Mar 2005 02:53:11 -0000 1.30
+++ netlink_socket.cc 8 May 2005 19:21:32 -0000
@@ -185,8 +185,9 @@ NetlinkSocket::start(int af, string& err
}
if (snl_len != sizeof(snl)) {
error_msg = c_format("Wrong address length of AF_NETLINK socket: "
- "%d instead of %d",
- snl_len, sizeof(snl));
+ "%u instead of %u",
+ XORP_UINT_CAST(snl_len),
+ XORP_UINT_CAST(sizeof(snl)));
close(_fd);
_fd = -1;
return (XORP_ERROR);
@@ -203,8 +204,9 @@ NetlinkSocket::start(int af, string& err
// XXX: 'nl_pid' is supposed to be defined as 'pid_t'
if ( (pid_t)snl.nl_pid != pid()) {
error_msg = c_format("Wrong nl_pid of AF_NETLINK socket: "
- "%d instead of %d",
- snl.nl_pid, pid());
+ "%u instead of %u",
+ XORP_UINT_CAST(snl.nl_pid),
+ XORP_UINT_CAST(pid()));
close(_fd);
_fd = -1;
return (XORP_ERROR);
@@ -293,7 +295,8 @@ NetlinkSocket::force_read(string& error_
"message truncated: "
"received %d bytes instead of (at least) %u "
"bytes",
- got, XORP_UINT_CAST(sizeof(struct nlmsghdr)));
+ XORP_INT_CAST(got),
+ XORP_UINT_CAST(sizeof(struct nlmsghdr)));
return (XORP_ERROR);
}
@@ -369,7 +372,8 @@ NetlinkSocket::force_recvfrom(int flags,
"message truncated: "
"received %d bytes instead of (at least) %u "
"bytes",
- got, XORP_UINT_CAST(sizeof(struct nlmsghdr)));
+ XORP_INT_CAST(got),
+ XORP_UINT_CAST(sizeof(struct nlmsghdr)));
return (XORP_ERROR);
}
@@ -459,8 +463,9 @@ NetlinkSocket::force_recvmsg(int flags,
}
if (msg.msg_namelen != sizeof(snl)) {
error_msg = c_format("Netlink socket recvmsg error: "
- "sender address length %d instead of %u ",
- msg.msg_namelen, sizeof(snl));
+ "sender address length %d instead of %u",
+ XORP_INT_CAST(msg.msg_namelen),
+ XORP_UINT_CAST(sizeof(snl)));
return (XORP_ERROR);
}
message.resize(message.size() + got);
@@ -472,7 +477,8 @@ NetlinkSocket::force_recvmsg(int flags,
"message truncated: "
"received %d bytes instead of (at least) %u "
"bytes",
- got, XORP_UINT_CAST(sizeof(struct nlmsghdr)));
+ XORP_INT_CAST(got),
+ XORP_UINT_CAST(sizeof(struct nlmsghdr)));
return (XORP_ERROR);
}
Index: netlink_socket_utils.cc
===================================================================
RCS file: /usr/local/share/doc/apache/cvs/xorp/fea/netlink_socket_utils.cc,v
retrieving revision 1.23
diff -u -p -r1.23 netlink_socket_utils.cc
--- netlink_socket_utils.cc 25 Mar 2005 02:53:11 -0000 1.23
+++ netlink_socket_utils.cc 8 May 2005 19:21:32 -0000
@@ -382,9 +382,9 @@ NlmUtils::check_netlink_request(NetlinkS
break;
default:
- debug_msg("Unhandled type %s(%d) (%d bytes)\n",
+ debug_msg("Unhandled type %s(%d) (%u bytes)\n",
NlmUtils::nlm_msg_type(nlh->nlmsg_type).c_str(),
- nlh->nlmsg_type, nlh->nlmsg_len);
+ nlh->nlmsg_type, XORP_UINT_CAST(nlh->nlmsg_len));
break;
}
}
----Next_Part(Sun_May__8_12:30:33_2005_809)----