Problem with building ardupilot (ldscript.ld)

I have a Windows 10 and I followed these instructions:
https://ardupilot.org/dev/docs/building-setup-windows-cygwin.html
https://ardupilot.org/dev/docs/building-setup-windows-eclipse.html

Configurations (like configure --board Pixhawk1) end with success but builds fail.

Build command: c:\cygwin64\bin\python2.7 waf
Build target: copter

Console output:
Waf: Entering directory '/cygdrive/c/fo/code/ardupilot/build/Pixhawk1' Embedding file sandbox.lua:libraries/AP_Scripting/scripts/sandbox.lua Build failed Embedding file io_firmware.bin:Tools/IO_Firmware/iofirmware_lowpolh.bin Traceback (most recent call last): Embedding file bootloader.bin:/cygdrive/c/fo/code/ardupilot/Tools/bootloaders/Pixhawk1_bl.bin File "/cygdrive/c/fo/code/ardupilot/modules/waf/waflib/Runner.py", line 395, in task_status Checking for env.py return tsk.runnable_status() env added BOARD_FLASH_SIZE=2048 File "Tools/ardupilotwaf/git_submodule.py", line 75, in runnable_status env added APJ_BOARD_TYPE=STM32F427xx out = self.generator.bld.cmd_and_log(cmd, quiet=Context.BOTH, cwd=self.cwd) env added PERIPH_FW=0 File "/cygdrive/c/fo/code/ardupilot/modules/waf/waflib/Context.py", line 461, in cmd_and_log env added MAIN_STACK=0x400 raise e env added APJ_BOARD_ID=9 WafError: Command ('/cygdrive/c/Program Files/Git/cmd/git', 'submodule', 'status', '--recursive', '--', '/cygdrive/c/fo/code/ardupilot/modules/ChibiOS') returned 128 env added HAL_WITH_UAVCAN=1 env added FLASH_RESERVE_START_KB=16 env added CHIBIOS_BUILD_FLAGS=USE_FATFS=yes MCU=cortex-m4 ENV_UDEFS=-DCHPRINTF_USE_FLOAT=1 CHIBIOS_PLATFORM_MK=os/hal/ports/STM32/STM32F4xx/platform.mk CHIBIOS_STARTUP_MK=os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk env appended CPU_FLAGS=['-mcpu=cortex-m4', '-mfpu=fpv4-sp-d16', '-mfloat-abi=hard', '-u_printf_float'] env added IOMCU_FW=0 env added PROCESS_STACK=0x2000 Waf: Leaving directory '/cygdrive/c/fo/code/ardupilot/build/Pixhawk1' "c:/cygwin64/bin/python2.7 waf copter" terminated with exit code 1. Build might be incomplete.

Part of the log file:
['/cygdrive/c/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-g++', '-mcpu=cortex-m4', '-mfpu=fpv4-sp-d16', '-mfloat-abi=hard', '-u_printf_float', '-fomit-frame-pointer', '-falign-functions=16', '-ffunction-sections', '-fdata-sections', '-u_port_lock', '-u_port_unlock', '-u_exit', '-u_kill', '-u_getpid', '-u_errno', '-uchThdExit', '-fno-common', '-nostartfiles', '-mno-thumb-interwork', '-mthumb', '-specs=nano.specs', '-specs=nosys.specs', '-L/cygdrive/c/fo/code/ardupilot/build/Pixhawk1', '-L/cygdrive/c/fo/code/ardupilot/modules/ChibiOS/os/common/startup/ARMCMx/compilers/GCC/ld', '-L/cygdrive/c/fo/code/ardupilot/libraries/AP_HAL_ChibiOS/hwdef/common', '-Wl,--gc-sections,--no-warn-mismatch,--library-path=/ld,--script=ldscript.ld,--defsym=__process_stack_size__=0x2000,--defsym=__main_stack_size__=0x400', 'test.cpp.1.o', '-otestprog', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-lgcc', '-lm'] err: c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: cannot open linker script file ldscript.ld: No such file or directory collect2.exe: error: ld returned 1 exit status

arm-none-eabi/bin/ld.exe: cannot open linker script file ldscript.ld: No such file or directory

ldscript.ld actually exists in C:\fo\code\ardupilot\build\Pixhawk1\ldscript.ld

hello,
the toolchain isn’t the right one that maybe the root of the failure.

Could you confirm that you didn’t manually update the toolchain ?

Are you about arm-none-eabi toolchain?
I have 6 2017-q2-update, download from direct link (https://firmware.ardupilot.org/Tools/STM32-tools/gcc-arm-none-eabi-6-2017-q2-update-win32-sha2.exe)

UPD: FIXED
I updated all Cygwin libraries to latest version and problem disappeared.

1 Like

On the log you shown, the toolchain was gcc 9 and I am not sure that we are compatible with it. But if you fixed it, that is cool !

1 Like

Hi Michael,

I have the same problem that you had before but can’t find the solution. So here what I’m using and let me know if you have something different:

  • Eclipse IDE 2020-12 (4.18.0)
    • Using “configure --board fmuv3 --no-submodule-update”
    • I have also tried other boards without success
    • Builder setting c:\cygwin64\bin\python2.7 waf
    • uncheck “Use default build command”
  • Cygwin64 version 2.905 with the latest packages listed in ardupilot/…/building-setup-windows-cygwin
  • /cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/6 2017-q2-update

When I run the build for the “configure --board fmuv3 --no-submodule-update”, I get in the Eclipse console window the “Build Finished. 0 errors, 0 warnings.”. However, the file ardupilot\build\config.log shows the “cannot open linker script file ldscript.ld”

I have noticed that the installation instruction for Cygwin with “setup-x86_64.exe -P autoconf,automake,ccache,gcc-g++,git,libtool,make,gawk,libexpat-devel,libxml2-devel,python36,python36-future,python36-lxml,python36-pip,libxslt-devel,python36-devel,procps-ng,zip,gdb,ddd” indicates the python36 while the toolchain point to c:\cygwin64\bin\python2.7 waf; is this normal?

Just to be able to compile with “clean”, I had to add the python2.7 in cygwin.

What I’m missing ?