Unable to build when a parent folder contains a space (linker error)
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
- Ambito
- build-system, embedded-iot
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
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di InfiniTimeOrg/InfiniTime
-
BLE handlers use length fields from the packet without checking how much data arrivedForse già presa @DustinHab l’ha presa 38 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
InfiniTimeOrg/InfiniTime#2485 ·
-
Unexpected jump back to watch face when button pressedForse già presa @SteveAmor l’ha presa 81 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
InfiniTimeOrg/InfiniTime#2461 · 2 commenti ·
-
Screen doesn't go to sleep after reset countdown appForse già presa @SteveAmor l’ha presa 79 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
InfiniTimeOrg/InfiniTime#2419 · 4 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
InfiniTimeOrg/InfiniTime#2410 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
InfiniTimeOrg/InfiniTime#2407 · 4 commenti ·
Tutte le issue di InfiniTimeOrg/InfiniTime
Issue simili
-
Mark ignored Mac OS partitions RecoveryOSContainer and iBootSystemContainerForse già presa @meven l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
storaged-project/udisks#1559 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
awslabs/aws-checksums#121 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 3 giorni
-
Bad tag for language cardAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100