locked
Compile/Link of HelloWorld_RTApp_MT3620_BareMetal Sample RRS feed

  • Question

  • This is probably a simple question, I am using the sample at https://github.com/Azure/azure-sphere-samples/tree/master/Samples/HelloWorld/HelloWorld_RTApp_MT3620_BareMetal.  I have copied this into a local directory and trying to compile/link it. 

    I have successfully build other CMAKE/Azure-Sphere apps so I don't think there is an install problem with the tools or SDK. The CMAKE command being using is:

    cmake \
    -G "Ninja" \
    -DCMAKE_TOOLCHAIN_FILE="/opt/azurespheresdk/CMakeFiles/AzureSphereToolchain.cmake" \
    -DARM_GNU_PATH:STRING="/usr/local/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu" \
    -DAZURE_SPHERE_TARGET_API_SET="4+Beta2001" \
    --no-warn-unused-cli \
    -DCMAKE_BUILD_TYPE="Debug" \
    -DCMAKE_MAKE_PROGRAM="ninja" \

    When I issue 'ninja' to build, it is failing:

    $ ninja

    [1/4] Linking C executable HelloWorld_RTApp_MT3620_BareMetal.out
    FAILED: HelloWorld_RTApp_MT3620_BareMetal.out 
    : && /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-musleabi/arm-poky-linux-musleabi-gcc -B "/opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-musleabi" -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot="/opt/azurespheresdk/Sysroots/4+Beta2001" -g  -nodefaultlibs -pie -Wl,--no-undefined -Wl,--gc-sections CMakeFiles/HelloWorld_RTApp_MT3620_BareMetal.dir/main.c.obj  -o HelloWorld_RTApp_MT3620_BareMetal.out   && :
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: /opt/azurespheresdk/Sysroots/4+Beta2001/usr/lib/Scrt1.o: in function `_start_c':
    /usr/src/debug/musl/1.1.20+gitAUTOINC+c50985d5c8-r0/git/crt/crt1.c:18: undefined reference to `__libc_start_main'
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: /usr/src/debug/musl/1.1.20+gitAUTOINC+c50985d5c8-r0/git/crt/crt1.c:18: undefined reference to `main'
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: /opt/azurespheresdk/Sysroots/4+Beta2001/usr/lib/Scrt1.o:(.ARM.exidx.text._start_c+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: /opt/azurespheresdk/Sysroots/4+Beta2001/usr/lib/arm-poky-linux-musleabi/8.2.0/crtbeginS.o:(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: /opt/azurespheresdk/Sysroots/4+Beta2001/usr/lib/arm-poky-linux-musleabi/8.2.0/crtbeginS.o:(.ARM.exidx+0x18): undefined reference to `__aeabi_unwind_cpp_pr1'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    Can you point out what I am doing wrong so I can get it compiled/linked correctly?

    Monday, May 4, 2020 3:51 PM

All replies

  • Additional info: the CMakeError.txt file contains:

     cat CMakeFiles/CMakeError.log 
    Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
    Compiler: /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-musleabi/arm-poky-linux-musleabi-gcc 
    Build flags: 
    Id flags:  

    The output was:
    1
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find Scrt1.o: No such file or directory
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find crti.o: No such file or directory
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find crtbeginS.o: No such file or directory
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find -lgcc
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find -lgcc_s
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find -lc
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find -lgcc
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find -lgcc_s
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find crtendS.o: No such file or directory
    /opt/azurespheresdk/Sysroots/4+Beta2001/tools/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/8.2.0/real-ld: cannot find crtn.o: No such file or directory
    collect2: error: ld returned 1 exit status

    Which would support my guess that the libaries aren't linking correctly.  However, I am not sure how to configure the CMakeList.txt file to get the linking correct.  I adding  LINK_DIRECTORIES and specifing the paths to the libaries in the SDK, e.g.:

    LINK_DIRECTORIES(
            /opt/azurespheresdk/Sysroots/4+Beta2001/lib
            /opt/azurespheresdk/Sysroots/4+Beta2001/usr/lib
            /opt/azurespheresdk/Sysroots/4+Beta2001/usr/lib/arm-poky-linux-musleabi/8.2.0
            )

    But that didn't seem to work. I also tried setting the TARGET_LINK_LIBRARIES with explicity paths, then I tried setting the CMAKE_SYSROOT to /opt/azurespheresdk/Sysroots/4+Beta2001 but none of this worked either...

    Monday, May 4, 2020 6:20 PM
  • Hello jflynn_129,

    Thank you for your feedback!

    Could you please share with us the board you are using? Please note from here: Quickstart: Build a real-time capable application with Visual Studio

     Important

    These instructions assume you are using hardware that follows the MT3620 reference board design (RDB) hardware, such as the MT3620 Dev Kit from Seeed Studios. If you are using different Azure Sphere hardware, consult the manufacturer's documentation to find out whether the UART is exposed and how to access it. You might need to set up hardware to display output differently, and update the sample code and the "Uarts" field of the app_manifest.json file to use a different UART.


    Wednesday, May 6, 2020 8:02 AM
  • Hello jflynn_129,

    Let us know if your issue is now solved and how you solved it so we can share with others as well. My current suggestion is that you try with the latest release 20.04.

    Thank you so much!

    Tuesday, May 19, 2020 9:36 PM