PlusToolkit/ndicapi

Python package build fails due to missing Polaris module file

dzhoshkun opened this issue · 7 comments

Running python setup.py build yields:

[0] % python setup.py build
running build
running build_ext
building 'polaris' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ndicapi.c -o build/temp.macosx-10.12-intel-2.7/ndicapi.o
clang: error: no such file or directory: 'ndicapi.c'
clang: error: no input files
error: command 'cc' failed with exit status 1

This problem can be solved by changing the file extensions in setup.py from *.c to *.cxx

Then the following error comes up:

cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ndicapi.cxx -o build/temp.macosx-10.12-intel-2.7/ndicapi.o
In file included from ndicapi.cxx:39:
./ndicapi.h:43:10: fatal error: 'ndicapiExport.h' file not found
#include "ndicapiExport.h"

This can be resolved by cmakeing the project, which generates the missing ndicapiExport.h file from the corresponding template file (obviously, this ndicapiExport.h file needs to be copied to the main project folder where python setup.py build is run).

Subsequently the compilation fails due to:

cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ndicapi_thread.cxx -o build/temp.macosx-10.12-intel-2.7/ndicapi_thread.o
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c polarismodule.c -o build/temp.macosx-10.12-intel-2.7/polarismodule.o
clang: error: no such file or directory: 'polarismodule.c'
clang: error: no input files

The polarismodule.c file is missing from the repository.
I was able to locate this file in the AIGS repository, which seems to have been committed in 2005, i.e. very old.

This PlusToolkit repository however is pretty up-to-date.
So I was wondering whether the polarismodule.c file was excluded due to any particular reason?

I'm on a MacBook Pro with macOS Sierra (Version 10.12.6) with Python 2.7.10 and CMake 3.7.2

Just goes to show... I had no idea there was even a python file in the repository!

I will apply your fixes and try and get this working.

After investigating, my conclusion is that the current python interface is dead. I will investigate if there are any more modern ways of wrapping C with python.

I was able to make some progress resurrecting the python interface. It is currently only a python2 extension module, and I've added some CMake to guard against that.

I am not familiar with python wrapping of C, so the compilation currently fails with the bitfield concept that David Gobbi implemented ages ago. If anyone is willing to fix it, that would be great.

@adamrankin Could you please provide more details about:

I am not familiar with python wrapping of C, so the compilation currently fails with the bitfield concept that David Gobbi implemented ages ago.

I will try to spare some time to have a more in-depth look at this.

Also, thanks for the quick reply!

If you run setup.py again you will see the compilation errors. I am not familiar with the syntax of c python extensions.

This issue has been fixed now.
The module can be built and installed.
So closing this issue.

I'm trying to get it to actually work.
This is the current status: dzhoshkun#4 (comment)