注意事項
あくまで個人的にbuildしてみた結果の備忘録になります。
動作確認等は一切しておりません。
メモ (追記)
2024/11/24
下記にメモ的な補助ページを作りました。こちらの記事と合わせて、1.0.1のコミットでビルド再現を本日確認済みです。(今年中にもう少し簡素にまとめたい。。)
環境
-
qt
= 6.7.3 -
qt creater
= 14.0.2 -
fritzing-app
= HEAD detached at 008c87a5 -
fritzing-parts
= branch 1.0.1 - python = 3.8.19
メモ (追記)
2024/11/24現在、以下4つ最新バージョンではビルドを再現できず。
最後に確認ができていたバージョンへ固定し、再現性を確保したい
-
qt
= 6.6.1 -
qt creater
= 12.0.2 -
fritzing-app
= 1.0.1
(CommitID: 8f5f1373835050ce014299c78d91c24beea9b633) -
fritzing-parts
= 1.0.1
(CommitID: 015626e6cafb1fc7831c2e536d97ca2275a83d32)
全て最新バージョンで試すと以下のエラーが発生する
エラー: Use at most Qt version 6.5.10
エラー: static libgit2 library not found in /Users/USERNAME/work-fritzing/libgit2-1.7.1/lib
-
Qt関係のダウンロード先
-
fritzing-app
- Commit fritzing-app+Bump
qtバージョンはコード内で制限されているだけなので、変更で対応可能
環境前提
PC
Apple M1 Pro
macOS 13.6.3(ventura)
ソフト
Xcode 14.3
Command_Line_Tools_for_Xcode 14.3
qt6
qt creater v12.0
念の為コミットIDをメモ
手順
ややこしい作業が多いので 準備作業
とfritzingのBuild作業
の2つでそれぞれ備忘録
■ 準備作業
- user直下に作業ディレクトリを作成(/work-fritzing)
- gitから fritzing-appとfritzing-partsをクローン
- 同じ作業ディレクトリ以下にビルドに必要なライブラリを配置
- boost
- libgit2
- svgpp
- quazip
- ngspice
■ fritzingのBuild作業
- BuildToolをインストール
- qt6
- qt Creater
- fritzing-appのBuild実施&実行確認
- fritzing-appへfritzing-paetsの組み込み
- ビルドしたfritzing-appの動作確認
■ 準備作業
参考:
- user直下に作業ディレクトリを作成(/work-fritzing)
- BuildToolをインストール
- qt6
- qt Creater
- gitから fritzing-appとfritzing-partsをクローン
- 同じ作業ディレクトリ以下にビルドに必要なライブラリを配置
- boost v1.81.0
- libgit2 v0.28.5
- Build作業
- svgpp
- quazip
- ngspice v40
# - user直下に作業ディレクトリを作成(/work-fritzing)
mkdir ~/work-fritzing
cd ~/work-fritzing
# - BuildToolをインストール
brew install qt
# - gitから fritzing-appとfritzing-partsをクローン
git clone --branch 'develop' --single-branch https://github.com/fritzing/fritzing-app.git
git clone --branch '1.0.2' --single-branch https://github.com/fritzing/fritzing-parts.git
ライブラリ準備
ダウンロード
# - 同じ作業ディレクトリ以下にビルドに必要なライブラリを配置
## - boost v1.81.0 バージョン指定あり ビルド不要
curl -o boost_1_81_0.zip https://archives.boost.io/release/1.81.0/source/boost_1_81_0.zip
## - libgit2 v0.28.5 バージョン指定あり ★ビルド必要
wget -O libgit2-0.28.5.tar.gz https://github.com/libgit2/libgit2/releases/download/v0.28.5/libgit2-0.28.5.tar.gz
## - svgpp バージョン指定なし ビルド不要
wget -O svgpp-1.3.0.zip https://github.com/svgpp/svgpp/archive/refs/tags/v1.3.0.zip
## - quazip
# wget -O quazip-v1.4.zip https://github.com/stachenov/quazip/archive/refs/tags/v1.4.zip
# TODO:自前でのビルド手順が揃うまでの暫定対応
brew install quazip
## - ngspice v40 バージョン指定あり ビルド不要
wget -O ngspice-40.tar.gz https://sourceforge.net/projects/ngspice/files/ng-spice-rework/old-releases/40/ngspice-40.tar.gz/download
ライブラリの解凍
この時点でのフォルダ一覧と配置ディレクトリは以下
libgit2-0.28.5
→libgit2
へフォルダの名前変更しないとビルドできないので注意
├── boost_1_81_0
├── boost_1_81_0.zip
├── fritzing-app
├── fritzing-parts
├── libgit2
├── libgit2-0.28.5.tar.gz
├── ngspice-40
├── ngspice-40.tar.gz
├── svgpp-1.3.0
└── svgpp-1.3.0.zip
ライブラリのBuild(必要な物のみ)
# ライブラリのビルド作業
## libgit2-0.28.5のビルド
cd libgit2
mkdir build
cd build
# wikiに従い -DBUILD_SHARED_LIBS=OFF オプションを追加
cmake -DBUILD_SHARED_LIBS=OFF ..
cmake --build .
ライブラリに伴うfritzing-app
コードの修正作業
quazip使用に伴う修正
fritzing-app/pri/quazipdetect.pri
8行目に記載あるquazipパスをbrewのquazipインストールパスに修正します。
brew --prefix quazip
message("Using fritzing quazip detect script.")
SOURCES += \
src/zlibdummy.c \
- exists($$absolute_path($$PWD/../../quazip_qt$$QT_MAJOR_VERSION)) {
- QUAZIPPATH = $$absolute_path($$PWD/../../quazip_qt$$QT_MAJOR_VERSION)
+ exists($$absolute_path(/opt/homebrew/Cellar/quazip/1.4)) {
+ QUAZIPPATH = $$absolute_path(/opt/homebrew/Cellar/quazip/1.4)
message("found quazip in $${QUAZIPPATH}")
} else {
error("quazip could not be found.")
}
ngspice-40使用に伴う修正
includeパスが変化しているので以下のファイルを修正します。
fritzing-app/pri/spicedetect.pri
message("Using fritzing ngspice detect script.")
NGSPICEPATH = ../../ngspice-40
NGSPICEPATH = $$absolute_path($${NGSPICEPATH})
exists($$NGSPICEPATH) {
message("using $${NGSPICEPATH}")
- INCLUDEPATH += $$NGSPICEPATH/include
+ INCLUDEPATH += $$NGSPICEPATH/src/include
} else {
error("ngspice not found in $${NGSPICEPATH}")
}
qt6でのビルドに伴いmodelbase.cpp
の修正
このままではビルドできないので以下のファイルの857行目を修正します。
fritzing-app/src/model/modelbase.cpp
参考
ModelPart * ModelBase::createOldSchematicPartAux(ModelPart * modelPart, const QString & oldModuleIDRef, const QString & oldSchematicFileName, const QString & oldSvgPath)
{
if (!QFile::exists(oldSvgPath)) return nullptr;
// create oldModelPart, set up the new image file name, add it to refmodel
QFile newFzp(modelPart->path());
if (!newFzp.open(QIODevice::ReadOnly)) {
DebugDialog::debug(QString("Unable to open :%1").arg(modelPart->path()));
}
QDomDocument oldDoc;
- bool ok = oldDoc.setContent(&newFzp);
+ bool ok = oldDoc.setContent(&newFzp, nullptr);
if (!ok) {
// this shouldn't happen
return nullptr;
}
■ fritzingのBuild作業
参考:
https://github.com/fritzing/fritzing-app/wiki/1.-Building-Fritzing#run
https://formulae.brew.sh/formula/qt
https://formulae.brew.sh/cask/qt-creator
- BuildToolをインストール
- qt6
- qt Creater
- qt createrを使ったfritzing-appのbuild作業
- qt createrを使ったfritzing-appの動作確認
- fritzing-appへfritzing-paetsの組み込み
- fritzing-paetsを組み込んだfritzing-appの動作確認
BuildToolをインストール
## - qt6 & qt Creater
brew install qt qt-creator
qt createrを使ったfritzing-appのbuild作業
ビルド設定をDebug
→Release
に変更し左下のビルドマークをクリック
🟥赤文字のエラーなくbuildが成功したらrelease64
以下にFrizing.app
が出来上がっているか確認
追記(2024/11/24)
ここで以下のエラーが発生する
エラー: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [../debug64/Fritzing.app/Contents/MacOS/Fritzing] Error 1
make: *** [debug] Error 2
エラーログには以下の出力
_libssh2_userauth_publickey_fromfile_ex, referenced from:
__git_ssh_authenticate_session in libgit2.a[133](ssh.c.o)
_libssh2_userauth_publickey_frommemory, referenced from:
__git_ssh_authenticate_session in libgit2.a[133](ssh.c.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [../release64/Fritzing.app/Contents/MacOS/Fritzing] Error 1
make: *** [release] Error 2
17:19:26: プロセス "/usr/bin/make" はコード 2 で終了しました。
プロジェクト phoenix のビルド・デプロイ中にエラーが発生しました (キット デスクトップ (arm-darwin-generic-mach_o-64bit))
ステップ "Make" 実行中
17:19:26: 経過時間: 01:14.
エラー概要
このエラーメッセージは、libgit2
がlibssh2
に依存しているが、libssh2
がリンカによって見つからない、またはリンクされていないというエラーらしい
暫定対応
libssh2
のインストール確認とライブラリパスを確認
❯ brew search libssh2 ~/work-fritzing-1.0.1 via 10GiB/16GiB | 903MiB/2GiB
==> Formulae
libssh2 ✔ libssh ✔
❯ brew info libssh2 ~/work-fritzing-1.0.1 via 11GiB/16GiB | 903MiB/2GiB
==> libssh2: stable 1.11.1 (bottled), HEAD
C library implementing the SSH2 protocol
https://libssh2.org/
Installed
/opt/homebrew/Cellar/libssh2/1.11.1 (201 files, 1.2MB) *
Poured from bottle using the formulae.brew.sh API on 2024-11-24 at 12:57:35
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/lib/libssh2.rb
License: BSD-3-Clause
==> Dependencies
Required: openssl@3 ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 81,981 (30 days), 185,899 (90 days), 546,465 (365 days)
install-on-request: 12,302 (30 days), 19,484 (90 days), 55,642 (365 days)
build-error: 46 (30 days)
❯ ~/work-fritzing-1.0.1 via 11GiB/16GiB | 903MiB/2GiB
phoenix.pro
ファイルにlibssh2
用のライブラリパスとリンクオプションを追加
# libssh2のインストールパスを追加
INCLUDEPATH += /opt/homebrew/Cellar/libssh2/1.11.1/include
LIBS += -L/opt/homebrew/Cellar/libssh2/1.11.1/lib -lssh2
qt createrを使ったfritzing-appの動作確認
参考
コマンドライン引数にパーツ設定を行い実行(Run)します。
自分の環境では初回実行時はクラッシュしてアプリが落ちます。
fritzing-parts/parts.db
が作成できていることを確認し2回目の実行をすると起動できると思います。
初回実行(Run)時はdb作成が必要
-f "/path/to/fritzing-app/" -parts "/path/to/fritzing-parts/" -db "/path/to/fritzing-parts/parts.db"
2回目(Run)からはdb作成不要
-f "/path/to/fritzing-app/" -parts "/path/to/fritzing-parts/"
実行が成功するとfritzing-appが自動で起動します。
fritzing-appへfritzing-paetsの組み込み
成功したビルドフォルダrelease64
からFritzing.app
を見つけパッケージ内容を表示
から内部へ移動する。
内部に移動したらfritzing.app/Contents/MacOS
をターミナルで開き、パーツデータのチェックアウトとパーツデータベースを作成
"referenceModel::loadAll completed"
が表示されれば完了
# 1.0.2 ブランチをチェックアウト
git clone --branch '1.0.2' --single-branch https://github.com/fritzing/fritzing-parts.git
# パーツデータベースの作成
./Fritzing -db "fritzing-parts/parts.db"
fritzing-paetsを組み込んだfritzing-appの動作確認
これまでの作業でパーツデータ入りのFritzing.app
が作成できたのでこのFritzing.app
だけをアプリケーションフォルダーへ移動させる。
ファイル名をFritzing.app
からFritzing_1.0.1.app
に変更しておくと管理に便利かも。
後はLaunchpad
から起動すれば完了です。
おまけ
この手順でビルドするとappleシリコン用のアプリがビルドされるようです。
動作確認は特にしていないので、参考程度に考えて下さい。
遭遇した問題
.../boost_1_xx_0
と言うエラー
エラー内容
"Boost 1.54 has a bug in a function that Fritzing uses, so download or install some other version"
"Easiest to copy the Boost library to ..., so that you have .../boost_1_xx_0")
解決策
以下のコミット内容から boostのバージョンが固定化されていることが分かりました。
boost_1_81_0
が必要です。
fatal error: 'ngspice/sharedspice.h' file not found
と言うエラー
エラー内容
/Users/user/work-fritzing/fritzing-app/src/simulation/ngspice_simulator.h:24: エラー: 'ngspice/sharedspice.h' file not found
In file included from /Users/user/work-fritzing/fritzing-app/src/commands.cpp:21:
In file included from /Users/user/work-fritzing/fritzing-app/src/commands.h:33:
In file included from /Users/user/work-fritzing/fritzing-app/src/mainwindow/mainwindow.h:51:
In file included from /Users/user/work-fritzing/fritzing-app/src/mainwindow/../simulation/simulator.h:26:
/Users/user/work-fritzing/fritzing-app/src/mainwindow/../simulation/../simulation/ngspice_simulator.h:24:10: fatal error: 'ngspice/sharedspice.h' file not found
#include <ngspice/sharedspice.h>
^~~~~~~~~~~~~~~~~~~~~~~
解決策
includeパスが変化しているので以下のファイルを修正します。
fritzing-app/pri/spicedetect.pri
message("Using fritzing ngspice detect script.")
NGSPICEPATH = ../../ngspice-40
NGSPICEPATH = $$absolute_path($${NGSPICEPATH})
exists($$NGSPICEPATH) {
message("using $${NGSPICEPATH}")
- INCLUDEPATH += $$NGSPICEPATH/include
+ INCLUDEPATH += $$NGSPICEPATH/src/include
} else {
error("ngspice not found in $${NGSPICEPATH}")
}
no viable conversion from 'ParseResult' to 'bool'
と言うエラー
エラー内容
/Users/user/work-fritzing/fritzing-app/src/model/modelbase.cpp:857: エラー: no viable conversion from 'ParseResult' to 'bool'
/Users/user/work-fritzing/fritzing-app/src/model/modelbase.cpp:857:7: error: no viable conversion from 'ParseResult' to 'bool'
bool ok = oldDoc.setContent(&newFzp);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/lib/QtXml.framework/Headers/qdom.h:281:18: note: explicit conversion function is not a candidate
explicit operator bool() const noexcept { return errorMessage.isEmpty(); }
^
^~~~~~~~~~~~~~~~~
解決策
このままではビルドできないので以下のファイルの857行目を修正します。
fritzing-app/src/model/modelbase.cpp
参考
ModelPart * ModelBase::createOldSchematicPartAux(ModelPart * modelPart, const QString & oldModuleIDRef, const QString & oldSchematicFileName, const QString & oldSvgPath)
{
if (!QFile::exists(oldSvgPath)) return nullptr;
// create oldModelPart, set up the new image file name, add it to refmodel
QFile newFzp(modelPart->path());
if (!newFzp.open(QIODevice::ReadOnly)) {
DebugDialog::debug(QString("Unable to open :%1").arg(modelPart->path()));
}
QDomDocument oldDoc;
- bool ok = oldDoc.setContent(&newFzp);
+ bool ok = oldDoc.setContent(&newFzp, nullptr);
if (!ok) {
// this shouldn't happen
return nullptr;
}
aa
エラー内容