Skip to content

Unable to build when a parent folder contains a space (linker error) #2492

Closed

Description

@margotfrison

Verification

  • I searched for similar issues (including closed issues) and found none was relevant.

Introduce the issue

Hi !

When building the project, I came across an error :

/home/margot/Libs/arm-gnu-toolchain-15.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/15.3.1/../../../../arm-none-eabi/bin/ld: cannot open linker script file /home/margot/Documents/Creation: No such file or directory
collect2: error: ld returned 1 exit status
make[3]: *** [src/CMakeFiles/pinetime-app.dir/build.make:2057: src/pinetime-app-1.16.0.out] Error 1
make[2]: *** [CMakeFiles/Makefile2:341: src/CMakeFiles/pinetime-app.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:348: src/CMakeFiles/pinetime-app.dir/rule] Error 2
make: *** [Makefile:176: pinetime-app] Error 2

One of my parent folder is named Creation zone with a space, that is the issue.

A quick workaround is of course to rename the folder, which works fine but I wanted to fix the issue nonetheless.

The source of the issue is the unquoted -T path parameter in LINK_FLAGS (for each cmake targets) in the CMakeLists.txt file.

Obligatory newbie appreciation : thank you for this wonderful project (both hardware and software !) I can't wait to play with it ! The code base look solid ! ❤️

Preferred solution

I don't know any other fix than adding escaped quotes for the -T argument as I'm a complete stranger to make files, but my fix is as follows (the same applies for each cmake targets) :

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index faef4160..3494eddc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -930,7 +933,7 @@ target_compile_options(${EXECUTABLE_NAME} PUBLIC

 set_target_properties(${EXECUTABLE_NAME} PROPERTIES
         SUFFIX ".out"
-        LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections -Wl,--print-memory-usage --specs=nano.specs -Wl,-Map=${EXECUTABLE_FILE_NAME}.map"
+        LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T\"${NRF5_LINKER_SCRIPT}\" -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections -Wl,--print-memory-usage --specs=nano.specs -Wl,-Map=${EXECUTABLE_FILE_NAME}.map"
         )

 add_custom_command(TARGET ${EXECUTABLE_NAME}

I've tested my fix with a clean version from master both with and without a parent folder with a space. It seems to work fine.

One important note is that I had to recreate my .venv python virtual environment when changing the folder hierarchy between tests. So please keep that in mind if you want to reproduce the fix/issue.

Version

main, 887d1af

Activity

  1. linked a pull request that will close this issueAdd escaped quotes to LINK_FLAGS #2493on Oct 17, 2026
  2. mark9064 commented on Oct 17, 2026

    @mark9064
    Member

    Analysis and fix all look good, I've merged the PR now

    Thanks for the writeup and contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions