ilveroluca/rapi — pull request #1 by brainstorm (2014-07-31 12:28:33+00:00)
Title: Fixed clang compilation error and warning. SWIG segfaults on OSX

Now compiles on OSX but SWIG segfaults too:

It seems that OSX is somehow terribly broken when importing python libraries… perhaps anaconda and the installed system python on OSX machines do not play well with each other:

https://github.com/brainstorm/facs/commit/d75fb0a3a3e428

```
$ python -c ”import facs”
Segmentation fault: 11 (core dumped)
$ lldb -c /cores/core.71957
(lldb) bt
* thread #1: tid = 0x0000, 0x0000000000000000, stop reason = signal SIGSTOP
* frame #0: 0x0000000000000000
frame #1: 0x000000010068637d Python`PyEval_GetGlobals + 23
frame #2: 0x000000010064b9ed Python`___lldb_unnamed_function1014$$Python + 954
frame #3: 0x000000010064b0f9 Python`___lldb_unnamed_function1007$$Python + 50
frame #4: 0x00000001002f497b _facs.so`init_facs + 75 at facs_wrap.c:4117	<---------------
frame #5: 0x00000001000e5082 libpython2.7.dylib`_PyImport_LoadDynamicModule + 178
frame #6: 0x00000001000e499a libpython2.7.dylib`imp_load_module + 186
frame #7: 0x00000001000c8f49 libpython2.7.dylib`PyEval_EvalFrameEx + 24313
```

With this I got it to compile on both linux and OSX:

https://github.com/brainstorm/facs/commit/fdefb493765fb

And after leaving a single line SWIG interface:

https://github.com/brainstorm/facs/commit/5094dcabb92

It seems obvious that something very broken is going on on OSX+python(+anaconda?), since it segfaults on my macbook air, and "works perfectly” (imports without segfaulting at least) on a Linux cluster:

```
[roman@milou-b facs 0]$ python
Python 2.7.6 (default, Feb 3 2014, 13:20:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import facs
dir(facs)
['SWIG_PyInstanceMethod_New', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_facs', '_newclass', '_object', '_swig_getattr', '_swig_property', '_swig_repr', '_swig_setattr', '_swig_setattr_nondynamic']
```

@guillermo-carrasco or @trufae any hints on this strange OSX-SWIG-python segfault?

@trufae, don't panic. There is another project called "rapi" that is not "Radare API" out there ;P