facebookresearch / mmf

A modular framework for vision & language multimodal research from Facebook AI Research (FAIR)
https://mmf.sh/
Other
5.51k stars 938 forks source link

compile cphoc.c #1011

Open linxi1158 opened 3 years ago

linxi1158 commented 3 years ago

❓ Questions and Help

How to compile cphoc.c file?

~/Documents/code/mmf-master/mmf/utils/phoc/src  gcc -c -fPIC python-config --cflags cphoc.c cphoc.c:49:53: warning: format string is not a string literal (potentially insecure) [-Wformat-security] return PyErr_Format(PyExc_RuntimeError, error_msg); ^~~~~ cphoc.c:49:53: note: treat the string as an argument to avoid this return PyErr_Format(PyExc_RuntimeError, error_msg); ^ "%s", cphoc.c:31:13: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] int n = strlen(word); ~ ^~~~ cphoc.c:135:5: error: use of undeclared identifier 'PyModuleDef_HEAD_INIT' PyModuleDef_HEAD_INIT, ^ cphoc.c:134:27: error: variable has incomplete type 'struct PyModuleDef' static struct PyModuleDef cphoc = { ^ cphoc.c:134:15: note: forward declaration of 'struct PyModuleDef' static struct PyModuleDef cphoc = { ^ cphoc.c:145:12: error: implicit declaration of function 'PyModule_Create' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return PyModule_Create(&cphoc); ^ cphoc.c:145:12: note: did you mean '_PyModule_Clear'? /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/moduleobject.h:19:18: note: '_PyModule_Clear' declared here PyAPI_FUNC(void) _PyModule_Clear(PyObject *); ^ 2 warnings and 3 errors generated. ✘  ~/Documents/code/mmf-master/mmf/utils/phoc/src  ls cphoc.c ~/Documents/code/mmf-master/mmf/utils/phoc/src  ls cphoc.c ~/Documents/code/mmf-master/mmf/utils/phoc/src  vi cphoc.c

hackgoofer commented 3 years ago

Hi @linxi1158, thanks for using mmf,

Do you mind letting me know what you are trying to do? If you are curious about how to install mmf, please follow the instructions here

linxi1158 commented 3 years ago

Because I want to extract the PHOC features separately, I need to compile the cphoc.c file, the source code can be compiled, but mmf is not

apsdehal commented 3 years ago

@linxi1158 it would be easier to install MMF and just import and use PhocProcessor directly from it in your project.