Compiling on Mac

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
nyholku
Posts: 149
Joined: Wed Dec 28, 2016 4:18 pm

Compiling on Mac

Post by nyholku »

I followed instructions from here

https://www.freecadweb.org/wiki/CompileOnMac


(to the letter I hope) below is what failed.

This is on macOS HighSierra, below is what gcc (clang really, I guess) shows for version:

Code: Select all

 gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Xcode is 10.1 (10B61)

I guess this has something do with wrong Python version or something but if there is one thing
I dislike more than sorting out C toolchain it is sorting out Python toolchain so help would be greatly
appreciated.

Code: Select all


[ 11%] Building CXX object src/App/CMakeFiles/FreeCADApp.dir/PreCompiled.cpp.o
[ 11%] Linking CXX shared library ../../lib/libFreeCADApp.dylib
[ 11%] Built target FreeCADApp
Scanning dependencies of target FreeCADMainPy
[ 11%] Building CXX object src/Main/CMakeFiles/FreeCADMainPy.dir/MainPy.cpp.o
In file included from /Users/nyholku/FreeCAD/FreeCAD-git/src/Main/MainPy.cpp:48:
In file included from /Users/nyholku/FreeCAD/FreeCAD-git/src/Base/Exception.h:33:
In file included from /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:88:
/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:534:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register PyObject *obj,     /* Object */
    ^~~~~~~~~
/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:553:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register PyObject *obj      /* Object */
    ^~~~~~~~~
/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:575:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register const wchar_t *w,  /* wchar_t buffer */
    ^~~~~~~~~
/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:593:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register wchar_t *w,        /* wchar_t buffer */
    ^~~~~~~~~
In file included from /Users/nyholku/FreeCAD/FreeCAD-git/src/Main/MainPy.cpp:48:
In file included from /Users/nyholku/FreeCAD/FreeCAD-git/src/Base/Exception.h:33:
In file included from /usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:97:
/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:173:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register PyObject *obj,     /* string or Unicode object */
    ^~~~~~~~~
/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:174:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register char **s,          /* pointer to buffer variable */
    ^~~~~~~~~
/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:175:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register Py_ssize_t *len    /* pointer to length variable or NULL
    ^~~~~~~~~
/Users/nyholku/FreeCAD/FreeCAD-git/src/Main/MainPy.cpp:158:17: error: no matching function for call to 'PyString_AsStringAndSize'
                PyString_AsStringAndSize(pyPath, &basePath, &sz);
                ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:172:17: note: candidate function not viable: no known conversion from 'const char **' to 'char **' for 2nd argument
PyAPI_FUNC(int) PyString_AsStringAndSize(
                ^
/Users/nyholku/FreeCAD/FreeCAD-git/src/Main/MainPy.cpp:163:17: error: no matching function for call to 'PyString_AsStringAndSize'
                PyString_AsStringAndSize(fromUnicode, &basePath, &sz);
                ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:172:17: note: candidate function not viable: no known conversion from 'const char **' to 'char **' for 2nd argument
PyAPI_FUNC(int) PyString_AsStringAndSize(
                ^
7 warnings and 2 errors generated.
make[2]: *** [src/Main/CMakeFiles/FreeCADMainPy.dir/MainPy.cpp.o] Error 1
make[1]: *** [src/Main/CMakeFiles/FreeCADMainPy.dir/all] Error 2
make: *** [all] Error 2
MacBook-Pro:build nyholku$ 
wmayer
Founder
Posts: 20298
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Compiling on Mac

Post by wmayer »

There are two issues:
The first is that the register keyword is declared deprecated in newer C++ versions. But the compiler only prints a warning so it can be ignored for now. If you want to get rid of it then I recommend to switch to Python3.

The second issue is caused by a recent change for Python3.7 git commit 3ad9ee6fa. In order to continue just remove the const keyword.
Post Reply