Help wanted to build on MacOS

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

Help wanted to build on MacOS

fa201
The documentation of LibreCAD is currently being refreshed and reshaped.

The section "Build from source" was copied from the current Wiki to the new site (readthedocs.io). We need some people to run the building from source on MacOS to check if everything is fine and up-to-date. The purpose is to follow the given directions and to report any issue, any missing step or any change in parameter.

Even if the build is OK, please report the status along with the MacOS version used.
Thank you.

Fabrice.
Fabrice

French hobbyist interested in 2D design.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

txgraeme
This post was updated on .
Thanks for providing a space to discuss the MacOS build instructions.  I started on this last week and have the following results to report so far, based on the following machine: PPC G3-450 on OSX 10.4.11.

1)  The macports version gives an error (i.e. 'port install librecad'), as I believe it was intended for Intel x86 machines rather than on PPCs (nothing wrong with that, but it's not indicated in the wiki).  I was not able to find a current port or an old *.DMG file that would be acceptable to the machine.  I don't know how to install old port versions (EDIT: see next post for link to that).

2)  I'm working through the "build from source" method (MacOS 10.8 & older), it has taken a few days so far to build the necessary dependencies.  I've been using the recommended command line entries given in the wiki, one error I've found is that macports doesn't carry the 'git-core' repository so I'm trying with just 'git' instead (EDIT: 'git' was successful).  Tonight I'll start building the main program.

3)  I'm trying to learn more about the dependencies such as Qt and GCC as it seems specific versions are required for specific Librecad versions, but no general instructions as to where to find more information.  I think I'll end up with errors during the build that will provide a bit more guidance, but it would be great if anyone already has this knowledge to share.

I'm not a developer, so this is kinda new territory for me.  However, I do use CAD all-day every-day so it's important for me to get it running.  Thanks to all who helped put together the wiki and build instructions, it's a good place to start for neophytes like me.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

txgraeme
This post was updated on .
So far I've been able to progress until the 'qmake' instructions, at which point I got a command not found.  
EDIT: It turns out a qt4-mac dependency isn't installing correctly, 'dbus', so I've got to figure that out first then will try again.  
EDIT2:  Have now been able to go through the original install list one-by-one (sudo port install gcc48 qt4-creator-mac qt4-mac boost freetype) and have only found that one 'dbus' error so far.  qt4-mac@4.8.7_8 installed okay, but qt4-creator-mac@2.8.1_2 is the current problem.
EDIT3:  Was able to follow advice on installing older ports (https://trac.macports.org/wiki/howto/InstallingOlderPort) to install earlier version of dbus more agreeable to my system  (@1.10.24).  
EDIT4:  I assumed that I could alter the portfile to reference the older version of 'dbus' when installing Qt, but it sounds like MacPorts prevents that action.  Now looking for a different method to do it.  In the meantime I'm following the wiki about installing older port to install an older version of LibreCAD@2.0.8, but still hoping to get the newest version to build eventually.
-I'm not able to progress any farther, so putting aside for the moment. If anyone has tips to suggest it would be great.  Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

xanderdin
In reply to this post by fa201
I've got successful build on MacOS 10.14. But because I do not own a real Mac I've done it in the cloud. I'm not familiar with MacOS specifics and what I got is a result of number of trials and errors. First, I tried to build with default clang compiler and the build always failed with an error. Then I tried to build with gcc but qmake tried hard to disallow me that. I tried linking installed gcc tools to /usr/local/bin, ~/bin, played with PATH and other environment variables, but every time qmake was giving me the following error:

Project ERROR: failed to parse default search paths from compiler output

Looking into .qmake.stash file showed me that despite anything I did to use gcc, qmake always used the same path down below Xcode directory:

...
QMAKE_MAC_SDK.macx-g++.macosx.QMAKE_CC = /Applications/Xcode_10.2.1.app/Contents/Developer/usr/bin/gcc
QMAKE_MAC_SDK.macx-g++.macosx.QMAKE_CXX = /Applications/Xcode_10.2.1.app/Contents/Developer/usr/bin/g++
...

And that 'gcc' when run with --version occured to be clang:

Apple LLVM version 10.0.1 (clang-1001.0.46.4)

So I forced and made a real gcc to be at that location and finally got a result. I cannot recommend my approach for a personal computer but it is safe in the cloud where for each build there is a new fresh virtual machine image.


My steps include installation of dependencies:

brew install \
    boost@1.60 \
    gcc@9 \
    qt5

brew link qt5 --force

Forcing real 'gcc' to be inside Xcode directory:

sudo xcode-select -s /Applications/Xcode_10.2.1.app/Contents/Developer
sudo ln -f -s /usr/local/bin/gcc-9 /Applications/Xcode_10.2.1.app/Contents/Developer/usr/bin/gcc
sudo ln -f -s /usr/local/bin/gcc-9 /Applications/Xcode_10.2.1.app/Contents/Developer/usr/bin/cc
sudo ln -f -s /usr/local/bin/g++-9 /Applications/Xcode_10.2.1.app/Contents/Developer/usr/bin/g++
sudo ln -f -s /usr/local/bin/g++-9 /Applications/Xcode_10.2.1.app/Contents/Developer/usr/bin/c++
sudo ln -f -s /usr/local/bin/gcc-ar-9 /Applications/Xcode_10.2.1.app/Contents/Developer/usr/bin/ar
sudo ln -f -s /usr/local/bin/gcc-nm-9 /Applications/Xcode_10.2.1.app/Contents/Developer/usr/bin/nm
sudo ln -f -s /usr/local/bin/gcc-ranlib-9 /Applications/Xcode_10.2.1.app/Contents/Developer/usr/bin/ranlib

Inside cloned LibreCAD directory I do the following:

echo "BOOST_DIR = /usr/local/opt/boost@1.60/"    >> ./librecad/src/custom.pro
echo "BOOST_LIBDIR = /usr/local/opt/boost@1.60/" >> ./librecad/src/custom.pro
echo "QT_CONFIG -= no-pkg-config"                >> ./librecad/src/custom.pro
./scripts/build-osx.sh -q="-spec macx-g++"

And everything builds OK resulting in LibreCAD.dmg file.

If you are interested in all my trial and errors (for MacOS, Windows and Linux) please see git history of my commits here: https://github.com/xanderdin/LibreCAD/commits/play_with_azure
And resulting cloud builds with logs are available here: https://dev.azure.com/xanderdin/PlayWithAzure/_build?definitionId=1&_a=summary Please note, the build history and logs are available for no more than 30 days and then will be automatically deleted by cloud provider.

Hope my build experience is helpful.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

Gary S
In reply to this post by fa201
I recently revised the macOS build instructions in the User Manual to use Homebrew and LLVM.  After parsing through the Developer's wiki and the previous instructions, these instructions seem to be easier (?).  

However I don't have a mac, so I can't test them.  My intent is for the instructions to have sufficient detail so that someone with a little bit of experience can build LibreCAD on a mac, but without having a full understanding the build process.  Hopefully it is a matter of cut'n'paste to copy the instructions from the webpage to the command prompt.

1.  Would someone work through the instructions and let me know if there are any problems with them or if some of the details are not accurate?
2.  I assume the instructions require the command line.  I'm guessing that is via "Terminal" on a mac?
3.  Also, what version of macOS will support these instructions?  Does it need to the the most current or will it work on older versions??

Thanks for your help...

Gary S
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

flywire
This post was updated on .
If there are issues with the build guide then update the full build guide at https://github.com/LibreCAD/LibreCAD/wiki/Build-from-source and base the simplified user guide on that so they are consistent instead of making yet another process. I suppose mac users know what os they use but it seems there is more than one.

It's a known process, it should be a single download and build step but there are constant warnings the build process doesn't work.

Just sticking to formal documentation maze:

* First reference: https://librecad.org/#download
* Redirects to: https://wiki.librecad.org/index.php?title=Build_from_source
* References code source: https://github.com/LibreCAD/LibreCAD/
* Code source wiki: https://github.com/LibreCAD/LibreCAD/wiki/Build-from-source

Indirectly referenced through the wiki:

* Reference to documentation: https://dokuwiki.librecad.org/doku.php/community:contribute_documentation
* Simplified build guide: https://librecad-docs-dev.readthedocs.io/en/latest/appx/build.html#

I don't know if the Simplified build guide is even relevant given the latest release is LibreCAD v2.1.3 and the guide is for some unknown future version and OS (LibreCAD v2.2.0-rc1 with a few additions).

Then it gets even more complicated with:

* LibreCAD_3: https://github.com/LibreCAD/LibreCAD_3/wiki/Building, even uses a different compiler
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

ianmac
In reply to this post by fa201
Hi,

Built on Mac Mini (M1, 2020) 8GB
OS
  System Version: macOS 11.4 (20F71)
  Kernel Version: Darwin 20.5.0

LibreCAD
Version: 2.2.0-rc2-19-ge02f3580
Compiler: Clang 12.0.5
Compiled on: May 31 2021
Qt Version: 5.15.2
Boost Version: 1.71.0
System: macOS 11.4

Used MacPorts instead of homebrew as I already had MacPorts installed, changed the build procedure for this as follows:

1. sudo port install boost qt5

2. cd into git clone dir as per current build instructions

3. /System/Volumes/Data/opt/local/libexec/qt5/bin/qmake librecad.pro -r -spec macx-clang

4. make -j4

5. open LibreCAD.app

Sampling process 20439 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling LibreCAD (pid 20439) every 1 millisecond
Process:         LibreCAD [20439]
Path:            /Applications/LibreCAD.app/Contents/MacOS/LibreCAD
Load Address:    0x104240000
Identifier:      com.yourcompany.LibreCAD
Version:         2.2.0 (2.2.0)
Code Type:       ARM64
Platform:        macOS
Parent Process:  ??? [1]

Date/Time:       2021-05-31 13:07:44.767 +0100
Launch Time:     2021-05-31 12:45:03.152 +0100
OS Version:      macOS 11.4 (20F71)
Report Version:  7
Analysis Tool:   /usr/bin/sample

Physical footprint:         85.9M
Physical footprint (peak):  90.6M

no issues seen so far

Thank you for this

Ian

Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

Peter Hagen
This worked for me, very good. Would it be possible to add this to the "Continues build" releases?
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

LordOfBikes
Administrator
Continuous builds for macOS are at GitHub:
https://github.com/LibreCAD/LibreCAD/releases/tag/latest
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

Peter Hagen
Yeah I know, but as far as I can tell, there is no M1 build.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

LordOfBikes
Administrator
Ah, I see, M1 was not guiding thread here, so I missed it.
There was another thread concerning Bug Sur and M1.

The problem with M1 is, that GitHub currently has no CI runners supporting it. And cross-compiling seams to be no option too.
So we would have to buy or rent hardware for continuous M1 builds, which is also no option yet.
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

Peter Hagen
Ah ok. I'm not familiar with the build system of Github, I use Gitlab mostly, which can have Gitlab runners installed on a system to make the builds. Is that an option for Github too? I could provide the machine to make those builds. I have an always on MacMini which should be capable enough to do the build
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

LordOfBikes
Administrator
Many thanks Peter for this offer.
I'll check if GitLab is an option for M1 builds for us.

Armin
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

LordOfBikes
Administrator
Peter, sadly I made no progress yet in checking for M1 builds.
I focused on pull requests for a new release candidate 2.2.0-rc4.
When no new issues arise, this will become the new release 2.2.0.

See https://github.com/LibreCAD/LibreCAD/releases/tag/2.2.0-rc4

What is missing is a macOS DMG package for M1 system.
Would you please be so kind and build one?

When checking out latest code, use --tags to get the latest 2.2.0-rc4 tag for the info box.
If you have any issues don't hesitate to contact me.

Armin
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

Peter Hagen
No problem. I made the build, so I have the app folder, just not sure how to create the DMG.

When I run the script build-dmg.sh I get this error:

+ OSNAME[7]=Lion
+ OSNAME[8]=MountainLion
+ OSNAME[9]=Mavericks
+ OSNAME[10]=Yosemite
+ OSNAME[11]=ElCapitan
+ OSNAME[12]=Sierra
+ OSSDK[7]=macosx10.7
+ OSSDK[8]=macosx10.8
+ OSSDK[9]=macosx10.9
+ OSSDK[10]=macosx10.10
+ OSSDK[11]=macosx10.11
+ OSSDK[12]=macosx10.12
++ dirname ./build-dmg.sh
+ SCRIPTPATH=.
++ xcodebuild -showsdks
++ grep macosx
++ sed -e 's/.*macosx10\.//g'
2022-06-08 09:22:03.983 xcodebuild[3567:51827] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-06-08 09:22:03.983 xcodebuild[3567:51827] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
+ for v in '$(xcodebuild -showsdks | grep macosx | sed -e '\''s/.*macosx10\.//g'\'')'
++ seq 7 macOS
seq: invalid floating point argument: macOS
+ for v in '$(xcodebuild -showsdks | grep macosx | sed -e '\''s/.*macosx10\.//g'\'')'
++ seq 7 12.3
+ for t in '$(seq 7 $v)'
./build-dmg.sh: line 26: 12.3: syntax error: invalid arithmetic operator (error token is ".3”)

I guess it breaks on the Xcode version?
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

Peter Hagen
I figured it out, how this works. I created a separate script for Monterey, to try it, and it seems to work.

#!/bin/bash -x

#build dmg installers for OS/X

OSNAME[7]="Monterey"
TARGET[7]="12.3"
OSSDK[7]="macosx12.3"

#path of this script file
SCRIPTPATH="$(dirname "$0")"

for v in $(xcodebuild -showsdks | grep macosx | sed -e 's/.*macosx10\.//g')
do
	for t in $(seq 7 $v)
	do
		echo "Build SDK ${v} ($t)"

		"${SCRIPTPATH}"/build-osx.sh -qmake_opts="QMAKE_MAC_SDK=${OSSDK[$t]} QMAKE_MACOSX_DEPLOYMENT_TARGET=${TARGET[$t]}"
		mv -v ${SCRIPTPATH}/../LibreCAD.dmg ${SCRIPTPATH}/../LibreCAD-${OSNAME[$t]}-${OSSDK[$t]}.dmg
	done
done

I now have a LibreCAD-Monterey-macosx12.3.dmg file. How should I send you the file?
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

LordOfBikes
Administrator
Great, many thanks Peter!

I just checked our GitHub build, which uses Big Sur 11.6.6. The DMG should have been created with make already. It should be in the LibreCAD root folder, named LibreCAD.dmg.
The script build-dmg.sh was last used with High Sierra I think.
Then we had a contribution, which implemented to use Qt's macdeployqt to create LibreCAD.dmg as part of the build process.
I think we should note in the script, that it is deprecated.

Maybe you can check if you have overseen LibreCAD.dmg after make?
See https://github.com/LibreCAD/LibreCAD/runs/6781493197?check_suite_focus=true#step:4:15958 on GitHub Actions for how the output should look like.

Anyhow, when you send me the file I can provide it to the community and we'll see if it works.

I'll send you an upload link to my Google drive for the file.

Many thanks again!

Armin
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

LordOfBikes
Administrator
Bad news Peter
https://github.com/LibreCAD/LibreCAD/issues/1548

Sadly I have no possibility to examine this yet.

Armin
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

Peter Hagen
Ok, lets try again then. This is the way I build now:

/System/Volumes/Data/opt/local/libexec/qt5/bin/qmake librecad.pro -r -spec macx-clang

make -j4

After this I have a LibreCad.app directory, but no dmg. Should I do something else?

And strange, I used the DMG myself, and that works without issues.
Reply | Threaded
Open this post in threaded view
|

Re: Help wanted to build on MacOS

Peter Hagen
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