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.

AM4378: linux-devkit compile code failed for ti-processor-sdk (Documents need to be updated)

Part Number: AM4378

Hello Ti Teams:

My system is ubuntu 22.04 LTS Server.

I have followed the guide here
https://software-dl.ti.com/processor-sdk-linux/esd/AM437X/09_01_00_001/exports/docs/linux/Overview/GCC_ToolChain.html

There are many out-dated information in the guide:

1. Toolchain Prefix is completely changed

2. The helloworld.c can't pass compilation

```

arm-oe-linux-gnueabi/arm-oe-linux-gnueabi-gcc helloworld.c -o helloworld
In file included from /home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/gnu/stubs.h:23,
from /home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/features.h:514,
from /home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/bits/libc-header-start.h:33,
from /home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/stdio.h:27,
from helloworld.c:1:
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/gnu/stubs-32.h:7:11: fatal error: gnu/stubs-soft.h: No such file or directory
7 | # include <gnu/stubs-soft.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.

```

3. After applying hard float, the helloworld.c still can't pass compilation since the toolchain dependency problems 

```

arm-oe-linux-gnueabi-gcc helloworld.c -o helloworld -mfpu=neon -mfloat-abi=hard
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find crt1.o: No such file or directory
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find crti.o: No such file or directory
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find crtbegin.o: No such file or directory
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find -lgcc: No such file or directory
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find -lgcc_s: No such file or directory
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find -lc: No such file or directory
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find -lgcc: No such file or directory
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find -lgcc_s: No such file or directory
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find crtend.o: No such file or directory
/home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/x86_64-arago-linux/usr/libexec/arm-oe-linux-gnueabi/gcc/arm-oe-linux-gnueabi/11.4.0/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

```

4. Some link related to am437x are invalid such as:

then I have found the similar issue related to my exactly problem from this post:

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1306470/am3358-linux-devkit-compile-code-failed-for-ti-processor-sdk-linux-am335x-evm-09-01-00-001

Although I have found the solution from the above link, but for the record, this is the correct way of compiling helloworld.c. 

```

source ../linux-devkit/environment-setup

$CC helloworld.c -o helloworld -mfpu=neon -mfloat-abi=hard

```

Best Regards

Ben

  • Although I have found the solution from the above link, but for the record, this is the correct way of compiling helloworld.c. 

    ```

    source ../linux-devkit/environment-setup

    $CC helloworld.c -o helloworld -mfpu=neon -mfloat-abi=hard

    Yes sourcing the environment and using $CC is the recommended way of cross-compiling. However you should be able to use this approach without having to add -mfpu and -mfloat-abi compiler options.

    Have you tried it this way?

    Also let me make sure the feedback you have is being provided to the internal documentation team, thanks for your time compiling that.

    Regards, Andreas

  • Hi Andreas,

    Thank you for the information, and quick response.

    Unfortunately, with only $CC it produced the gnu/stubs-soft.h missing error.

    ```

    > $CC helloworld.c -o helloworld
    In file included from /home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/gnu/stubs.h:23,
    from /home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/features.h:514,
    from /home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/bits/libc-header-start.h:33,
    from /home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/stdio.h:27,
    from helloworld.c:1:
    /home/ben/ti-processor-sdk-linux-am437x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi/usr/include/gnu/stubs-32.h:7:11: fatal error: gnu/stubs-soft.h: No such file or directory
    7 | # include <gnu/stubs-soft.h>
    | ^~~~~~~~~~~~~~~~~~
    compilation terminated.

    ```

    Regards,

    Ben

  • Hi Ben,

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1306470/am3358-linux-devkit-compile-code-failed-for-ti-processor-sdk-linux-am335x-evm-09-01-00-001

    Although I have found the solution from the above link, but for the record, this is the correct way of compiling helloworld.c. 

    Yes this link has some good suggestion. actually probably the cleanest/best way can be derived from a combination of the suggestions given, which is using $CC in concert with $CFLAGS, as follows:

    a0797059@ula0797059:~/ti/ti-processor-sdk-linux-am335x-evm-09.01.00.001/linux-devkit
    $ source environment-setup
    [linux-devkit]:~/ti/ti-processor-sdk-linux-am335x-evm-09.01.00.001/linux-devkit> echo $CC
    arm-oe-linux-gnueabi-gcc --sysroot=/home/a0797059/ti/ti-processor-sdk-linux-am335x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi
    [linux-devkit]:~/ti/ti-processor-sdk-linux-am335x-evm-09.01.00.001/linux-devkit> echo $CFLAGS
    -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/home/a0797059/ti/ti-processor-sdk-linux-am335x-evm-09.01.00.001/linux-devkit/sysroots/armv7at2hf-neon-oe-linux-gnueabi
    [linux-devkit]:~/ti/ti-processor-sdk-linux-am335x-evm-09.01.00.001/linux-devkit> $CC $CFLAGS hello_world.c -o hello_world
    [linux-devkit]:~/ti/ti-processor-sdk-linux-am335x-evm-09.01.00.001/linux-devkit> file hello_world
    hello_world: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=6c861fdcc13bfb38b4f3ce0b7274b9ce0cd5db1e, for GNU/Linux 3.2.0, with debug_info, not stripped
    [linux-devkit]:~/ti/ti-processor-sdk-linux-am335x-evm-09.01.00.001/linux-devkit> 

    Will send a note to the documentation team to have this part of the next SDK release/update (ref: SITSW-4302)

    Regards. Andreas