Help wanted to build on MacOS

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

LordOfBikes
Administrator
Sorry, my bad, I should have mentioned the build-osx.sh script earlier.

Many thanks for the new package, it is online on GitHub. When we get positive feedback, I'll put it back on sourceforge again.
investing less than half an hour into Search function can save hours or days of waiting for a solution
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

minmeg
In reply to this post by fa201
I had to change 'qt5' in this command to '/usr/local/Cellar/qt@5/5.15.12/bin/qmake', and I managed to build LibreCAD from source on macOS Sonoma.
Thank you!


Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

dxli
In reply to this post by Peter Hagen
If there's any update needed for the script, please let us know.
Peter Hagen wrote
I figured out that I should have used the build-osx script (maybe the documentation on https://librecad.readthedocs.io/en/latest/appx/build.html could be updated with this). So, did a new build and now I have a DMG in the directory.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

Steve Woolet
In reply to this post by fa201
I am trying to build using the instructions for MacOS found on https://docs.librecad.org/en/latest/appx/build.html#build.
My macOS is Tahoe 26.3.1 (25D2128) running on an Apple M4 chip. I did a fresh install of Homebrew as described. I had to use Homebrew to install pkg-config ("brew install pkg-config") to get the "qmake librecad.pro -r -spec macx-clang" command to run without a freetype2 error.
The "make -j4" command will not run without errors. I get:

src/lc_svgiconengine.cpp:225:11: error: call to deleted constructor of 'QFile'
  225 |     QFile plainSVGFile = QFile(plainSVGFileName);
      |           ^              ~~~~~~~~~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/qt@5/5.15.18/lib/QtCore.framework/Headers/qfile.h:163:20: note: 'QFile' has
      been explicitly marked deleted here
  163 |     Q_DISABLE_COPY(QFile)
      |                    ^
src/lc_svgiconengine.cpp:319:19: error: call to deleted constructor of 'QFile'
  319 |             QFile plainSVGFile = QFile(fileName);
      |                   ^              ~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/qt@5/5.15.18/lib/QtCore.framework/Headers/qfile.h:163:20: note: 'QFile' has
      been explicitly marked deleted here
  163 |     Q_DISABLE_COPY(QFile)
      |                    ^
2 errors generated.

Any recommendations on how to proceed?

Thanks.

Steve
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

dxli
In reply to this post by Peter Hagen
It reminds me. We should update librecad for:
macport
homebrew

For building scripts, I suppose AI is now powerful enough.

Just ask AI to generate a building script for your system for github LibreCAD the branch 2.2.1 (or branch master).

I asked AI:

generate a building script for macOS arm64 DMG for github librecad for the branch 2.2.1

and this is the script I received:

#!/bin/bash

# 1. Environment Setup
# LibreCAD 2.2.1 requires Qt 5. Do not use Qt 6.
echo "Installing dependencies..."
brew install qt@5 boost

QT_PATH="/opt/homebrew/opt/qt@5/bin"
export PATH="$QT_PATH:$PATH"

# 2. Clone and Checkout Branch 2.2.1
echo "Cloning LibreCAD branch 2.2.1..."
git clone --branch 2.2.1 https://github.com
cd LibreCAD

# 3. Configure and Compile
echo "Running qmake for arm64..."
qmake librecad.pro -r -spec macx-clang-arm64 CONFIG+=sdk_no_version_check

echo "Starting build (using 10 cores)..."
make -j10

# 4. Packaging the DMG
# Locate the built .app bundle (typically in librecad/src/)
APP_BUNDLE="librecad/src/LibreCAD.app"

if [ -d "$APP_BUNDLE" ]; then
    echo "Bundling dependencies and creating DMG..."
    
    # macdeployqt bundles libraries and creates the DMG
    # -dmg creates the disk image; -always-overwrite ensures it replaces old ones
    macdeployqt "$APP_BUNDLE" -dmg -always-overwrite
    
    # 5. Apple Silicon Security Fix
    # Unsigned DMGs often show as 'damaged'. Self-signing fixes this locally.
    echo "Applying security workarounds for arm64..."
    xattr -rc "$APP_BUNDLE"
    sudo codesign --force --deep --sign - "$APP_BUNDLE"
    
    echo "Success! Your DMG is located at: librecad/src/LibreCAD.dmg"
else
    echo "Build failed. App bundle not found."
    exit 1
fi





Peter Hagen wrote
I figured out that I should have used the build-osx script (maybe the documentation on https://librecad.readthedocs.io/en/latest/appx/build.html could be updated with this). So, did a new build and now I have a DMG in the directory.
12