108 lines
4.4 KiB
Markdown
108 lines
4.4 KiB
Markdown
|
---
|
|||
|
{
|
|||
|
title: "KiCAD手动编译安装 on Aarch64/arm64 for 小米平板5 Pro with Ubuntu22.04 installed by tmoe",
|
|||
|
description: "作者分享了手动编译KiCAD的详细过程。因版本冲突问题选择从源码编译,处理了OpenGL、CURL、cairo、libgit2、boost等依赖,升级了GCC和Clang版本,并编译安装OpenCascade和wxPython。遇到wxWidgets版本检测错误时修改了CMake脚本。最后使用Ninja进行编译,总耗时较长。",
|
|||
|
draft: false,
|
|||
|
type: "article",
|
|||
|
created_at: "2024-04-10T00:00:00+08:00",
|
|||
|
published_at: "2024-04-11T17:34:00+08:00",
|
|||
|
updated_at: [ "2024-04-11T17:34:00+08:00"],
|
|||
|
category: '个人',
|
|||
|
tags: [ "Linux" ],
|
|||
|
tech_stack: [ "Linux" ],
|
|||
|
tech_stack_percent: [ 1 ],
|
|||
|
tech_stack_icon_names: [ "simple-icons:linux" ],
|
|||
|
tech_stack_theme_colors: [ "#263238" ],
|
|||
|
}
|
|||
|
---
|
|||
|
!!!warning Legacy Article 过时的文章
|
|||
|
此文章从旧博客迁移而来,编写时技术水平有限,仅供参考
|
|||
|
!!!
|
|||
|
|
|||
|
如果你只是想安装KiCAD,以应该安装官方PPA源然后下载预构建版本
|
|||
|
如果你像我一样,遇到了主程序为6.0 其他为8.0 的问题,或者因为什么其他原因决心手动编译。那么,欢迎,祝你好运。
|
|||
|
——————————————————————————————————————————————————————————————————————————————————————————
|
|||
|
## 依赖处理
|
|||
|
源代码下载,我直接使用[github](https://github.com/KiCad/kicad-source-mirror),不小,如果gitee有镜像也可以考虑
|
|||
|
[官方构建文档](https://dev-docs.kicad.org/zh-cn/build/linux/) 不长,最好先看一下
|
|||
|
首先是处理依赖问题,命令 cmake会检查所有依赖 我这里使用的是:
|
|||
|
`cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo ../../`
|
|||
|
|
|||
|
openGL
|
|||
|
'''
|
|||
|
sudo apt-get install build-essential
|
|||
|
sudo apt-get install build-essential libgl1-mesa-dev
|
|||
|
sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev
|
|||
|
sudo apt-get install libglfw3-dev libglfw3
|
|||
|
sudo apt-get install freeglut3-dev
|
|||
|
'''
|
|||
|
|
|||
|
CURL:
|
|||
|
`sudo apt-get install libcurl4-openssl-dev`
|
|||
|
|
|||
|
cairo:
|
|||
|
`sudo apt-get install libcairo2-dev`
|
|||
|
|
|||
|
libgit2:
|
|||
|
`sudo apt install libgit2-dev`
|
|||
|
|
|||
|
boost:
|
|||
|
`sudo apt-get install libboost-all-dev`
|
|||
|
|
|||
|
harfbuzz:
|
|||
|
`sudo apt install libharfbuzz-dev`
|
|||
|
|
|||
|
提升Clang版本至Clang-15
|
|||
|
提升Gcc版本(必要性存疑)至gcc-12
|
|||
|
`sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12`
|
|||
|
理论上来说,KiCAD由gcc编译,但是提升Clang版本才让我实际解决了问题
|
|||
|
|
|||
|
安装OpenCascade
|
|||
|
[过程见此文章](https://blog.csdn.net/smart_jackli/article/details/128132773)
|
|||
|
编译约耗时1h45min
|
|||
|
|
|||
|
wxpython:
|
|||
|
`sudo apt install -y libgtk-3-dev`
|
|||
|
`pip install wxpython`
|
|||
|
编译约耗时50min
|
|||
|
`pip install wxWidgets`
|
|||
|
|
|||
|
我是在Cmake过程中,不断检查依赖,完成的这篇文章。当进行到这里时,我出现了一个问题:
|
|||
|
'''
|
|||
|
CMake Error at CMakeLists.txt:992 (message):
|
|||
|
wxWidgets 3.2.0 or greater is required
|
|||
|
'''
|
|||
|
但是,我已经安装了wxWidgets 3.2.2
|
|||
|
检查相关的Cmake脚本,定位到这一段:
|
|||
|
/cmake/FindwxPython.cmake
|
|||
|
'''
|
|||
|
set( _py_cmd "import wx;print(wx.wxWidgets_version.split(' ')[1])")
|
|||
|
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_dll}${_py_site_path}${_py_cmd}"
|
|||
|
RESULT_VARIABLE WXPYTHON_WXVERSION_RESULT
|
|||
|
OUTPUT_VARIABLE WXPYTHON_WXVERSION
|
|||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|||
|
)
|
|||
|
|
|||
|
if( NOT WXPYTHON_WXVERSION_RESULT EQUAL 0 )
|
|||
|
set( WXPYTHON_WXVERSION "3.0.2" )
|
|||
|
message( WARNING "Could not determine wxWidgets version used by Phoenix, "
|
|||
|
"requesting ${WXPYTHON_WXVERSION}" )
|
|||
|
endif()
|
|||
|
'''
|
|||
|
你可以像这段代码一样运行一下:
|
|||
|
`import wx;print(wx.wxWidgets_version.split(' ')[1])`
|
|||
|
我的结果是3.2.2.1
|
|||
|
这里我直接修改脚本 把 3.0.2 修改为 3.2.1
|
|||
|
如果你没遇到这个问题,那是最好的。如果遇到了,可以先这么改。
|
|||
|
你可能会有疑问 为什么是3.2.1 这是因为之前apt安装的wxWidgets 就是3.2.1 如果这里不匹配有会报错
|
|||
|
|
|||
|
unixodbc
|
|||
|
`sudo apt-get install unixodbc-dev -y`
|
|||
|
`sudo apt-get install libsecret-1-dev -y`
|
|||
|
libsecret-1-dev 可能不必要 我本来使用的是iodbc 但是报错了,libsecret可能不被unixodbc需要
|
|||
|
|
|||
|
Ok,兄弟们,搞到这,依赖应该差不多了。下一步Build
|
|||
|
## Build
|
|||
|
`Ninja`
|
|||
|
Ninja会快一点(存疑)
|
|||
|
目前编译时间:1:36+2:38+1:47+1:00
|