2021-07-29 Ubantu18.04下Cura编译

本文详细介绍了在Ubuntu 18.04环境下,从安装Python3.6、protobuf到构建CuraEngine过程中遇到的常见问题及解决方案,包括缺失库、版本兼容问题和链接模块等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Ubantu18.04下Cura编译


版权声明:本文为CSDN博主「微笑的云ryl」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/randyran/article/details/86522914

1.按照这个步骤走到 ln -s /usr/local/lib/python3/dist-packages/Arcus.so .会出现没有Arcus.so文件,问题解决:在build在cmke 和 make一下就会出现Arcus.so
2.会缺少pyqt5-sip,问题解决:pip3 install pyqt5-sip
3. 再次过程中出现的问题都是pyqt5与sip不匹配的问题,解决办法:下载 https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.13/
4. 最后运行./cura_app.py的时候会遇到:
File “/home/workstation/CuraEngine/Cura/cura/OAuth2/KeyringAttribute.py”, line 7, in
from keyring.errors import NoKeyringError, PasswordSetError, KeyringLocked
ImportError: cannot import name 'NoKeyringError,
解决办法:暂未找到,在此记录一下,希望路过的各路大神能给小白支支招

#准备工作,安装好Ubuntu后,修改源设置,见 https://blog.csdn.net/randyran/article/details/86564754 中的第1步,以加快apt-get install X的速度。

CuraEngine编译

  1. 编译安装protobuf
    (1)安装必要工具
    sudo apt-get install autoconf automake libtool curl make g++ git
    (2)下载 protobuf 库
    git clone https://github.com/protocolbuffers/protobuf
    (3) cd protobuf
    (4) git submodule update --init --recursive
    (5) ./autogen.sh
    (6) ./configure
    (7) make -j4
    (8) make check
    (9) sudo make install
    (10) sudo ldconfig #refresh shared library cache

  2. 安装CMake
    (1) sudo apt-get install build-essential
    (2) wget http://www.cmake.org/files/v3.13/cmake-3.13.3.tar.gz
    (3) tar xvf cmake-3.13.3.tar.gz
    (4) cd cmake-3.13.3
    (5) ./configure
    (6) make -j4
    (7) sudo apt-get install checkinstall
    (8) sudo checkinstall
    (9) sudo make install

  3. 安装python3.6及python3.6-dev(Ubuntu18.04自带Python3.6)
    (1) sudo add-apt-repository ppa:jonathonf/python-3.6,随后按Enter确认
    (3) sudo apt-get update
    (4) sudo apt-get install python3.6
    (5) sudo apt-get install python3.6-dev

  4. 安装python3-sip-dev
    sudo apt-get install python3-sip-dev

  5. 编译libArcus库
    git clone https://github.com/Ultimaker/libArcus.git
    cd libArcus
    mkdir build && cd build
    cmake …
    make
    sudo make install

  6. 升级至C++11(如果是Ubuntu16及以上的用户可以略过此步骤)
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt-get update
    sudo apt-get install gcc-4.9 gcc-4.9-multilib g+±4.9 g+±4.9-multilib
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g+±4.9 90
    sudo update-alternatives --config gcc
    sudo update-alternatives --config g++
    1
    2
    3
    4
    5
    6
    7

  7. 编译安装CuraEngine
    git clone https://github.com/Ultimaker/CuraEngine.git
    cd CuraEngine
    mkdir build && cd build
    cmake …
    make
    1
    2
    3
    4
    5
    (参考 https://blog.csdn.net/phmatthaus/article/details/84143704 )

Cura编译
本调试环境为Ubuntu 18.04 + Python 3.6 + Pycharm,环境配置见 https://blog.csdn.net/randyran/article/details/86564754

  1. 安装依赖库(git cmake已经在编译CuraEngine时安装了)
    sudo apt-get install zlib1g-dev
    sudo apt-get install python3-scipy python3-pip
    sudo pip3 install Shapely -i https://pypi.tuna.tsinghua.edu.cn/simple
    sudo pip3 install pyserial PyQt5==5.10 -i https://pypi.tuna.tsinghua.edu.cn/simple

  2. 安装SIP
    (1) 下载SIP 4.19.2+
    https://www.riverbankcomputing.com/software/sip/download
    (2) 解压
    tar xvf sip-4.19.13.tar.gz
    (3) In the Terminal, navigate to the extracted folder:
    $ cd [SIP PATH]
    (4) Next, we will install SIP by running the following commands:
    $ python3 configure.py
    $ make
    $ sudo make install

  3. Savitar(目前使用的3.6 branch,master 4.0未测试)
    (1) clone the libSavitar repository to a directory of your choosing (replace [LIBSAVITAR PATH]):
    $ git clone https://github.com/Ultimaker/libSavitar.git [LIBSAVITAR PATH]
    (2) Go to the repository directory, and create a build directory and switch to it:
    $ cd [LIBSAVITAR PATH]
    $ mkdir build && cd build
    (3) Configure and build libSavitar using the following commands:
    $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX= V I R T U A L E N V − D C M A K E P R E F I X P A T H = VIRTUAL_ENV -DCMAKE_PREFIX_PATH= VIRTUALENVDCMAKEPREFIXPATH=VIRTUAL_ENV -DBUILD_STATIC=ON -DBUILD_PYTHON=ON -DBUILD_EXAMPLES=OFF …
    $ make -j4
    $ sudo make install

  4. Charon
    clone the libCharon repository to a directory of your choosing (replace [LIBCHARON PATH]):
    $ git clone https://github.com/Ultimaker/libCharon.git
    [LIBCHARON PATH]
    Go to the repository directory, and create a build directory and switch to it:
    $ cd [LIBCHARON PATH]
    $ mkdir build && cd build
    Configure and build libCharon using the following commands:
    $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX= V I R T U A L E N V − D C M A K E P R E F I X P A T H = VIRTUAL_ENV -DCMAKE_PREFIX_PATH= VIRTUALENVDCMAKEPREFIXPATH=VIRTUAL_ENV …
    $ make -j4
    $ sudo make install

  5. CuraEngine
    Clone the CuraEngine repository to a directory of your choosing (replace [CURAENGINE PATH]):
    $ git clone https://github.com/Ultimaker/CuraEngine.git [CURAENGINE PATH]
    Go to the repository directory, and create a build directory and switch to it:
    $ cd [CURAENGINE PATH]
    $ mkdir build && cd build
    Configure and build CuraEngine using the following commands:
    $ cmake …
    $ make -j4
    $ sudo make install

  6. Cura & Uranium
    Clone the Cura, Uranium, and fdm_materials repositories to directories of your choosing (replace [CURA PATH], [URANIUM PATH], and [FDM_MATERIALS PATH]):
    $ git clone https://github.com/Ultimaker/Cura.git [CURA PATH]
    $ git clone https://github.com/Ultimaker/Uranium.git [URANIUM PATH]
    $ git clone https://github.com/Ultimaker/fdm_materials.git [FDM_MATERIALS PATH]

  7. 链接模块及库
    在Cura目录下执行“Open in Terminal”,依次执行步骤将模块和库软链接至Cura目录下

(1)Charon
ln -s /lib/python3/dist-packages/Charon .
(2)Uranium目录下的UM
ln -s /home/[你的用户名]/Uranium/UM .
(3)Arcus
ln -s /usr/local/lib/python3/dist-packages/Arcus.so .
(4)Savitar
ln -s /lib/python3/dist-packages/Savitar.so .
(5)CuraEngine
ln -s /home/ryl/CuraEngine/build/CuraEngine .

  1. 将材质配置文件拷贝至Cura/resources/materials目录下
    mkdir resources/materials
    ln -s [FDM_MATERIALS PATH] resources/materials/fdm_materials
    至此,就可以在Pycharm中run cura_app.py了。
    Happy enjoy!
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值