Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building freecad with --with-macos-app #142

Open
ipatch opened this issue Dec 24, 2020 · 33 comments · May be fixed by #172
Open

building freecad with --with-macos-app #142

ipatch opened this issue Dec 24, 2020 · 33 comments · May be fixed by #172
Assignees
Labels

Comments

@ipatch
Copy link
Collaborator

ipatch commented Dec 24, 2020

is the --with-macos-app flag / argument suppose to work when building freecad form head ?

i've been running into make install issues when using the flag.

CMake Error at src/MacAppBundle/cmake_install.cmake:55 (file):
  file INSTALL cannot find
  "/tmp/freecad-20201223-55124-9c422j/src/MacAppBundle/import site": No such
  file or directory.
Call Stack (most recent call first):
  src/cmake_install.cmake:51 (include)
  cmake_install.cmake:68 (include)


make: *** [install] Error 1
/usr/local/Homebrew/Library/Homebrew/shims/scm/git --version
/usr/bin/curl --version
/usr/libexec/java_home --xml --failfast
/usr/libexec/java_home --xml --failfast
git --git-dir /Users/capin/Library/Caches/Homebrew/freecad--git/.git rev-parse --short=7 HEAD

last little bit of the error message, let me know if i need to post anything else.

@vejmarie
Copy link
Contributor

It is supposed to work, even if I never tested it up to now. Did you checked while being detached from head ? I can have a look to it

@vejmarie vejmarie added the bug label Dec 24, 2020
@ipatch
Copy link
Collaborator Author

ipatch commented Dec 24, 2020

no so much looking around, all i did was run above said command but the installation process is failing, i did notice there was a with-packaging-utils a while back that didn't work either. if you can, do you mind trying the flag --with-macos-app to see if it works on your machine?

@vejmarie
Copy link
Contributor

I will for sure as soon my qt build is finished ;) (probably not before tomorrow, as I do have only my dual core macbookpro with me :( )

@ipatch
Copy link
Collaborator Author

ipatch commented Dec 24, 2020

no worries, i'll keep investigating to see if i can figure out what's going on. i know qt can take a while to build from source. i believe it requires building chromium which can take like forever.

@vejmarie
Copy link
Contributor

yep it is currently building chromium ... And my bigsur setup is on a USB drive :( (at least USB 3, but still not the fastest stuff). I kept Catalina on the internal nvme was thinking at dropping it.

@ipatch
Copy link
Collaborator Author

ipatch commented Dec 24, 2020

you run big sur in a vm FWIW, that's what i ended up doing it runs rather slow, but i can start the vm headless on my box and that's how i was testing things out with big sur other day, far from perfect but it's better than nothing. and yeah it'll take ~ 20+ hours to build chromium & qt

@zenz
Copy link
Contributor

zenz commented Dec 24, 2020

I worked, I just use it to compile my own copy last night. using --with-macos-app option.

@vejmarie
Copy link
Contributor

I worked, I just use it to compile my own copy last night. using --with-macos-app option.

At least something which works ;)

@zenz
Copy link
Contributor

zenz commented Dec 24, 2020

--with-macos-app is just adds this line
args << "-DFREECAD_CREATE_MAC_APP=1" if build.with? "macos-app"
which follows the compile document from freecad wiki. It simply works. It should not care about which version you compile no matter stable or --HEAD. except someday freecad change the option to compile Mac Bundles.

And I confirmed --with-packaging-utils doesn't work. since it's using some npm package not exists.
system "node", "install", "-g", "app_dmg" if build.with? "packaging-utils"

and also the command to install npm package is not correct, it should be npm install -g npm_package.
I didn't change that part when I submit the pull request.

@ithinuel
Copy link

ithinuel commented Dec 24, 2020

I have this issue as well and it seems like some dependencies are trying to reach AppKit.Framework from MacOSX11.0.sdk while only MacOSX11.1.sdk is available on my machine.

(I'm new to Mac's universe so I have no idea with this AppKit.framework nor the sdk mean).

EDIT: Namely:

  • FemGui
  • Fem
  • SMDS
  • SMesh

@vejmarie
Copy link
Contributor

It will be fixed before new-year ;). I am hoping to have something during the week-end but it requires a lot of recompilation with XCode 12.3

@ipatch
Copy link
Collaborator Author

ipatch commented Dec 24, 2020

@ithinuel

a hacky work around would be to create a symlink from your macosx11.1.sdk -> macos11.0.sdk

might you get a little further along in the process, not an elegant solution by any means but could work in a pinch.

@ithinuel
Copy link

ithinuel commented Dec 24, 2020

@ipatch Thanks. I can still install it without macos-app and start it from the terminal. So that's not a hard blocker for me.
TBF I'm not even sure what macos-app, I assumed it's to have FreeCAD nicely integrated in the App folder and be able to start it from the dock.

@ipatch
Copy link
Collaborator Author

ipatch commented Dec 24, 2020

@ithinuel

yes i believe that is what it is intended to do. it packages up the install from the homebrew cellar into a FreeCAD.app bundle which should be able to run from double clicking the FreeCAD.app icon using finder or even as you suggested launching from the dock.


out of curiosity what happens when you launch FreeCAD from your terminal in an arbitrary directory ie say your $HOME dir? do you get issues related to not finding pyside ?

i was getting issues related to that yesterday, but then cd into the directory that contained the FreeCAD cmd and everything seemed work as it should, ie. opening/launching workbenches and what not.

i posted about it here yesterday i believe, and below is a picture of what i would see from selecting a workbench from the GUI

@zenz
Copy link
Contributor

zenz commented Dec 24, 2020

@ipatch Thanks. I can still install it without macos-app and start it from the terminal. So that's not a hard blocker for me.
TBF I'm not even sure what macos-app, I assumed it's to have FreeCAD nicely integrated in the App folder and be able to start it from the dock.

with-macos-app only generate a Mac app bundle currently . You need to make a symbol link to /Applications folder to use FreeCAD.app

@ithinuel
Copy link

For what it's worth, I had a similar issue while installing hidapi's python module with pip install hidapi==0.7.99.post21.

Creating a simlink from /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdkto /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk solved the issue for both hidapi 0.7.99.post21 and freecad with-macos.

Note that pip install hidapi==0.10.1 does not have the issue, so it must have been fixed there.

@ipatch when installing FreeCAD with brew install freecad, I can run FreeCad from any folder on the shell. When installing FreeCAD with --with-macos, FreeCAD is not found in my path. However, symlinking /usr/local/opt/freecad/FreeCAD.app to /Applications/FreeCAD.app shows FreeCAD in Finder and I'm able to start it from there.

I'm using the MacBookAir (M1) in case that can help narrow down the issue.

@ipatch
Copy link
Collaborator Author

ipatch commented Dec 25, 2020

@ithinuel

that's really interesting i compile freecad last night FreeCAD 0.19, Libs: 0.19R23529 (Git) using brew turned off the --with-macos build flag and everything installed as should, and am able to launch FreeCAD from an arbitrary directory, and haven't noticed any major breaking changes such as the issues i was coming across with, ie. PySide not being found, (more than likely due to path related issues).

that's interesting that the symlink trick/hack resolves the issue. makes me think somewhere there are some hardcoded paths in cmake related files in freecad or a dependency of freecad, or i could totally be off base. i guess what's even more interesting is i'm using macos mojave 10.14, so not sure if the symlink would resolve my issue. either way i'll give it recompile sometime today and see what i can figure out. i think enabling the --debug flag while i'm installing may speed things up a little as it will drop me in an interactive prompt while i can tweak settings and see what is going without have to restart the whole process from scratch. as it takes ~ 50 to 55 minutes to compile freecad on my box from start to finish 😞

@zenz
Copy link
Contributor

zenz commented Dec 26, 2020

@ithinuel @ipatch
I think while building Mac Bundle, it needs more dylib to fit for standard. if you have time, you can use otool -l to inspect what dylibs are needed with mac bundle app and what's needed for a command line app.

@DavidJJ
Copy link

DavidJJ commented Dec 26, 2020

Just FYI,

I just built FreeCad from brew on 2013 Macbook pro Big Sur.
Building without --with-macos-app works and am able to start .19
Building with --with-macos-app crashes but without any readable error message.

@zenz
Copy link
Contributor

zenz commented Jan 5, 2021

@ipatch @DavidJJ @ithinuel
Please test with new homebrew fomula,
It seems solve all current issues.

@ipatch
Copy link
Collaborator Author

ipatch commented Jan 5, 2021

@zenz

i'm still on mojave so installing custom deps such as qt take a significant amount of time ~ 20+ hours to build because the tap does not provide a bottle, i'm building pyside2 right now, and will reinstall freecad from a formula file i have with and without the option set. and post my results here.

FWIW i've cloned the freecad src repo and can build freecad without relying a a formula and have installed freecad outside of the homebrew prefix to allow for multiple installs, and enabling the macos app flag without using the formula file also resulted in an error on my system, so i was thinking the error was upstream, ie. something wrong with a cmake file, but could be wrong due to the fact that you say it's working.

@ithinuel
Copy link

ithinuel commented Jan 6, 2021

@zenz I ran:

brew remove freecad
brew bundle dump
brew bundle cleanup

That leaves me with:

$ brew list
antigen		hidapi		icu4c		libusb		lsusb		ncurses		open-ocd	wabt
confuse		htop		libftdi		libusb-compat	minicom		node		telnet

Then brew install freecad --with-macos-app results in

Last 15 lines from /Users/.../Library/Logs/Homebrew/freecad/01.cmake:
CMake Error at /usr/local/opt/shiboken2/lib/cmake/Shiboken2-5.15.2/shiboken_helpers.cmake:461 (message):
  The detected Python major version is not compatible with the Python major
  version which was used when Shiboken was built.

  Built with: '3.9' Detected: '.'
Call Stack (most recent call first):
  /usr/local/opt/shiboken2/lib/cmake/Shiboken2-5.15.2/Shiboken2Config.cpython-39-darwin.cmake:45 (shiboken_check_if_built_and_target_python_are_compatible)
  /usr/local/opt/shiboken2/lib/cmake/Shiboken2-5.15.2/Shiboken2Config.cmake:5 (include)
  cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake:25 (find_package)
  CMakeLists.txt:70 (SetupShibokenAndPyside)

brew install freecad does complete but freecad fails to start with [1] 71145 illegal hardware instruction freecad as its only output.

Finally, after removing freecad and bundle cleanup, brew install freecad --build-from-source yields the same result as brew install freecad --with-macos-app
Because I can no longer run FreeCAD, I guess that would qualify as a regression. :S

@zenz
Copy link
Contributor

zenz commented Jan 6, 2021

@ithinuel
Strange, your result just like mine before @vejmarie updated the formula
Please try manually install gettext first
brew intall gettext
then brew install --HEAD freecad --with-macos-app

@ipatch
Copy link
Collaborator Author

ipatch commented Jan 9, 2021

yeah unfortunately i'm still getting issues when enabling the below switch

-DFREECAD_CREATE_MAC_APP=ON
-- Installing: /usr/local/FreeCAD.app/Contents/share/Gui/Stylesheets/images_dark-light/up_arrow_lighter.svg
CMake Error at src/MacAppBundle/cmake_install.cmake:55 (file):
  file INSTALL cannot find
  "/opt/code/github/public/forks/freecad-git/freecad/src/MacAppBundle/import
  site": No such file or directory.
Call Stack (most recent call first):
  src/cmake_install.cmake:51 (include)
  cmake_install.cmake:68 (include)


make: *** [install] Error 1

this is the fork / branch i'm trying to build from,

https://github.com/ipatch/FreeCAD/tree/feature-touchscreen-multi-select

the above fork/branch builds and installs without any issues, but enabling the above cmake flag still produces errors.

@DavidJJ
Copy link

DavidJJ commented Jan 10, 2021 via email

@vejmarie
Copy link
Contributor

I'm still getting errors using brew install. the install runs, but startup fails. During initialization the error "UI file does not exist" occurred in /usr/local/Cellar/freecad/0.19pre/Mod/Draft/InitGui.py Please look into the log file for further information During initialization the error "UI file does not exist" occurred in /usr/local/Cellar/freecad/0.19pre/Mod/Arch/InitGui.py Please look into the log file for further information QWidget: Must construct a QApplication before a QWidget Abort trap: 6
On Sat, Jan 9, 2021 at 3:19 PM Chris @.***> wrote: yeah unfortunately i'm running into issues when enabling the below switch -DFREECAD_CREATE_MAC_APP=ON -- Installing:
/usr/local/FreeCAD.app/Contents/share/Gui/Stylesheets/images_dark-light/up_arrow_lighter.svg
CMake Error at src/MacAppBundle/cmake_install.cmake:55 (file): file INSTALL cannot find
"/opt/code/github/public/forks/freecad-git/freecad/src/MacAppBundle/import

site": No such file or directory. Call Stack (most recent call first): src/cmake_install.cmake:51 (include) cmake_install.cmake:68 (include) make: *** [install] Error 1 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Can you tell me with which command you installed FreeCAD ? Which command do you use to launch freecad ? Might be good also to have your environment variables (env)

@vejmarie
Copy link
Contributor

yeah unfortunately i'm still getting issues when enabling the below switch

-DFREECAD_CREATE_MAC_APP=ON
-- Installing: /usr/local/FreeCAD.app/Contents/share/Gui/Stylesheets/images_dark-light/up_arrow_lighter.svg
CMake Error at src/MacAppBundle/cmake_install.cmake:55 (file):
  file INSTALL cannot find
  "/opt/code/github/public/forks/freecad-git/freecad/src/MacAppBundle/import
  site": No such file or directory.
Call Stack (most recent call first):
  src/cmake_install.cmake:51 (include)
  cmake_install.cmake:68 (include)


make: *** [install] Error 1

this is the fork / branch i'm trying to build from,

https://github.com/ipatch/FreeCAD/tree/feature-touchscreen-multi-select

the above fork/branch builds and installs without any issues, but enabling the above cmake flag still produces errors.

I will have a look during the week ;)

@vejmarie
Copy link
Contributor

I just fixed that issue (sorry for the delay, got too many things to do at work). Please test latest PR and let me know before I close it !

@vejmarie vejmarie self-assigned this Apr 12, 2021
@vejmarie vejmarie linked a pull request Apr 12, 2021 that will close this issue
@ipatch
Copy link
Collaborator Author

ipatch commented Apr 12, 2021

awesome, give me a few. i'm going to have to build most if not all bottles from source unfortunately because i'm still running macos 10.14 mojave.

@johnmarinelli
Copy link

any updates on this? i am running into the same issue on MacOS Monterey when building from source and homebrew.

@ipatch
Copy link
Collaborator Author

ipatch commented Oct 14, 2022

any updates on this? i am running into the same issue on MacOS Monterey when building from source and homebrew.

what error are you running into?

@johnmarinelli
Copy link

johnmarinelli commented Oct 19, 2022

@ipatch so, when trying to build from source, I got the same issue as #142 (comment):
"I'm still getting errors using brew install. the install runs, but startup
fails.
During initialization the error "UI file does not exist" occurred in
/usr/local/Cellar/freecad/0.19pre/Mod/Draft/InitGui.py"

now, when I try brew install freecad (without --no-mac-app), I run into the error described here
Homebrew/homebrew-core#104008

I haven't been able to solve either of the issues.

@ipatch
Copy link
Collaborator Author

ipatch commented Oct 21, 2022

@johnmarinelli

hey john 👋, it seems you've more than likely run into a common runtime issue when building and running freecad.

if you're attempting to install freecad via brew install freecad -v and you see error messages in the console when opening a workbench such as the Draft workbench than more than likely you're freecad installation is unable to pick up on your site-packages installation of pyside and shiboken.

the homebrew-freecad tap uses tap specific and versioned formula of both shiboken and pyside. homebrew-core provides a pyside@2 version of pyside, but you're gunna want to make sure you have the tap (homebrew-freecad) version of pyside@5.15.5 installed.

i'm not sure if you're on intel or apple ARM (M1) but it shouldn't make a big difference other than build times, and path to the site-packages directories. as it takes ~ 60 minutes to build pyside2@5.15.5 on my late 2013 gen 4 i7 macbooks.

there's a couple of ways you can probably resolve your runtime issues,

  1. you could setup a PYTHONPATH environment variable for the shell if you plan on launching freecad from a terminal of your choosing. the PYTHONPATH needs to contain the path to the site-packages directory for the shiboken2@5.15.5 and pyside2@5.15.5
  2. if you're not familiar with setting up environment variables or locating the paths i'm referring you might try and run
brew link shiboken2@5.15.5 -v --force;
brew link pyside2@5.15.5 -v --force;

i hope all this helps you with your freecad installation.

unfortunately at this time there isn't an easy way to make brew install freecad/freecad/freecad -v just work ™️ out of the box quite yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants