Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa Adatta ai principianti
#2,492 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c, cmake, cpp

Direzione di ricerca

Il bug si trova nelle stringhe LINK_FLAGS delle chiamate set_target_properties in src/CMakeLists.txt, dove il percorso -T${NRF5_LINKER_SCRIPT} non è racchiuso tra virgolette. Controlla ogni target che usa lo stesso schema, non solo quello nel report. Per riprodurlo, compila da una directory padre il cui nome contiene uno spazio, usando la toolchain ARM. È fatto quando la build esegue il link con il percorso tra virgolette e la build funziona ancora da una directory senza spazi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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, 887d1afc7322ea3e22c8f4db39e9f0f1d670095b

Lingua principale
C
Stelle
3.4k
Fork
1.1k
Merge medio
23h 18m
PR unite (30g)
1

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di InfiniTimeOrg/InfiniTime

Tutte le issue di InfiniTimeOrg/InfiniTime

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.