Has core22 changed the "cmake"-plugin?

I’m currently trying to port my “cura-slicer”-snap package to core22 and Cura 5.0. Currently i’m stuck at compiling the “CuraEngine”-program. There is some problem with cmake i can’t get around:

+ cmake /root/parts/CuraEngine/src -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/ -DCMAKE_PREFIX_PATH=/root/stage/usr -DUSE_SYSTEM_LIBS=ON -Wno-dev                                                                      
2022-07-03 16:42:21.417 :: -- The C compiler identification is GNU 11.2.0                                                                                                                                                                                                        
2022-07-03 16:42:21.467 :: -- The CXX compiler identification is GNU 11.2.0                                                                                                                                                                                                      
2022-07-03 16:42:21.474 :: -- Detecting C compiler ABI info                                                                                                                                                                                                                      
2022-07-03 16:42:21.530 :: -- Detecting C compiler ABI info - done                                                                                                                                                                                                               
2022-07-03 16:42:21.539 :: -- Check for working C compiler: /usr/bin/cc - skipped                                                                                                                                                                                                
2022-07-03 16:42:21.540 :: -- Detecting C compile features                                                                                                                                                                                                                       
2022-07-03 16:42:21.540 :: -- Detecting C compile features - done                                                                                                                                                                                                                
2022-07-03 16:42:21.544 :: -- Detecting CXX compiler ABI info                                                                                                                                                                                                                    
2022-07-03 16:42:21.610 :: -- Detecting CXX compiler ABI info - done                                                                                                                                                                                                             
2022-07-03 16:42:21.620 :: -- Check for working CXX compiler: /usr/bin/c++ - skipped                                                                                                                                                                                             
2022-07-03 16:42:21.620 :: -- Detecting CXX compile features                                                                                                                                                                                                                     
2022-07-03 16:42:21.621 :: -- Detecting CXX compile features - done                                                                                                                                                                                                              
2022-07-03 16:42:21.624 :: -- Generating compile commands to /root/parts/CuraEngine/build/compile_commands.json                                                                                                                                                                  
2022-07-03 16:42:21.624 :: -- Setting C++17 support with extensions off and standard required                                                                                                                                                                                    
2022-07-03 16:42:21.624 :: -- Building with Arcus                                                                                                                                                                                                                                
2022-07-03 16:42:21.754 :: -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so (found suitable version "3.12.4", minimum required is "3.0.0")                                                                                                                            
2022-07-03 16:42:21.765 :: -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so (found suitable version "3.12.4", minimum required is "3.12.4")                                                                                                                           
2022-07-03 16:42:21.765 :: -- Enabling threading support for _CuraEngine                                                                                                                                                                                                         
2022-07-03 16:42:21.767 :: -- Found Threads: TRUE                                                                                                                                                                                                                                
2022-07-03 16:42:21.767 :: -- Setting SKIP_BUILD_RPATH for target _CuraEngine to FALSE                                                                                                                                                                                           
2022-07-03 16:42:21.767 :: -- Setting BUILD_WITH_INSTALL_RPATH for target _CuraEngine to FALSE                                                                                                                                                                                   
2022-07-03 16:42:21.767 :: -- Setting INSTALL_RPATH_USE_LINK_PATH for target _CuraEngine to TRUE                                                                                                                                                                                 
2022-07-03 16:42:21.767 :: -- Setting install RPATH for target _CuraEngine to $ORIGIN/;$ORIGIN/$<$<PLATFORM_ID:Linux>:usr/bin>;$ORIGIN/$<$<PLATFORM_ID:Linux>:usr/bin/lib>;$ORIGIN/$<$<PLATFORM_ID:Darwin>:../lib>                                                               
2022-07-03 16:42:21.955 :: -- Found OpenMP_C: -fopenmp (found version "4.5")                                                                                                                                                                                                     
2022-07-03 16:42:22.015 :: -- Found OpenMP_CXX: -fopenmp (found version "4.5")                                                                                                                                                                                                   
2022-07-03 16:42:22.015 :: -- Found OpenMP: TRUE (found version "4.5")                                                                                                                                                                                                           
2022-07-03 16:42:22.017 :: CMake Error at CMakeLists.txt:262 (add_library):                                                                                                                                                                                                      
2022-07-03 16:42:22.017 ::   The target name "clipper::clipper" is reserved or not valid for certain                                                                                                                                                                             
2022-07-03 16:42:22.017 ::   CMake features, such as generator expressions, and may result in undefined                                                                                                                                                                          
2022-07-03 16:42:22.017 ::   behavior.                                                                                                                                                                                                                                           
2022-07-03 16:42:22.017 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.017 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.017 :: CMake Error at CMakeLists.txt:263 (target_include_directories):                                                                                                                                                                                       
2022-07-03 16:42:22.017 ::   Cannot specify include directories for target "clipper::clipper" which is                                                                                                                                                                           
2022-07-03 16:42:22.018 ::   not built by this project.                                                                                                                                                                                                                          
2022-07-03 16:42:22.018 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.018 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.019 :: CMake Error at CMakeLists.txt:272 (add_library):                                                                                                                                                                                                      
2022-07-03 16:42:22.019 ::   The target name "rapidjson::rapidjson" is reserved or not valid for certain                                                                                                                                                                         
2022-07-03 16:42:22.019 ::   CMake features, such as generator expressions, and may result in undefined                                                                                                                                                                          
2022-07-03 16:42:22.019 ::   behavior.                                                                                                                                                                                                                                           
2022-07-03 16:42:22.019 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.019 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.019 :: CMake Error at CMakeLists.txt:273 (target_include_directories):                                                                                                                                                                                       
2022-07-03 16:42:22.019 ::   Cannot specify include directories for target "rapidjson::rapidjson" which                                                                                                                                                                          
2022-07-03 16:42:22.020 ::   is not built by this project.                                                                                                                                                                                                                       
2022-07-03 16:42:22.020 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.020 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.021 :: CMake Error at CMakeLists.txt:280 (find_package):                                                                                                                                                                                                     
2022-07-03 16:42:22.021 ::   By not providing "Findstb.cmake" in CMAKE_MODULE_PATH this project has                                                                                                                                                                              
2022-07-03 16:42:22.021 ::   asked CMake to find a package configuration file provided by "stb", but                                                                                                                                                                             
2022-07-03 16:42:22.021 ::   CMake did not find one.                                                                                                                                                                                                                             
2022-07-03 16:42:22.021 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.021 ::   Could not find a package configuration file provided by "stb" with any of                                                                                                                                                                           
2022-07-03 16:42:22.021 ::   the following names:                                                                                                                                                                                                                                
2022-07-03 16:42:22.021 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.021 ::     stbConfig.cmake                                                                                                                                                                                                                                   
2022-07-03 16:42:22.021 ::     stb-config.cmake                                                                                                                                                                                                                                  
2022-07-03 16:42:22.021 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.021 ::   Add the installation prefix of "stb" to CMAKE_PREFIX_PATH or set "stb_DIR"                                                                                                                                                                          
2022-07-03 16:42:22.021 ::   to a directory containing one of the above files.  If "stb" provides a                                                                                                                                                                              
2022-07-03 16:42:22.021 ::   separate development package or SDK, be sure it has been installed.                                                                                                                                                                                 
2022-07-03 16:42:22.021 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.021 ::                                                                                                                                                                                                                                                       
2022-07-03 16:42:22.021 :: -- Configuring incomplete, errors occurred!        

and

  CuraEngine:
    plugin: cmake
    cmake-parameters:
      - -DCMAKE_BUILD_TYPE=RELEASE
      - -DCMAKE_INSTALL_PREFIX=/usr/
      - -DCMAKE_PREFIX_PATH="${CRAFT_STAGE}/usr"
      - -DUSE_SYSTEM_LIBS=ON
      - -Wno-dev
    source: https://github.com/Ultimaker/CuraEngine/archive/refs/tags/5.0.0.tar.gz
    source-type: tar
    build-packages:
      - cmake
      - libboost-dev
      - libcppunit-dev
      - libnlopt-cxx-dev
      - libnlopt-dev
      - libpolyclipping-dev
      - libprotobuf-dev
      - libprotoc-dev
      - libstb-dev
      - pkg-config
      - protobuf-compiler
      - rapidjson-dev
    stage-packages:
      - libgomp1
    override-pull: |
      craftctl default
      for commit in `ls ${CRAFT_PROJECT_DIR}/local/patches/CuraEngine`; do patch -p1 < ${CRAFT_PROJECT_DIR}/local/patches/CuraEngine/${commit}; done
    after:
      - libSavitar
1 Like

+1 - I use your cura snap quite often!

I ported cmake to core22. No changes is behavior were intended.

I tried building cura on core22 and had 2 stumbling points:

  1. An old version of cmake was being installed from the package-repositories: kde focal repository.
  2. I couldn’t get CuraEngine to find libarcus, likely because I butchered your snapcraft.yaml file.

I suspect the problem may be something other than the cmake plugin itself. Could you post your entire snapcraft file for core22? If I can get to the same error as you, then I can help debug further.

An old version of cmake was being installed from the package-repositories: kde focal repository.

This repository can be removed because Ubuntu 22.04 packages nearly all dependencies Cura 5.0 needs.

I couldn’t get CuraEngine to find libarcus, likely because I butchered your snapcraft.yaml file.

This is basically the same problem i have with “libstb”. If you remove “DCMAKE_PREFIX_PATH” from the CuraEngine-part snapcraft cannot find an installed “libArcus”. If you add the line, “libstb” cannot be found.

The funny thing is that i’ve added “DCMAKE_PREFIX_PATH” when porting the snap from “core18” to “core20” because snapcraft had problems finding libArcus after porting the snap to core20.

Basically i’m back to my old problem and i have no idea how to solve my problems.

P.S.:

I’ve not pushed my core22-YAML file to Github because there are to many things missing and not working. Currently i’m stuck with compiling CuraEngine. I’ve not even started trying to build the Pyt6-based GUI for Cura 5.0 because there is no PyQt6 in Ubuntu 22.04.

Hey @glasen77,

Using the snapcraft channel latest/edge and tweaking your snapcraft.yaml (see here), I can build everything except pynest2d and the gnome plugs. I think those two issues are resolvable, I just didn’t look into them further.

There’s been many improvements to core22 recently. I have an outstanding fix for subdirectories here (https://github.com/canonical/craft-parts/pull/250), but I don’t think that affects your project. So, you may have more success building cura on core22 now!

Thanks for the reply but i’m giving up trying to build Cura 5.x as a snap-package. Every time i’ll try to build the snap something other breaks. With Cura 5.1 “libArcus” is now broken/does not compile:

:: CMake Error at cmake/SIPMacros.cmake:68 (message):
:: SIP: Specify the site-packages location
:: Call Stack (most recent call first):
:: CMakeLists.txt:66 (install_sip_module)

I will update the description of the snap store that Cura will stay at 4.13.2 for now and if someone wants a new version he/she should download the official AppImage which also works for Ubuntu 22.04.

A cmake plugin bug was fixed in Snapcraft 7.1.2: CMAKE_PREFIX_PATH should now be correctly set by default to the stage dir and can be removed from cmake-parameters.