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.

Unable to cross compile hello world example

Other Parts Discussed in Thread: OMAPL138

Hello, I have installed the latest SDK for OMAPL138 on Linux machine and am trying to cross compile hello world example as per the documentation. 

https://software-dl.ti.com/processor-sdk-linux/esd/docs/06_03_00_106/linux/Overview/GCC_ToolChain.html

but I get following error: 

fatal error: stdio.h: No such file or directory

command to build example:

/opt/ti-processor-sdk-linux-omapl138-lcdk-06-03-00-106/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc ./helloworld.c -o helloworld

Please, let me know if the path is incorrect or how to fix this. thanks 

  • Did you run the `host# source linux-devkit/environment-setup` script to activate the cross-compile environment?

    Regards, Andreas

  • Hi Andreas, tried this but doesn't seems to make any difference. 

    Host:~/Desktop/HelloWorld$ source /opt/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/environment-setup
    [linux-devkit]:~/Desktop/HelloWorld> sudo /opt/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc ./helloworld.c -o helloworld[sudo] password for miteshhiran:
    ./helloworld.c:1:10: fatal error: stdio.h: No such file or directory
    #include <stdio.h>
    ^~~~~~~~~
    compilation terminated.
    [linux-devkit]:~/Desktop/HelloWorld>

  • Hi Mitesh,

    looks like the instructions in that (old) documentation are incorrect. The purpose of sourcing the 'environment-setup' script is to setup everything needed for cross-compilation. However invoking the compiler directly (and without adding any flags to it) defeats the purpose really. Can you please try this here:

    # Note how the cross-compile compiler definition specifies a sysroot too, which is needed to find headers, libraries, etc.
    [linux-devkit]:~/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106> echo $CC
    arm-oe-linux-gnueabi-gcc --sysroot=/home/a0797059/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/armv5e-oe-linux-gnueabi
    
    # Now let's compile the simple C code...
    [linux-devkit]:~/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106> $CC ./helloworld.c -o helloworld
    
    # Basic check that we in fact managed to cross-compile something...
    [linux-devkit]:~/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106> file helloworld
    helloworld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=1ddd4be37f4606f6bded3fff68b882d666b4a393, with debug_info, not stripped
    

    Regards, Andreas