Skip to contentSkip to conversation

Fix userland build failure in linux/if_tunnel.h]

PATCH New Sergei Poselenov 1 participant 1 message Aug 9, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix userland build failure in linux/if_tunnel.h]

Hello all,

As suggested, reposting the message in this list. Could someone please comment? Original message here:
http://lkml.org/lkml/2009/6/18/223

Thanks in advance,
Sergei

-------- Original Message --------
Subject: Re: [PATCH] Fix userland build failure in linux/if_tunnel.h
Date: Fri, 7 Aug 2009 15:31:06 +0400
From: Sergei Poselenov <[email protected]>
Organisation: Emcraft Systems
To: [email protected]
CC: [email protected]
References: <[email protected]>

Hello all,

Unfortunately, received no replies, but the problem still persists.

Probably, I was unclear describing the issue. It is not the busybox build problem - any application including exported linux/if_tunnel.h could fail the linkage because of unresolved __cpu_to_be16().

Here is a reduced testcase program:

#include <netinet/ip.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <asm/types.h>

#include <linux/if_tunnel.h>

void foo(void);
void foo(void)

{
	int a = GRE_CSUM;
}

How to reproduce:

bash> arm-linux-gcc -c t.c
bash> nm -n t.o

        U __cpu_to_be16

00000000 t $a
00000000 T foo

As you see, __cpu_to_be16 is undefined, so linking will fail. Adding <asm/byteorder.h> to if_tunnel.h, as I suggested, fixes the problem.

Thanks for any comments,
Sergei

Quoted 37 lines · On Thu, 18 Jun 2009 18:37:38 +0400 Sergei Poselenov <[email protected]>…

Hello all,

The last commit to linux/if_tunnel.h broke the busybox
application build.
When linking the final image linker complains:
networking/libiproute/lib.a(iptunnel.o): In function `parse_args':
/work/psl/e/arm-aa/target_rpms/busybox/BUILD/busybox-1.7.1/networking/libiproute/iptunnel.c:189:
undefined reference to
`__cpu_to_be16' /work/psl/e/arm-aa/target_rpms/busybox/BUILD/busybox-1.7.1/networking/libiproute/iptunnel.c:190:
undefined reference to
`__cpu_to_be16' /work/psl/e/arm-aa/target_rpms/busybox/BUILD/busybox-1.7.1/networking/libiproute/iptunnel.c:202:
undefined reference to `__cpu_to_be16'
...

Please review the following patch, which fixes the build error.

Subject: [PATCH] The busybox application build failed in linking complaining to unresolved __cpu_to_be16 (ARM target). This patch fixes this.

---
 include/linux/if_tunnel.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/if_tunnel.h +1 -0
index 5a9aae4..137130b 100644
@@ -2,6 +2,7 @@
 #define _IF_TUNNEL_H_
 
 #include <linux/types.h>
+#include <asm/byteorder.h>
 
 #ifdef __KERNEL__
 #include <linux/ip.h>