Bug #1255

Updated by Knödlseder Jürgen almost 10 years ago

On Mac OS X, using macports I encountered a compilation problem related to swig and file permissions:

When calling make from the gamma lib directory, the compilation fails when building app_wrap
<pre> @
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -pipe -Os -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/include -I../inst/mwl/include -I../inst/cta/include -I../inst/lat/include -I../inst/com/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gammalib/app_wrap.cpp -o build/temp.macosx-10.9-x86_64-2.7/gammalib/app_wrap.o
gammalib/app_wrap.cpp:871:38: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
PyErr_Format(PyExc_RuntimeError, mesg);
^~~~
gammalib/app_wrap.cpp:2031:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
gammalib/app_wrap.cpp:2034:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
gammalib/app_wrap.cpp:11549:55: error: use of undeclared identifier 'SWIG_PyInstanceMethod_New'
{ (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
^
gammalib/app_wrap.cpp:11827:72: error: cannot initialize a member subobject of type 'swig_converter_func' (aka 'void *(*)(void *)') with an lvalue of type 'void *(void *, int *)':
different number of parameters (1 vs 2)
static swig_cast_info _swigc__p_GBase[] = { {&_swigt__p_GApplication, _p_GApplicationTo_p_GBase, 0, 0}, {&_swigt__p_GApplicationPar, _p_GApplicationParTo_p_GBase, 0, 0}, ...
^~~~~~~~~~~~~~~~~~~~~~~~~
gammalib/app_wrap.cpp:11827:136: error: cannot initialize a member subobject of type 'swig_converter_func' (aka 'void *(*)(void *)') with an lvalue of type 'void *(void *, int *)':
different number of parameters (1 vs 2)
static swig_cast_info _swigc__p_GBase[] = { {&_swigt__p_GApplication, _p_GApplicationTo_p_GBase, 0, 0}, {&_swigt__p_GApplicationPar, _p_GApplicationParTo_p_GBase, 0, 0}, {&_swig...
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
gammalib/app_wrap.cpp:11827:228: error: cannot initialize a member subobject of type 'swig_converter_func' (aka 'void *(*)(void *)') with an lvalue of type 'void *(void *, int *)':
different number of parameters (1 vs 2)
...0, 0}, {&_swigt__p_GApplicationPar, _p_GApplicationParTo_p_GBase, 0, 0}, {&_swigt__p_GBase, 0, 0, 0}, {&_swigt__p_GContainer, _p_GContainerTo_p_GBase, 0, 0}, {&_swigt__p...
^~~~~~~~~~~~~~~~~~~~~~~
gammalib/app_wrap.cpp:11827:291: error: cannot initialize a member subobject of type 'swig_converter_func' (aka 'void *(*)(void *)') with an lvalue of type 'void *(void *, int *)':
different number of parameters (1 vs 2)
...0, 0}, {&_swigt__p_GBase, 0, 0, 0}, {&_swigt__p_GContainer, _p_GContainerTo_p_GBase, 0, 0}, {&_swigt__p_GApplicationPars, _p_GApplicationParsTo_p_GBase, 0, 0},{0, 0, 0, 0}};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gammalib/app_wrap.cpp:11919:14: warning: explicitly assigning a variable of type 'void *' to itself [-Wself-assign]
clientdata = clientdata;
~~~~~~~~~~ ^ ~~~~~~~~~~
4 warnings and 5 errors generated.
error: command '/usr/bin/clang' failed with exit status 1
make[3]: *** [build] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
</pre>

@
It is not clear to me where this problem is coming from, but it might be related to file permissions. If you run a "sudo make" instead of a "make", the compilation proceeds without any problems. Even the clang command to build app_wrap is exactly the same, and was also cross-checked with an independent compilation on Christophs machine.

I've traced the problem as far as to the files, where SWIG_AddCast() is declared(?). The files are called pycomplex.py, pyprimtypes.py and pyrun.swg and are located in the /opt/local/share/swig/3.0.2/python folder of macports.

Back