注意事項
あくまで個人的にbuildしてみた結果の備忘録になります。
動作確認等は一切しておりません。
環境前提
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
が出来上がっているか確認
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
エラー内容