Linking examples fails with empty_file.c.obj not found.

Completed manual*) install of nRF Connect SDK 2.2.0, zephyr-sdk-0.15.1. 

The project is placed in C:\dev\peripheral_nfc_pairing

The SDK in: C:\dev\ncs

Build output:

[244/255] Linking C static library zephyr\kernel\libkernel.a
[245/255] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/dev/peripheral_nfc_pairing/build/zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\Users\tnielsen\zephyr-sdk-0.15.1\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\dev\peripheral_nfc_pairing\build\zephyr && "C:\Program Files\CMake\bin\cmake.exe" -E echo ""
c:/users/tnielsen/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: cannot find zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj: No such file or directory
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

The empty_file.c really is a empty source file - apparently not generating an empty object file.

*) The tool manager would not detect SDK versions above 1.9.1, and found this as an unresolved issue on dev zone, so went with the manual install.

Parents Reply Children
  • Hi,

    That is interesting.

    Do other samples in the nRF Connect SDK also build?
    Which work and which builds and which don't?

    What is the contents of your peripheral_nfc_pairing/build folder?

    Regards,
    Sigurd Hellesvik

  • I tried building the examples inside ncs instead - result is the same:

    [246/256] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/dev/ncs/nrf/samples/bluetooth/peripheral_nfc_pairing/build/zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\Users\tnielsen\zephyr-sdk-0.15.1\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\dev\ncs\nrf\samples\bluetooth\peripheral_nfc_pairing\build\zephyr && "C:\Program Files\CMake\bin\cmake.exe" -E echo ""
    c:/users/tnielsen/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: cannot find zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj: No such file or directory

    6505.build.zip

  • I can find "empty_file.c.obj" in the build folder, so the main suspect is the windows max path length here.

    Try the following three things:

    1. build the peripheral_lbs sample
    2. Install zephyr-sdk-0.15.1 to a shorter path, for example "C:/zephyr-sdk-0.15.1
    3. Install the nRF Connect SDK to a shorter path, for example C:/ncs

    At a glance, it seems like your paths should be short enough, but it is worth to try to fix this.

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd, 

    I have moved the Zephyr SDK as you suggested, and tried to build peripheral_lbs. Same result.

    I tried to build from the command line, and it yielded the following interesting result:

    C:\dev\ncs\nrf\samples\bluetooth\peripheral_lbs>west build -b nrf52dk_nrf52832
    [1/11] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/dev/ncs/nrf/samples/bluetooth/peripheral_lbs/build/zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\zephyr-sdk-0.15.1\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\dev\ncs\nrf\samples\bluetooth\peripheral_lbs\build\zephyr && "C:\Program Files\CMake\bin\cmake.exe" -E echo ""
    c:/zephyr-sdk-0.15.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: cannot find ´╗┐zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj: No such file or directory
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    So it looks like cmake or some other build generation tool inserts garbage in the search path.

    I took the tools dtc, git and gperf from Cygwin - can that be the cause? Do you or zephyr have an official download of these support tools for windows, that you use in your test?

    Ninja was installed from a previous automated nRF Connect install.

    My support tools are:

    C:\dev\ncs\nrf\samples\bluetooth\peripheral_lbs>ninja --version
    1.10.0

    C:\dev\ncs\nrf\samples\bluetooth\peripheral_lbs>gperf --version
    GNU gperf 3.1
    Copyright (C) 1989-2017 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Written by Douglas C. Schmidt and Bruno Haible.

    C:\dev\ncs\nrf\samples\bluetooth\peripheral_lbs>dtc --version
    Version: DTC 1.6.1-g2cd89f86-dirty

    C:\dev\ncs\nrf\samples\bluetooth\peripheral_lbs>git --version
    git version 2.39.0

    C:\dev\ncs\nrf\samples\bluetooth\peripheral_lbs>cmake --version
    cmake version 3.25.1

    CMake suite maintained and supported by Kitware (kitware.com/cmake).

    rgds Tage

Related