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.

CCS/OMAP-L138: OMAP-L138 Linux SDK Issues on Linux 18.04 LTS

Part Number: OMAP-L138


Tool/software: Code Composer Studio

Hi,

I've been trying to cross compile a simple hello world example in CCS v10 for execution on the OMAP-L138 LCDK dev board (program shown below)

#include <stdio.h>

int main(void)
{
    printf("Hello World!\n");

    return 0;
}

I downloaded and installed the OMAP-L138 Linux SDK according to the documentation from TI, but I have compilation and linker errors I've been trying to sort out.

One of the compilation errors was that the compiler could not find the file stdio.h which was located at the top of the hello world program.

I thought I must have to reference the directory stdio.h resided in as an include path for my project.

I added the following include directory to my project "/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/usr/include" which resolved the file not being found issue (picture of it below too).

After compiling the project again I still got the linker errors (shown below the console output of the project)

Building target: HelloWorld2
Invoking: Cross GCC Linker
arm-oe-linux-gnueabi-gcc  -o "HelloWorld2"  ./HelloWorld2.o   
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find crt1.o: No such file or directory
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find crti.o: No such file or directory
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find crtbegin.o: No such file or directory
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find -lgcc
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find -lgcc_s
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find -lc
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find -lgcc
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find -lgcc_s
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find crtend.o: No such file or directory
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
makefile:35: recipe for target 'HelloWorld2' failed
make: *** [HelloWorld2] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

I started looking around for the files and their locations and decided to add the below directories to the linker include paths (picture of project configuration shown below):

/home/ben/ti/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/lib
/home/ben/ti/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/usr/lib/arm-oe-linux-gnueabi/8.2.0

This solved some of the issues, but not all the linker file errors.

The new output the project output now was for 3 files it could not find (see below output)

Building target: HelloWorld2
Invoking: Cross GCC Linker
arm-oe-linux-gnueabi-gcc -L/home/ben/ti/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/lib -L/home/ben/ti/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/usr/lib/arm-oe-linux-gnueabi/8.2.0 -o "HelloWorld2"  ./HelloWorld2.o   
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find crt1.o: No such file or directory
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find crti.o: No such file or directory
/home/ben/ti/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/8.2.0/real-ld: cannot find crtbegin.o: No such file or directory
collect2: error: ld returned 1 exit status
makefile:35: recipe for target 'HelloWorld2' failed
make: *** [HelloWorld2] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

Those files are present in the directories I added for the linker include section, but the linker does not see them for some reason.

After some research I found the below post on the TI forms:

https://e2e.ti.com/support/processors/f/791/t/669575?tisearch=e2e-sitesearch&keymatch=%2525252525252522cannot%2525252525252520find%2525252525252520crti.o%2525252525252522

This person had very similar problems to what I was experiencing.  In an effort to see if I too had broken links I ran the cmd line search they did (for my CPU and environment path wise):

find /home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux -type l | xargs file | grep "broken\ symbolic\ link"

This generated output which stated some broken links:

/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/var/lib/opkg/lists/oe-x86_64-nativesdk:                                              broken symbolic link to /oe/bld/build-ARM9_1/arago-tmp-glibc/work/armv5e-oe-linux-gnueabi/meta-toolchain-arago-tisdk-server/1.0-r5.0/oe-sdk-repo/x86_64-nativesdk/Packages
/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/var/lib/opkg/lists/oe-all:                                                           broken symbolic link to /oe/bld/build-ARM9_1/arago-tmp-glibc/work/armv5e-oe-linux-gnueabi/meta-toolchain-arago-tisdk-server/1.0-r5.0/oe-sdk-repo/all/Packages
/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/var/lib/opkg/lists/oe-buildtools-dummy-nativesdk:                                    broken symbolic link to /oe/bld/build-ARM9_1/arago-tmp-glibc/work/armv5e-oe-linux-gnueabi/meta-toolchain-arago-tisdk-server/1.0-r5.0/oe-sdk-repo/buildtools-dummy-nativesdk/Packages
/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/var/lib/opkg/lists/oe:                                                               broken symbolic link to /oe/bld/build-ARM9_1/arago-tmp-glibc/work/armv5e-oe-linux-gnueabi/meta-toolchain-arago-tisdk-server/1.0-r5.0/oe-sdk-repo/Packages
/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-oe-linux-gnueabi/include:                                                    broken symbolic link to /home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/include
/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/usr/lib/ssl-1.1/private:                                                             broken symbolic link to ../../../etc/ssl/private

The only broken link (fifth one in above list) that I could make potential sense of was the link:

/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-oe-linux-gnueabi/include

That path does not exist on my computer and I thought it was trying to point to the include files folder, perhaps the folder where stdio.h resided...?

I ran the below commands to resolve the link the way I thought it was intended to be (this was only from what I learned reading in the prior mentioned link for the TI forms issue):

rm /home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-oe-linux-gnueabi/include

ln -s /home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-oe-linux-gnueabi/include /home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/usr/include

I then went back to my hello world project in CCS and removed the include file directory I first mentioned (/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/usr/include)

After cleaning and compiling the project the error stating that the compiler couldn't find the file stdio.h did not return.

I'm assuming that the link I corrected is what fixed the stdio.h not being found issue.

The following questions now come to mind.

1. Could there be an issue with the installation file for the OMAP-L138 Linux SDK, or the way that I am installing it where some links don't resolve properly?

2. Is there any documentation from TI on what the intended destination folder/functions the links have? (in an effort to resolve them post installation)

3. Could the remaining broken links found cause the linker errors I'm seeing?

Thanks,

Ben

  • Hi, Ben,

    We don't use CCS for Linux application development, nor do we use it  for kernel development, so I don't have answer off the top of my head on what may cause the issue. I'll try to set this up and see if I can get through it. It will take a while before I get things set up and try to reproduce it.

    Rex

  • Thanks Rex,

    Ben

  • Hi, Ben,

    I will need to consult internally with this issue. It will take more time than I expected. I'll update you later once I make any progress.

    Rex

  • Thanks Rex,

    I'm continuing to work with this too on my end.  If there is any additional information you think might be of some use to you please let me know and I will try to get it to you.

    Ben

  • Hi, Ben,

    Just FYI. I converted the CCS build to linux commands which you can copy off the CCS build windows. I am able to compile but it failed linking. I am seeking internal help to see if this is set up issue or something else. I'll keep you updated when I make further progress. I am juggling between tasks, so my response may be slow.

    Rex

  • Hi Rex,

    Yes that is the same situation I am encountering.

    Compilation is successful, but linking is unsuccessful.

    Ben

  • Hi, Ben,

    Actually, the mem_util is the best example that you should refer to.  It is a user space application and top level build works, that means it can cross compile the user space application. You should look at the Makefiles on how it is set up. What matters is the $(CC) and $(CFLAGS). The $(CC) has extra --sysroot= defined, and CFLAGS has -march=, -marm, -mtune= defined which are missing in CCS. You should define them in CCS.

    When compiling HellowWorld.c, CCS compilation window will do 2 steps, compilation and linking, as below:

    arm-oe-linux-gnueabi-gcc -I/home/xxx/work/ti-processor-sdk-linux-omapl138-lcdk-06.00.00.07/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/usr/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"HelloWorld.d" -MT"HelloWorld.o" -o "HelloWorld.o" "HelloWorld.c"
    
    arm-oe-linux-gnueabi-gcc -o "HelloWorld"  HelloWorld.o
    

    I copy them to linux machine and using one step building without "-c" option with the following command:

    arm-oe-linux-gnueabi-gcc --sysroot=/home/xxx/work/ti-processor-sdk-linux-omapl138-lcdk-06.00.00.07/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/ -march=armv5te -marm -mtune=arm926ej-s -lc -L/home/xxx/work/ti-processor-sdk-linux-omapl138-lcdk-06.00.00.07/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/lib -o "HelloWorld"  HelloWorld.c
    

    The build is successful and I copied the binary to omap-l138. Below is the output from the build:

    root@omapl138-lcdk:~# chmod +x HelloWorld
    root@omapl138-lcdk:~# ./HelloWorld
    !!!Hello World!!!root@omapl138-lcdk:~# 

    Please note that the -L path in my command may not be needed. I had it for earlier test when I thought I need to provide the library path, but it doesn't have it in mem_util example. I didn't bother to remove it, but you can give it a try without ithe library path.

    Rex

  • Thanks Rex!

    I will test this out and let you know the outcome.

    Ben

  • Hi Rex,

    That solved my issue.  I just had to add the below to my linker options and it linked no problem:

    --sysroot=/home/ben/ti-processor-sdk-linux-omapl138-lcdk-06.00.00.07/linux-devkit/sysroots/armv5e-oe-linux-gnueabi/

    I then took the executable image and ran it on the SD card from the root file system and it ran with no issue.

    I'm wondering if something in the setup script didn't execute properly when installing the SDK?

    If that is the case though, perhaps other areas were not configured properly too.

    Either way, this is a good thing for now!

    Thanks,

    Ben

  • Hi, Ben,

    Glad to hear it solves your issue. No, it is not related to setup script. Set up script doesn't configure how you cross-compile. Those params are in the makefile per your ARM architecture, and both kernel and mem_util example have them right in the makefile. For more info on cross-compiling, you should use "<cross-compile>-gcc --help" to see what options are available, and also need to know the ARM architecture of OMAP-L138 via ARM TRM for armv5te (I think that is what omap-l138 is based on). The cross-compiler and ARM is not under TI support scope. 

    Rex