Problem Compiling Python 3.7 FBX Modules with FBX 2020.0.1 bindings

Problem Compiling Python 3.7 FBX Modules with FBX 2020.0.1 bindings

master_cranky
Participant Participant
4,316 Views
12 Replies
Message 1 of 13

Problem Compiling Python 3.7 FBX Modules with FBX 2020.0.1 bindings

master_cranky
Participant
Participant

I'm on Windows 10,

I'm attempting to generate a Python 37 (64bit) version of the fbx modules.

- Using Python 3.7.3 (from Python.org)

- Using the FBX Python Bindings for windows (2020.0.1)

- Using sip-4.19.3 package (which the install instructions suggest) -- but have also tried the sip-4.19.20.

 

I am unable to complete the build of the python3_x64 build and am unsure how to proceed.   There are 9 errors during the run that look like the following:

.\sipfbxFbxBindingTableBase.cpp(55): error C3668: 'sipFbxBindingTableBase::Clone': method with override specifier 'override' did not override any base class methods

Ultimately ending the script run with the following NMAKE message:

 

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\cl.EXE"' : return code '0x2'


I realize this is new for Autodesk to supply these files -- so not sure if anyone has successfully compiled the items in the wild.  Any suggestions / hints would be welcome.  Would love to leave the Python 3.3 world to the past :).

4,317 Views
12 Replies
Replies (12)
Message 2 of 13

master_cranky
Participant
Participant

So after redoing all the steps it worked.

 

So going to chalk it up to a win.  Nothing magical had to be done that I know of -- I likely missed a step or maybe confused things by attempting to switch to 4.19.3 / 4.19.20.   In the end I used the 4.19.3 from scratch and haven't yet tried the later one... off to see which unit tests fail on 3.7 :)..... 


0 Likes
Message 3 of 13

master_cranky
Participant
Participant

So its likely still user error -- but after a bit of further testing I realized that the GetEntry() function dealing with BindingTables is failing to run and will cause an exception that doesn't bubble up to Python -- instead it just exits with a non zero number.

I also went back to the build steps and didn't notice it at first, but some tests are failing.   Starting to tinker around, but hoping to hear of someone else trying and succeeding with building a version with the Autodesk Python Bindings :).

One additional note I didn't include in the original post was that I used VS 2015 to build as it is also mentioned in some of the files. 

0 Likes
Message 4 of 13

master_cranky
Participant
Participant

Still stuck -- here is one of the stack traces once the "pythonbindings.py Python3_x64 buildsip test" is run. 

Traceback (most recent call last):
  File "ImportScene.py", line 204, in <module>
    DisplayContent(lScene)
  File "ImportScene.py", line 62, in DisplayContent
    DisplayNodeContent(lNode.GetChild(i))
  File "ImportScene.py", line 77, in DisplayNodeContent
    DisplayNurb(pNode)
  File "T:\2020.0.1\build\Python37_x64\samples\ImportScene\DisplayNurb.py", line 128, in DisplayNurb
    DisplayShape(lNurb)
  File "T:\2020.0.1\build\Python37_x64\samples\ImportScene\DisplayShape.py", line 59, in DisplayShape
    lNormals = lShape.GetLayer(0).GetNormals().GetDirectArray()
AttributeError: 'NoneType' object has no attribute 'GetNormals'

 

0 Likes
Message 5 of 13

Anonymous
Not applicable

I get the same error in sipfbxFbxBindingTable.cpp when building for Linux (Debian 9):

 

sipfbxFbxBindingTable.cpp:56:10: error: ‘bool sipFbxBindingTable::SetUrl(char*)’ marked ‘override’, but does not override

 

I can work around this by removing the virtual keyword from FbxManager::GetIOSettings and FbxObject::Clone. After that it does build and seems to work. Needless to say that is an ugly hack I'm not comfortable with.

 

I also got a different error:

python3 PythonBindings.py Python3_x64

sip: /tmp/fbx2020/fbxpy/sip/fbxtypes.sip:31: syntax error

 

This cryptic message is triggered by this line:

typedef unsigned int size_t;

 

The problem is that size_t is already defined, so this typedef is not allowed. I can work around it by commenting out the typedef, but it's another ugly hack. I don't know sip well enough to know why this is already defined in my case. Possibly I need to try different version (using 4.19.18).

0 Likes
Message 6 of 13

Anonymous
Not applicable

One other note here - the python3 bindings that can be built with the new FBX2020 bindings generate a debug builds, not optimized builds. So for example:

python3 PythonBindings.py Python3_x64
g++ -c -g -O2 [...]

Ideally the -g should not be there.

Having -g makes the generated fbx.so 10 times bigger than it should be (100MB vs 10MB) and also presumably it will run slower too.

0 Likes
Message 7 of 13

master_cranky
Participant
Participant

Thanks for also looking into this and sharing your experience.  I also had some of the issues you mentioned, but when trying again with an earlier SIP I was able to compile -- but had tests that failed. 

With

- windows 10 machine, with

- Python 3.7.3 and

- VS2015 and

- sip 4.19.3 and

- Python FBX / Python Bindings FBX 2020.1

I should also mention that I had to 'subst t: for the c:\program files\....' where the bindings were installed as the scripts would fail on the spaces otherwise.  Using t:\ instead allowed the script to run.

 

The resulting fbx.pyd file is just under 10mb - so the compile flag you noticed on Linux is likely not there for Windows.

 

The shipping tests that come with the bindings fail though.  Also, my personal scripts that work in the 3.3 flavour also fail with this newly minted one for 3.7 when accessing the GetEntry method found in the C:\Program Files\Autodesk\FBX\FBX Python Bindings\2020.0.1\build\Python37_x64\sipfbxFbxBindingTableBase.cpp result.   I haven't had enough time to figure out yet how the .cpp file is being generated to investigate further.   Instead of returning the result -- it crashes out with a non positive number.

0 Likes
Message 8 of 13

fabien.danieau
Observer
Observer

Hi,

 

I have the same syntax error with sip on Debian 10, and python 3.7.

 


@Anonymous wrote:

I also got a different error:

python3 PythonBindings.py Python3_x64

sip: /tmp/fbx2020/fbxpy/sip/fbxtypes.sip:31: syntax error

 


Any update on this?

Thanks a lot.

0 Likes
Message 9 of 13

fabien.danieau
Observer
Observer

I was able to compile the bindings using sip 4.19.3 as suggested in the README (https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.3/)

 

0 Likes
Message 10 of 13

giri
Observer
Observer

Hey,

 

I'm getting this same error.

 

python3 PythonBindings.py Python3_x64

sip: /tmp/fbx2020/fbxpy/sip/fbxtypes.sip:31: syntax error

 

Did you happen to find a way around it? Please help.

 

I'm on Ubuntu 20.04 and I'm not able to move past this.

0 Likes
Message 11 of 13

fabien.danieau
Observer
Observer

Hey,

 

Make sure you have downloaded sip 4.19.3, it is not going to work with another version.

Then defined the SIP_ROOT environment variable and use buildsip option (see readme.txt)

 

Good luck.

0 Likes
Message 12 of 13

giri
Observer
Observer

Hey,

 

This worked. Thank you so very much 🙂

0 Likes
Message 13 of 13

master_cranky
Participant
Participant

It _works_ only in very limited circumstances.

 

If you run the supplied tests that ship with bindings they fail.   I have unittests on my own code and it works with the 2.7 version, but will fail on this compiled version.   Until a new version comes out -- I would not recommend using this tool unless you are doing some really simple parsing, but introspection into the binding tables or manipulation of data will likely lead to confusing or misleading or hidden errors.   That being said - I haven't tried re-downloading the bindings since my original post and maybe it was updated?

 

If you run the tests and there are no failures in the logs I'd be interested to know.

0 Likes