FBX Python Bindings fails on Ubuntu because of undefined symbol xmlFree

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
As the title says, FBX Python Bindings fails on Ubuntu.
More precisely, FBX Python Bindings generates FbxCommon.py and fbx.so without any errors, but when I import FbxCommon.py from Python interpreter it fails because of the following exception.
>>> import FbxCommon
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/(my_workspace)/PythonBindings/build/Distrib/site-packages/fbx/FbxCommon.py", line 1, in <module>
from fbx import *
ImportError: /(my_workspace)/PythonBindings/build/Distrib/site-packages/fbx/fbx.so: undefined symbol: xmlFree
My build environment is as follow:
- OS: ubuntu 18.04.4 LTS
- Python: Python 3.8.3 (conda environment)
- SIP version: 4.19.3 (not the latest one because it is known that it correctly supports the '--sip-module'; https://forums.autodesk.com/t5/fbx-forum/cannot-manage-to-compile-python-fbx-2020-0-1-vs2017-with-py... )
- g++ version: g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
As I debugged this issue, I've found that this issue is strongly related to this topic.
The Makefile of Python bindings (PythonBindings/build/Python38_x64/Makefile) generated by sip has the following code in it.
LIBS = -L/(my_workspace)/sdk/lib/gcc/x64/release -lz -lxml2 /(my_workspace)/sdk/lib/gcc/x64/release/libfbxsdk.a
and it leads to the following command on build
.... ipfbxFbxDouble3.o sipfbxFbxDouble2.o sipfbxFbxDateTime.o sipfbxFbxDistance.o sipfbxFbxBlob.o -L/(my_workspace)/sdk/lib/gcc/x64/release -lz -lxml2 /(my_workspace)/sdk/lib/gcc/x64/release/libfbxsdk.a
However, it seems libfbxsdk.a has to reference xml2, so it should be specified before -lxml2 argument.
I solved this problem by editing SIP module script to generate Makefile like this.
LIBS = -L/(my_workspace)/sdk/lib/gcc/x64/release /(my_workspace)/sdk/lib/gcc/x64/release/libfbxsdk.a -lz -lxml2
but is there any better solution? It's a bit weird to do this every time I use FBX Python Bindings on ubuntu.
I tried to use SIP 4.19.22 but it didn't work.