LibreCAD Snap Request

I’m a developer of https://github.com/LibreCAD/LibreCAD.

Under GPLv2.0, LibreCAD focuses on 2D geometry and CAD, and is currently available in the Ubuntu main repository.

This request is for snaps of the current git master branch(Qt6 based), i.e. the latest development, and the pending release 2.2.1 branch.

For 2.2.1, the app is Qt5 based, and an example snapcraft.yaml has been created:

https://github.com/LibreCAD/LibreCAD/blob/2.2.1/snapcraft.yaml

2 Likes

I have look at your snap and is seems 100% ready to run. What kind of help do you ask ?

1 Like

The snap file are ok, What kind of help you need?

Hi,

Two issues:

1, the current snapcraft file is for qt6, and if someone can help with the qt6 version, it helps.

2, I thought there’s some approval procedure, so the snaps can be added to the official repository. Ideally, user can find different versions in search. Like stable, release candidate, and latest development, etc.

Best regards,

Dongxu Li

You need to request a name first, you can build and link the snap latter, exists no penalty for register a snap name and don’t use it immediately (you can keep the name without use forever btw).

Just click in register name, and fallow the steps. it will asked for a reason, You can say you’re maintainer of LibreCAD and link the github account.

+1 with Cosmiclace

About QT 6 support it seems not documented yet (perhaps not possible yet). For QT 5, the best doc pages I know are:

Thanks a lot.

Our qt5 snap works well, and looking forward to getting it pushed auto from GitHub.

I will continue to try cmake build for qt6. Currently, cmake always fails to find some qt6 components, even installed, like qt6-svg-dev.

Hi,

I still need some help with librecad snap. Currently, it builds and installs normally, but the app won’t start and the error message is:

QSocketNotifier: Can only be used with threads started with QThread

(librecad:37091): Gtk-WARNING **: 17:15:52.259: Theme parsing error: gtk.css:1:21: Failed to import: Error opening file /home/dli/snap/librecad/x14/.config/gtk-3.0/colors.css: No such file or directory libEGL fatal: DRI driver not from this Mesa build (‘23.0.4-0ubuntu1~22.04.1’ vs ‘23.2.1-1ubuntu3.1~22.04.2’)

Here is my snapcraft.yaml

https://github.com/dxli/LibreCAD/blob/master/snapcraft.yaml

I think you need to use a Qt5 desktop helper for setting up GL properly:

Or you can depend on kde-neon extension for that. Also I don’t see you including the necessary opengl, desktop plugs.

1/ kde-neon extension is visual QT5 (qt5 + mesa … etc) so you don’t need to add qt5 libraries in stage or build nor its dependencies

NB: kde-neon-6 is visual QT6

2/ The warning is also because you use qmake plugin which is based on qt5-qmake package with a different version of QT than kde-neon Thus you need to use the make plugin and call the qmake from kde-neon

Still need some work (there is a problem with freetype and I don’t know about others none-qt dependencies) but it runs:

name: librecad
version: '2.2.1-rc4'
grade: stable
base: core22
confinement: strict
license: GPL-2.0
summary: "librecad: is a 2D open source CAD"
compression: lzo
description: |
  LibreCAD is a cross-platform 2D CAD program written in C++17. It can read DXF/DWG files
  and can write DXF/PDF/SVG files. It supports point/line/circle/ellipse/parabola/spline
  primitives. The user interface is highly customizable, and has dozens of translations.
  Code repository:
  https://www.github.com/LibreCAD/LibreCAD
environment:
  LD_LIBRARY_PATH: $SNAP/usr/local/lib/:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/:$SNAP/usr/lib64/:$LD_LIBRARY_PATH

apps:
  librecad:
    command: usr/bin/librecad
    plugs:
      - home
      - desktop
      - desktop-legacy
      - opengl
      - wayland
      - unity7
      - x11
    desktop: usr/share/applications/org.librecad.librecad.desktop
    common-id: org.librecad.librecad.desktop
    extensions:
      - kde-neon #kde-neon-6
      
plugs:
  desktop:
    mount-host-font-cache: false
  icon-themes:
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
  sound-themes:
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes
  kf5-5-113-qt-5-15-11-core22:
    content: kf5-5-113-qt-5-15-11-core22-all
    interface: content
    default-provider: kf5-5-113-qt-5-15-11-core22
    target: $SNAP/kf5
  gtk-3-themes:
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes

parts:
  librecad:
    plugin: make #qmake
    #qmake-parameters:
    #  - "QMAKE_CFLAGS+=-march=x86_64"
    #  - "QMAKE_CXXFLAGS+=-march=x86-64"
    #build-environment:
    #  - QT_SELECT: qt5 #qt6
    source: .
    build-packages:
      - build-essential
      #- qtbase5-dev #qt6-base-dev
      #- qttools5-dev #qt6-tools-dev
      #- qttools5-dev-tools #qt6-tools-dev-tools
      #- librsvg2-bin
      #- libqt5waylandclient5-dev #qt6-wayland-dev
      #- libfreetype6-dev
      #- libicu-dev
      #- libqt5opengl5-dev #libqt6opengl6-dev
      #- libcairo2-dev
      #- libpango-1.0-0
      #- libpango1.0-dev
      - libboost-dev
      - libgl1-mesa-dev # avoid openGL fatal error: GL/gl.h: No such file or directory
      #- libqt5svg5-dev #libqt6svg6-dev
      #- libgtest-dev
      #- libcurl4-gnutls-dev
      #- libgtk-3-dev
      - rsync
      
    override-build: |
      # craftctl default
      export QT_SELECT=qt5
      /snap/kf5-5-113-qt-5-15-11-core22-sdk/current/usr/lib/qt5/bin/qmake 'QMAKE_CFLAGS+=-isystem $CRAFT_STAGE/usr/include' 'QMAKE_CXXFLAGS+=-isystem $CRAFT_STAGE/usr/include' 'QMAKE_LFLAGS+=-L$CRAFT_STAGE/lib -L$CRAFT_STAGE/usr/lib -L$CRAFT_STAGE/usr/lib/x86_64-linux-gnu'
      make -r -j$(nproc)

    #stage-packages:
      #- libfreetype6
      #- libqt5gui5 #libqt6gui6
      #- libqt5printsupport5 #libqt6printsupport6
    stage:
      - -usr/share/pkgconfig

    override-stage: |
      #echo "1"
      #echo $PWD 
      #find .. -type f -name librecad
      export SRC_DIR=../parts/librecad/build/unix
      echo $CRAFT_STAGE
      mkdir -p $CRAFT_STAGE/usr/bin
      mkdir -p $CRAFT_STAGE/usr/share/librecad
      mkdir -p $CRAFT_STAGE/usr/share/applications
      mkdir -p usr/bin
      mkdir -p usr/share/librecad
      cp -a $SRC_DIR/librecad $CRAFT_STAGE/usr/bin/
      #cp -a $SRC_DIR/ttf2lff $CRAFT_STAGE/usr/bin/
      cp -a $SRC_DIR/resources/* $CRAFT_STAGE/usr/share/librecad/
      export DESKTOP_DIR=../parts/librecad/src/desktop
      cp -a $DESKTOP_DIR/*.desktop $CRAFT_STAGE/usr/share/applications/org.librecad.librecad.desktop
      cp -a $DESKTOP_DIR/org.librecad.*.xml $CRAFT_STAGE/usr/share/applications/org.librecad.librecad.xml
      craftctl default
    override-prime: |
      rsync -av ../stage/* ./
      craftctl default

@TehAppKiller

Thanks a lot! It just works. In addition, we also have qt6 spport for the app.

dxli

1 Like

Total awesomeness! Btw, could a link to the snap package (Snap Store) be added to LibreCAD websites download section now? https://librecad.org/#download

Many newcomers can’t get AppImages going because they need to be made executable through terminal and AppImage support on Ubuntu is not OOTB (because of fuse package’s version decision by the AppImage’s strange decision making developer).