[Xorp-users] Building Xorp SVN on Linux Debian sparc fails

Jose Manuel dos Santos Calhariz jose.spam at netvisao.pt
Mon Mar 8 16:58:39 PST 2010


On Sun, Mar 07, 2010 at 04:13:50PM -0800, Ben Greear wrote:
> On 03/07/2010 10:07 AM, Jose Manuel dos Santos Calhariz wrote:
>> On Sat, Mar 06, 2010 at 12:14:00AM -0800, Ben Greear wrote:
>>> On 03/05/2010 07:29 PM, Jose Manuel dos Santos Calhariz wrote:
>>>>
>>>> I am trying to compile Xorp SVN on a sparc machine running Debian.
>>>> But it fails with:
>>>>
>>>> g++ -o obj/sparc64-unknown-linux-gnu/libproto/packet.os -c -O1 -g3 -Werror -W -Wall -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align -Woverloaded-virtual -ftemplate-depth-25 -pipe -fPIC -DXRL_PF=120 -D_FORTIFY_SOURCE=0 -DBOOST_DISABLE_THREADS -I/usr/local/include -Iobj/sparc64-unknown-linux-gnu -I. -I. libproto/packet.cccc1plus: warnings being treated as errors
>>>> libproto/packet.cc: In static member function 'static ArpHeader&   ArpHeader::assign(uint8_t*)':
>>>> libproto/packet.cc:238: error: cast from 'uint8_t*' to 'ArpHeader*' increases required alignment of target type
>>>> libproto/packet.cc: In static member function 'static const ArpHeader&   ArpHeader::assign(const std::vector<unsigned char, std::allocator<unsigned char>   >&)':
>>>> libproto/packet.cc:248: error: cast from 'const unsigned char*' to 'const ArpHeader*' increases required alignment of target type
>>>> scons: *** [obj/sparc64-unknown-linux-gnu/libproto/packet.os] Error 1
>>>> scons: building terminated because of errors.
>>>
>>> Here's a patch against my tree (and will probably apply somewhat clean to official SVN)
>>> that might fix your problem.
>>
>> Thank you.  It applied without problems to the official SVN and
>> compiles.  Now the compilation stops on another error.
>>
>> g++ -o obj/sparc64-unknown-linux-gnu/fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.os -c -O1 -g3 -Werror -W -Wall -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align -Woverloaded-virtual -ftemplate-depth-25 -pipe -fPIC -DXRL_PF=120 -D_FORTIFY_SOURCE=0 -DBOOST_DISABLE_THREADS -I/usr/local/include -Iobj/sparc64-unknown-linux-gnu -I. -I. fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc
>> cc1plus: warnings being treated as errors
>> fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc: In static member function 'static int IfConfigGetNetlinkSocket::parse_buffer_netlink_socket(IfConfig&, IfTree&, const std::vector<unsigned char, std::allocator<unsigned char>  >&)':
>> fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc:87: error: cast from 'char*' to 'nlmsghdr*' increases required alignment of target type
>> fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc: In function 'void nlm_newlink_to_fea_cfg(IfTree&, const ifinfomsg*, int)':
>> fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc:269: error: cast from 'char*' to 'rtattr*' increases required alignment of target type
>> fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc: In function 'void nlm_dellink_to_fea_cfg(IfTree&, const ifinfomsg*, int)':
>> fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc:533: error: cast from 'char*' to 'rtattr*' increases required alignment of target type
>> fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc: In function 'void nlm_newdeladdr_to_fea_cfg(IfTree&, const ifaddrmsg*, int, bool)':
>> fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc:598: error: cast from 'char*' to 'rtattr*' increases required alignment of target type
>> scons: *** [obj/sparc64-unknown-linux-gnu/fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.os] Error 1
>> scons: building terminated because of errors.
>
> I pushed the previous patch (slightly cleaned up) to my tree.
>
> For the errors above, my code is different from SVN, so the attached patch
> is likely of little help.  But, you might try applying it to my git tree
> to see if it helps _it_ compile.
>

It was easy to change your patch for SVN, thank you.  But it still fails:

g++ -o obj/sparc64-unknown-linux-gnu/fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.os -c -O1 -g3 -Werror -W -Wall -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align -Woverloaded-virtual -ftemplate-depth-25 -pipe -fPIC -DXRL_PF=120 -D_FORTIFY_SOURCE=0 -DBOOST_DISABLE_THREADS -I/usr/local/include -Iobj/sparc64-unknown-linux-gnu -I. -I. fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc
cc1plus: warnings being treated as errors
fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc: In static member function 'static int IfConfigGetNetlinkSocket::parse_buffer_netlink_socket(IfConfig&, IfTree&, const std::vector<unsigned char, std::allocator<unsigned char> >&)':
fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc:87: error: cast from 'char*' to 'nlmsghdr*' increases required alignment of target type
fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc: In function 'void nlm_newlink_to_fea_cfg(IfTree&, const ifinfomsg*, int)':
fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc:269: error: cast from 'char*' to 'rtattr*' increases required alignment of target type
fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc: In function 'void nlm_dellink_to_fea_cfg(IfTree&, const ifinfomsg*, int)':
fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc:533: error: cast from 'char*' to 'rtattr*' increases required alignment of target type
fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc: In function 'void nlm_newdeladdr_to_fea_cfg(IfTree&, const ifaddrmsg*, int, bool)':
fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc:598: error: cast from 'char*' to 'rtattr*' increases required alignment of target type
scons: *** [obj/sparc64-unknown-linux-gnu/fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.os] Error 1
scons: building terminated because of errors.

I attached the patch I used.



> For what it's worth, compiles fine on x86-32 Fedora 12.
>
> Compile tested only.
>
> Thanks,
> Ben
>
>

    Jose Calhariz


-- 
--

Posso imaginar muitas coisas mais importantes que ser amado por todo mundo

--Robert Murdoch
-------------- next part --------------
Index: xorp/fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc
===================================================================
--- xorp.orig/fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc	2010-03-09 00:35:49.000000000 +0000
+++ xorp/fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc	2010-03-09 00:43:57.000000000 +0000
@@ -84,8 +84,8 @@ IfConfigGetNetlinkSocket::parse_buffer_n
 
     for (nlh = align_data.payload();
 	 NLMSG_OK(nlh, buffer_bytes);
-	 nlh = NLMSG_NEXT(const_cast<struct nlmsghdr*>(nlh), buffer_bytes)) {
-	void* nlmsg_data = NLMSG_DATA(const_cast<struct nlmsghdr*>(nlh));
+	 nlh = NLMSG_NEXT(nlh, buffer_bytes)) {
+	void* nlmsg_data = NLMSG_DATA(nlh);
 	
 	switch (nlh->nlmsg_type) {
 	case NLMSG_ERROR:
@@ -266,7 +266,7 @@ nlm_newlink_to_fea_cfg(IfTree& iftree, c
     
     // The attributes
     memset(rta_array, 0, sizeof(rta_array));
-    rtattr = IFLA_RTA(const_cast<struct ifinfomsg*>(ifinfomsg));
+    rtattr = IFLA_RTA(ifinfomsg);
     NlmUtils::get_rtattr(rtattr, rta_len, rta_array,
 			 sizeof(rta_array) / sizeof(rta_array[0]));
     
@@ -287,8 +287,8 @@ nlm_newlink_to_fea_cfg(IfTree& iftree, c
 		  ifinfomsg->ifi_index);
 	return;
     }
-    caddr_t rta_data = reinterpret_cast<caddr_t>(RTA_DATA(const_cast<struct rtattr*>(rta_array[IFLA_IFNAME])));
-    if_name = string(reinterpret_cast<char*>(rta_data));
+
+    if_name = (char*)(RTA_DATA(rta_array[IFLA_IFNAME]));
     debug_msg("interface: %s\n", if_name.c_str());
     
     //
@@ -530,7 +530,7 @@ nlm_dellink_to_fea_cfg(IfTree& iftree, c
     
     // The attributes
     memset(rta_array, 0, sizeof(rta_array));
-    rtattr = IFLA_RTA(const_cast<struct ifinfomsg*>(ifinfomsg));
+    rtattr = IFLA_RTA(ifinfomsg);
     NlmUtils::get_rtattr(rtattr, rta_len, rta_array,
 			 sizeof(rta_array) / sizeof(rta_array[0]));
     
@@ -541,8 +541,8 @@ nlm_dellink_to_fea_cfg(IfTree& iftree, c
 	XLOG_FATAL("Could not find interface name for interface index %d",
 		   ifinfomsg->ifi_index);
     }
-    caddr_t rta_data = reinterpret_cast<caddr_t>(RTA_DATA(const_cast<struct rtattr*>(rta_array[IFLA_IFNAME])));
-    if_name = string(reinterpret_cast<char*>(rta_data));
+
+    if_name = (char*)(RTA_DATA(rta_array[IFLA_IFNAME]));
     debug_msg("Deleting interface name: %s\n", if_name.c_str());
     
     //
@@ -595,7 +595,7 @@ nlm_newdeladdr_to_fea_cfg(IfTree& iftree
     
     // The attributes
     memset(rta_array, 0, sizeof(rta_array));
-    rtattr = IFA_RTA(const_cast<struct ifaddrmsg*>(ifaddrmsg));
+    rtattr = IFA_RTA(ifaddrmsg);
     NlmUtils::get_rtattr(rtattr, rta_len, rta_array,
 			 sizeof(rta_array) / sizeof(rta_array[0]));
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
Url : http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-users/attachments/20100309/00783722/attachment.bin 


More information about the Xorp-users mailing list