Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#2,492 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c, cmake, cpp

調査の方向性

バグは 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 はありません

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

InfiniTimeOrg/InfiniTime のほかの issue

InfiniTimeOrg/InfiniTime の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。