This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problems with iproute2 cross compilation

Other Parts Discussed in Thread: AM3517
Hi

I'm trying to build the ip tool of iproute2 using:
$ source build/envsetup.sh
$ cd external/iproute2
$ mm TARGET_PRODUCT=am3517evm

The above lines just build tc. In fact there is no Android.mk file in
the ip directory. I've created an Android.mk file in external/iproute2/
ip and got lots of compiler errors.
It seems to me that the header files in external/iproute2/include/
linux and bionic/libc/kernel/common/linux are incompatible. For
instance the file if.h, in_route.h,... The following line in my
Android.mk file defines the order of the include files:
LOCAL_C_INCLUDES := $(KERNEL_HEADERS) external/iproute2/include

if.h is included from bionic/libc/kernel/common/linux instead of
external/iproute2/include. But if I change the order of the include
paths I get another bunch of errors. Copying and replacing header
files ends up in a big mess.

Is there any chance to build iproute2/ip using the rowboat-android
toolchain and environment?

I have no idea how to proceed. Thank you for your help.

andy

The content of the Android.mk in external/iproute2/ip:
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_SRC_FILES :=  ip.c ipaddress.c ipaddrlabel.c iproute.c iprule.c
\
    rtm_map.c iptunnel.c ip6tunnel.c tunnel.c ipneigh.c ipntable.c
iplink.c \
    ipmaddr.c ipmonitor.c ipmroute.c ipprefix.c \
    ipxfrm.c xfrm_state.c xfrm_policy.c xfrm_monitor.c \
    iplink_vlan.c link_veth.c link_gre.c iplink_can.c

LOCAL_MODULE := ip

LOCAL_MODULE_TAGS := optional

LOCAL_SYSTEM_SHARED_LIBRARIES := \
        libc libm libdl

LOCAL_SHARED_LIBRARIES += libiprouteutil libnetlink

$(warning Value of KERNEL_HEADERS is '$(KERNEL_HEADERS)')
LOCAL_C_INCLUDES := $(KERNEL_HEADERS) external/iproute2/include

LOCAL_CFLAGS := -O2 -g -W -Wall

include $(BUILD_EXECUTABLE)

  • Did you create the Android.mk for the native code inside a jni folder? For native code the build system expects the Android.mk to be in a jni folder inside the app project folder, and will also look for and Android.mk file in the top project folder. Also, if you are just interested in building the native code and not creating an app around it, then it may be easier if you used NDK as a standalone compiler as explained in the "Standalone compiler" section of <your NDK root dir>/documentation.html

  • Hello Alejandro

    I want to add the iproute2 tool to the linux environment to configure the CAN interface of my am3517evm Board. As far as I understand I need this to set up CAN access. Isn't this a part of the linux and I have to include there? If iproute2 where working I would call the: "ip link set can0 type can bitrate 125000 triple-sampling on" in NDK in the jni folder. But I'm struggling with the installation of the iproute2 tool. How is it possible to add the iproute2 tool in NDK? The iproute2 is in my Folder "rowboat-android/TI_Android_GingerBread_2_3_4Sources/external/iproute2" which is not reachable for the NDK?

  • Looks like i did not understand you correctly the first time, from what you are telling me in your reply you are trying to compile the tool as part of your default file system which is fine. In that case you will not be using NDK to compile which is a separate package distributed by google to compile native code in Android applications. Can you post the trace with the errors you are getting?

  • I have the same issue.I added Android.mk to external/iproute2/ip, so that it corrsponds to the external/iproute2/ip/Makefile. I also added ip to core/user_tags.mk.

    Here is my trace:

    target thumb C: ip <= external/iproute2/ip/ipaddress.c
    target thumb C: ip <= external/iproute2/ip/iproute.c
    target thumb C: ip <= external/iproute2/ip/ipneigh.c
    target thumb C: ip <= external/iproute2/ip/ipntable.c
    external/iproute2/ip/iproute.c:25:28: error: linux/in_route.h: No such file or directory
    external/iproute2/ip/ipaddress.c: In function 'print_link_flags':
    external/iproute2/ip/ipaddress.c:110: error: 'IFF_ECHO' undeclared (first use in this function)
    external/iproute2/ip/ipaddress.c:110: error: (Each undeclared identifier is reported only once
    external/iproute2/ip/ipaddress.c:110: error: for each function it appears in.)
    external/iproute2/ip/iproute.c: In function 'print_route':external/iproute2/ip/ipneigh.c: In function 'print_neigh':
    external/iproute2/ip/ipneigh.c:236: warning: comparison between signed and unsigned integer expressions

    external/iproute2/ip/iproute.c:186: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/ipaddress.c: In function 'print_linkinfo':
    external/iproute2/ip/ipaddress.c:189: warning: unused parameter 'who'
    external/iproute2/ip/ipneigh.c:184: warning: unused parameter 'who'
    external/iproute2/ip/ipaddress.c: In function 'print_addrinfo':
    external/iproute2/ip/ipaddress.c:387: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/iproute.c:286: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/ipaddress.c:419: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/iproute.c:390: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/ipntable.c: In function 'print_ntable':
    external/iproute2/ip/ipntable.c:391: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/ipaddress.c:358: warning: unused parameter 'who'
    external/iproute2/ip/iproute.c:412: error: 'RTCF_LOCAL' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:412: error: (Each undeclared identifier is reported only once
    external/iproute2/ip/iproute.c:412: error: for each function it appears in.)
    external/iproute2/ip/iproute.c:413: error: 'RTCF_REJECT' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:414: error: 'RTCF_MULTICAST' undeclared (first use in this function)external/iproute2/ip/ipaddress.c: In function 'print_selected_addrinfo':
    external/iproute2/ip/ipaddress.c:582: warning: comparison between signed and unsigned integer expressions

    external/iproute2/ip/iproute.c:415: error: 'RTCF_BROADCAST' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:416: error: 'RTCF_DNAT' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:417: error: 'RTCF_SNAT' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:418: error: 'RTCF_MASQ' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:419: error: 'RTCF_DIRECTDST' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:420: error: 'RTCF_DIRECTSRC' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:421: error: 'RTCF_REDIRECTED' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:422: error: 'RTCF_DOREDIRECT' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:423: error: 'RTCF_FAST' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:424: error: 'RTCF_NOTIFY' undeclared (first use in this function)
    external/iproute2/ip/iproute.c:425: error: 'RTCF_TPROXY' undeclared (first use in this function)
    external/iproute2/ip/ipaddress.c: In function 'ipaddr_list_or_flush':
    external/iproute2/ip/ipaddress.c:805: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/ipntable.c:352: warning: unused parameter 'who'
    external/iproute2/ip/iproute.c:498: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/iproute.c:524: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/iproute.c:543: warning: comparison between signed and unsigned integer expressions
    external/iproute2/ip/iproute.c:118: warning: unused parameter 'who'
    make: *** [out/target/product/am3517evm/obj/EXECUTABLES/ip_intermediates/ipaddress.o] Error 1
    make: *** Waiting for unfinished jobs....
    external/iproute2/ip/iproute.c: In function 'parse_nexthops':
    external/iproute2/ip/iproute.c:639: warning: unused parameter 'r'
    make: *** [out/target/product/am3517evm/obj/EXECUTABLES/ip_intermediates/iproute.o] Error 1
    user@user-desktop:~/Documents/projects/rowboat-android$


  • I get the same output. It seems that the header files in external/iproute2/include/linux and bionic/libc/kernel/common/linux are incompatible.

  • I looked into TI's android source code and unfortunately CAN has not been ported to TI's Android Devkit release. The CAN drivers are not included in the Android Kernel, so at this moment it is not possible to use CAN with TI's Android release in AM3517.

  • Have you already tried rowboat-ics.xml? ip tool is now officially supported. I haven't tried it yet (cloning the repo at the moment), but we still can have issues with compiling can-utils, because of missing can.h (https://groups.google.com/d/topic/android-ndk/K1w5IqGSKCA/discussion)

    Yegor

  • I've got ICS compiled, but have plenty of issues for now. As to ip, though ip/iplink_can.c will be compiled it lacks can related symbols, so that you get error message from ip saying bitrate parameter is not a permitted one. Trying to understand what's going wrong. Any help appreciated.

    Yegor

  • iproute2 in ICS is working now. See this patch

    Feel free to review it on gerrit.