[solved] FreeCADBase cannot be compiled

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCADBase cannot be compiled

Post by uwestoehr »

wmayer wrote: Tue Sep 17, 2019 11:13 am Therefore you must start x64 Native Tools Command Prompt from the Start menu...
Many thanks! I did everything but the result is again the same:

Code: Select all

D:\FreeCAD-build-nmake\src\Base\AxisPy.cpp(167): error C2039: "getPyExceptionType": is no element of "Base::Exception"
d:\freecadgit\src\base\Exception.h(85): note: see declaration of "Base::Exception"
...
But I think I found the problem:

However, when I analyze the first error message:

Code: Select all

2>QuantityPyImp.cpp
2>d:\freecad-build\src\base\quantitypy.cpp(225): error C2039: 'getPyExceptionType': is not a member of 'Base::Exception'
2>d:\freecadgit\src\base\exception.h(85): note: see declaration of 'Base::Exception'
I see that getPyExceptionType is not a member of of 'Base::Exception' but of of 'Base::PyException'. 'Base::PyException is defined in Interpreter.h, but QuantityPy.cpp does not include Interpreter.h.
QuantityPy.cpp is generated by src/Tools/generateTemaplates/templateClassPyExport.py.

So it seems there is an issue in templateClassPyExport.py.
The relevant exception code there was introduced with commit git commit 8ecee3c413177093720a65c7626451ce3ffc8033
I reverted the changes from this commit and then I can compile QuantityPyImp.cpp and quantitypy.cpp. Then I get of course other compilation errors, but at least I got an idea where the problem lies.

Realthunder, could you please have a look?
realthunder wrote: Mon Sep 16, 2019 10:25 am
-------

Besides this, could the CMake option "BUILD_QT5" be enabled by default?
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCADBase cannot be compiled

Post by wmayer »

I see that getPyExceptionType is not a member of of 'Base::Exception' but of of 'Base::PyException'.
No, it's a member of Base::Exception, see: https://github.com/FreeCAD/FreeCAD/blob ... ion.h#L130
So it seems there is an issue in templateClassPyExport.py.
Could it be that you once did an in-source build and now an out-of-source build? The problem when doing an in-source build is that all the generated source files still exist and when later doing an out-of-source build it happens that the old and wrong files are included.
So, you must make sure that your local repository is free of generated files. You can check it with git status
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCADBase cannot be compiled

Post by sgrogan »

wmayer wrote: Tue Sep 17, 2019 10:47 pm You can check it with git status
Also check the .gitignore files https://github.com/FreeCAD/FreeCAD/blob ... .gitignore
I've polluted my source with CMakeFiles/ before.
"fight the good fight"
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: FreeCADBase cannot be compiled

Post by realthunder »

uwestoehr wrote: Tue Sep 17, 2019 10:35 pm

Code: Select all

d:\freecadgit\src\base\Exception.h(85): note: see declaration of "Base::Exception"
...
The line number 85 here indicates that you are somehow using the Exception.h source code before the big merge. Any clue why?
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCADBase cannot be compiled

Post by uwestoehr »

realthunder wrote: Tue Sep 17, 2019 11:22 pm The line number 85 here indicates that you are somehow using the Exception.h source code before the big merge. Any clue why?
Many thanks for having a look.
Indeed, there is something fishy. Yesterday I explicitly cleaned my local-git and forced a rebase to current master but nevertheless I got an old version of Exception.h. I remember that a week ago I got tons of merge conflicts after I checked out master after the big link object merge. I thought I resolved all by using the version from FC's upstream master but obviously there went something wrong.
So I will reset my local Git of FC's master this evening from scratch.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: FreeCADBase cannot be compiled

Post by openBrain »

uwestoehr wrote: Wed Sep 18, 2019 9:52 am So I will reset my local Git of FC's master this evening from scratch.
Maybe you can reset your local master with :

Code: Select all

git reset --hard upstream/master
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCADBase cannot be compiled

Post by uwestoehr »

openBrain wrote: Wed Sep 18, 2019 10:16 am Maybe you can reset your local master with :

Code: Select all

git reset --hard upstream/master
Many thanks to you all.

I did a hard reset but rebasing later on gave me e.g. a version of Exception.h from January.
Now I just upgraded my Git installation and voila! everything works now, also rebasing.

So eventually I can compile FreeCADBase.
wmayer wrote:
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: FreeCADBase cannot be compiled

Post by openBrain »

I don't really understand what and why you are trying to rebase, but maybe this isn't so important. :)
I wonder if you're not doing something weird with git commands... :lol:
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: FreeCADBase cannot be compiled

Post by uwestoehr »

openBrain wrote: Wed Sep 18, 2019 10:14 pm I wonder if you're not doing something weird with git commands... :lol:
I cannot remember names and also not commands. Therefore I hate consoles and commands 8-) thus I use TortoiseGit:
https://tortoisegit.org/docs/tortoisegi ... ebase.html
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCADBase cannot be compiled

Post by vocx »

uwestoehr wrote: Wed Sep 18, 2019 10:55 pm I cannot remember names and also not commands. Therefore I hate consoles and commands 8-) thus I use TortoiseGit:
https://tortoisegit.org/docs/tortoisegi ... ebase.html
I recommend you read Source code management. It has an introduction to using Git with FreeCAD in particular. I think it's important that you understand the basics of creating branches, switching to them, committing code to a branch, and then pushing that branch online, with the intention of merging it into the upstream repository. In this way you never touch your master branch.

The Source code management page points you to the specific chapters in the Pro Git book which explain with more detail the commands. Once you are familiar with those commands, then you can use graphical tools like gitk, GitKraken, TortoiseGit, and whatever more comfortably.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Post Reply