can we use conda for building/debuging localy modified freecad files?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
danreb
Posts: 45
Joined: Wed Mar 14, 2018 7:27 pm

can we use conda for building/debuging localy modified freecad files?

Postby danreb » Mon Oct 07, 2019 7:25 am

Hi
from https://github.com/FreeCAD/FreeCAD_Cond ... develop.md
it seams that we could use the conda_build sytem to build our localy freecad modified sources.

.... but this file and its specifications needs to be updated to reflect the last updates made to this repo.


So using conda,
  1. is there a way we can build freecad from localy cloned FreeCAD/FreeCAD git sources?
  2. as wel could we build the same for debuging our local Freecad sources in developpment?
In another word how can we use the conda build system for managing our local freecad dev/debug environment.

Thanks for any help
looo
Posts: 2894
Joined: Mon Nov 11, 2013 5:29 pm

Re: can we use conda for building/debuging localy modified freecad files?

Postby looo » Mon Oct 07, 2019 10:04 am

Depending on your platform different preparation is necessary to build locally:
For linux it's best to install docker.
For windows you need a recent visual studio compiler.
For osx a macosx sdk is necessary.

Incremental builds for debugging is something more difficult as it is not really supported. Ideally conda adds support for this and ide's get aware of environments.
You can setup everything manually but this is a lot of work and far from easy. If all you want is python-development you can simple replace the files you want to modify (eg.: via link)
please help with my conda-packaging efforts: https://liberapay.com/looooo/
looo
Posts: 2894
Joined: Mon Nov 11, 2013 5:29 pm

Re: can we use conda for building/debuging localy modified freecad files?

Postby looo » Mon Oct 07, 2019 1:50 pm

looo wrote:
Mon Oct 07, 2019 10:04 am
Incremental builds for debugging is something more difficult as it is not really supported. Ideally conda adds support for this and ide's get aware of environments.
You can setup everything manually but this is a lot of work and far from easy. If all you want is python-development you can simple replace the files you want to modify (eg.: via link)
After some research I found a tool that I think will help with getting started with incremental builds. It's called "conda debug" [1] and is very similar to "conda build" but only gathers all the dependencies and surces. Building has to be done manually by calling "bash conda_build.sh"

For linux (ubuntu) I had to modify the recipe a bit to work. Somehow there are still some system libraries used which are in /usr/lib64 for centos and on /usr/lib/x86.... for ubuntu. So I simple created a link from the latter to the first to get rid of these cmake errors. The other change was regarding opengl library not found. Here a toolchain file for cmake helped to solve the problem [2].

But now it's happily building and I guess doing a git pull in the work directory and afterwards again call "bash conda_build.sh" will only build the updated libraries.

So you see, support for incremental building is coming and c++ ide's will hopefully accept the importance of virtual envs.

[1] https://docs.conda.io/projects/conda-bu ... gging.html?
[2] https://github.com/AnacondaRecipes/free ... inux.cmake
please help with my conda-packaging efforts: https://liberapay.com/looooo/
looo
Posts: 2894
Joined: Mon Nov 11, 2013 5:29 pm

Re: can we use conda for building/debuging localy modified freecad files?

Postby looo » Mon Oct 07, 2019 3:50 pm

Here is a screencast showing how to setup the developmeent environment on linux (ubuntu):
https://vimeo.com/364817445
please help with my conda-packaging efforts: https://liberapay.com/looooo/
danreb
Posts: 45
Joined: Wed Mar 14, 2018 7:27 pm

Re: can we use conda for building/debuging localy modified freecad files?

Postby danreb » Mon Oct 07, 2019 5:36 pm

many thanks looo for your explanations (.... and for all the FreeCAD conda work you did).

By the way, I am working on macos. I've installed the SDK as per your advices https://github.com/FreeCAD/FreeCAD_Cond ... .md#macosx.

I'll have a look and try what you've highlighted on my mac environment.
danreb
Posts: 45
Joined: Wed Mar 14, 2018 7:27 pm

Re: can we use conda for building/debuging localy modified freecad files?

Postby danreb » Mon Oct 07, 2019 6:20 pm

the conda debug cmd

Code: Select all

conda debug . -m .ci_support/osx_python3.7.yaml
actually worked

Code: Select all

....
source tree in: /Users/bbl/miniconda/conda-bld/debug_1570470681145/work
################################################################################
Test environment created for debugging.  To enter a debugging environment:

cd /Users/bbl/miniconda/conda-bld/debug_1570470681145/work && source /Users/bbl/miniconda/conda-bld/debug_1570470681145/work/build_env_setup.sh

To run your tests, you might want to start with running the conda_test_runner.sh file.
################################################################################
have to test further by running the sh file
looo
Posts: 2894
Joined: Mon Nov 11, 2013 5:29 pm

Re: can we use conda for building/debuging localy modified freecad files?

Postby looo » Mon Oct 07, 2019 7:34 pm

danreb wrote:
Mon Oct 07, 2019 5:36 pm
By the way, I am working on macos.
Nice, I think osx should work similar to Linux. I will try the same on Windows. Would be nice to have a cross platform way to setup a development environment for freecad.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
danreb
Posts: 45
Joined: Wed Mar 14, 2018 7:27 pm

Re: can we use conda for building/debuging localy modified freecad files?

Postby danreb » Mon Oct 07, 2019 8:54 pm

had an error with osx sdk running

Code: Select all

 # under the build_env 
 bash conda_build.sh
ninja: error: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AppKit.framework', needed by 'Mod/Import/Import.so', missing and no known rule to make it
rm: /Users/bblockmans/miniconda/conda-bld/debug_1570470681145/_h_env/share/doc/FreeCAD: No such file or directory
since Mod/Import/Import.so is refering tho the file
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AppKit.framework
, and since I don't have xcode installed but just the /opt/MacOSX10.9.sdk, I've created the directory hierarchy
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

and then simlinked to the sdk

Code: Select all

ln -s /opt/MacOSX10.9.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
.... the build is now running!

I'll check tomorrow if the result is OK and go on following what you've suggested on your vimeo.

thanks
danreb
Posts: 45
Joined: Wed Mar 14, 2018 7:27 pm

Re: can we use conda for building/debuging localy modified freecad files?

Postby danreb » Tue Oct 08, 2019 5:21 am

OK the build has ended.

I just have on all bunch of the same error " ...file already has LC_RPATH ... " on install time
-- Installing: /Users/bbl/miniconda/conda-bld/debug_1570470681145/_h_env/lib/Spreadsheet.so
error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: for: /Users/bbl/miniconda/conda-bld/debug_1570470681145/_h_env/lib/Path.so (for architecture x86_64) option "-add_rpath /Users/bbl/miniconda/conda-bld/debug_1570470681145/_h_env/lib" would duplicate path, file already has LC_RPATH for: /Users/bbl/miniconda/conda-bld/debug_1570470681145/_h_env/lib
but this seams OK to me since the LC_PATH exists and the buils could apparently go on?

finaly , just like in your vimeo, I had to add 2 missing modules as highlighted by launching FreeCAD
During initialization the error "No module named 'numpy'" occurred in /Users/bbl/Library/Preferences/FreeCAD/Mod/A2plus/InitGui.py
Please look into the log file for further information
During initialization the error "No module named 'six'" occurred in /Users/bbl/Library/Preferences/FreeCAD/Mod/flamingo/InitGui.py
Please look into the log file for further information
No module named 'six'
after that I could launch FreeCAD and succesfully test some of its features.

Just have a systematic "segmentation fault" error
objc[34939]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fffa0db13d8) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x131748f50). One of the two will be used. Which one is undefined.
Segmentation fault: 11
when opening one of my basic test file, but I'll check on the conda "daily build" to see if I can reproduce this last error.

Many thanks for the explainations.

for a better understanding off this all, I'll have to play and test it a bit further. But it looks really cool and promising.

Cheers
looo
Posts: 2894
Joined: Mon Nov 11, 2013 5:29 pm

Re: can we use conda for building/debuging localy modified freecad files?

Postby looo » Tue Oct 08, 2019 6:08 am

Btw.: The docs are a bit out of date... We switched to osx sdk 10.12 recently due to qt5.12 https://github.com/looooo/freecad-feeds ... ig.yaml#L6

There are several topics to explore now:
- possibility to create a package from a incremental build (would allow to share a development snapshot, without building the whole package)
- ide setup and integration
please help with my conda-packaging efforts: https://liberapay.com/looooo/