[#46]fix:Intel Mac でバックエンドが CGO 無効ビルドにより起動失敗する問題を修正#48
Merged
Conversation
mattn/go-sqlite3 は CGO 必須だが、Apple Silicon マシン上で GOOS=darwin GOARCH=amd64 go build するとクロスコンパイル扱いとなり Go が CGO_ENABLED=0 をデフォルトにしてしまっていた。結果 Intel Mac 向け バイナリは stub 状態で配布され、起動直後に "go-sqlite3 requires cgo to work" で死亡 → 「処理が予期せず終了しました」 「起動に失敗しました」が連続表示されていた。 scripts/build-backend.sh と .github/workflows/release.yml の macOS 向け ビルドで CGO_ENABLED=1 と CC/CXX のアーキ指定を明示し、クロス CGO ビルドが再現性高く成立するようにした。Windows/Linux の同様の明示は スコープを切り分けるため #47 に分離。
Owner
Author
|
@claude このプルリクエストをレビューしてください。 |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
変更の概要
Intel Mac で Backnote.app を開いた直後に「処理が予期せず終了しました」「起動に失敗しました」のアラートが連続表示され、その後ウィンドウは開くものの API へ繋がらない事象を修正する。
原因は darwin/amd64 向けバックエンドが
CGO_ENABLED=0でビルドされていたこと。Apple Silicon マシン上でGOOS=darwin GOARCH=amd64 go buildを走らせると Go がクロスコンパイル扱いで CGO を無効化するため、mattn/go-sqlite3が stub になり、起動直後にgo-sqlite3 requires cgo to workで死亡していた。関連 Issue
変更の種類
変更内容の詳細
scripts/build-backend.shの darwin/arm64・darwin/amd64 ビルドでCGO_ENABLED=1とCC/CXXのアーキ指定を明示.github/workflows/release.ymlのrelease-macジョブも同じ修正を反映 (CI はベタ書きでbuild-backend.shを呼んでいないため両方直す必要があった)動作確認
検証ログ
修正後の x64 バイナリを Apple Silicon マシン (Rosetta) 上で実行:
```
=== curl /api/health ===
HTTP/1.1 200 OK
{"status":"ok"}
=== log ===
dbwriter: started
Backnote backend starting on :18082
⇨ http server started on [::]:18082
GET /api/health status=200
```
otool -Lの libSystem current version も0.0.0(stub) →1351.0.0(CGO=1) に変化していることを確認。レビュアーへのメモ
チェックリスト