Unable to build when a parent folder contains a space (linker error)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
バグは src/CMakeLists.txt 内の set_target_properties 呼び出しの LINK_FLAGS 文字列にあり、-T${NRF5_LINKER_SCRIPT} のパスが引用符で囲まれていません。報告にあるターゲットだけでなく、同じパターンを使うすべてのターゲットを確認してください。再現するには、名前にスペースを含む親ディレクトリから、ARM ツールチェーンを使ってビルドします。引用符で囲んだパスでリンクが成功し、スペースのないディレクトリからもビルドが引き続き動作すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- C
- スター
- 3.4k
- フォーク
- 1.1k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
InfiniTimeOrg/InfiniTime のほかの issue
-
BLE handlers use length fields from the packet without checking how much data arrived対応中かも @DustinHab が 34 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
InfiniTimeOrg/InfiniTime#2485 ·
-
Unexpected jump back to watch face when button pressed対応中かも @SteveAmor が 77 日前に担当しました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 50/100
InfiniTimeOrg/InfiniTime#2461 · コメント 2 件 ·
-
Screen doesn't go to sleep after reset countdown app対応中かも @SteveAmor が 75 日前に担当しました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
InfiniTimeOrg/InfiniTime#2419 · コメント 4 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
InfiniTimeOrg/InfiniTime#2410 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
InfiniTimeOrg/InfiniTime#2407 · コメント 4 件 ·
InfiniTimeOrg/InfiniTime の issue をすべて見る
似ている issue
-
backlog bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
EchoTools/nevr-runtime#653 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
system: coco
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
FujiNetWIFI/fujinet-config#274 ·
メンテナーはふだん 1 日以内に返信
-
base-files: 82_config_generate: regenerate /etc/board.json if 0-bytes / truncated after power cutオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
openwrt/openwrt#25940 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
ElementsProject/lightning#9634 ·
メンテナーはふだん 1 日以内に返信