Closed RasmusFonseca closed 6 years ago
It looks like OSX + Python 2.7 is broken in some way, as my Travis CI builds do this too. I can't debug this without a stack trace at minimum, and probably can't at all without a mac. Can you use Python 3.6?
The base environment is 3.6.4. Would this be a useful stack-trace:
MBPro:~/Programs $ python --version
Python 3.6.4 :: Anaconda, Inc.
MBPro:~/Programs $ lldb -- python -c "import vmd"
(lldb) target create "python"
Current executable set to 'python' (x86_64).
(lldb) settings set -- target.run-args "-c" "import vmd"
(lldb) r
Process 75708 launched: '/Users/rfonseca/anaconda3/bin/python' (x86_64)
Process 75708 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x25)
frame #0: 0x0000000208f2eabb libpython3.6m.dylib`PyUnicode_InternInPlace + 107
libpython3.6m.dylib`PyUnicode_InternInPlace:
-> 0x208f2eabb <+107>: movb 0x25(%rax), %r15b
0x208f2eabf <+111>: movq 0x1d1aa2(%rip), %rax ; _PyThreadState_Current
0x208f2eac6 <+118>: movb $0x1, 0x25(%rax)
0x208f2eaca <+122>: movq %rbx, %rsi
Target 0: (libvmd.so) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x25)
* frame #0: 0x0000000208f2eabb libpython3.6m.dylib`PyUnicode_InternInPlace + 107
frame #1: 0x0000000208fafc5f libpython3.6m.dylib`PyImport_Import + 351
frame #2: 0x0000000208fb106c libpython3.6m.dylib`PyImport_ImportModule + 28
frame #3: 0x000000020597cee4 libvmd.so`get_vmdapp() + 16
frame #4: 0x00000002059854d6 libvmd.so`PyInit_vmd + 22
frame #5: 0x000000010018e749
frame #6: 0x000000010018dddc
frame #7: 0x000000010008b562
frame #8: 0x0000000100161a10
frame #9: 0x0000000100154589
frame #10: 0x00000001001636aa
frame #11: 0x00000001001632ac
frame #12: 0x0000000100160f4c
frame #13: 0x00000001001635fc
frame #14: 0x00000001001632ac
frame #15: 0x0000000100160f4c
frame #16: 0x00000001001635fc
frame #17: 0x00000001001632ac
frame #18: 0x0000000100160f4c
frame #19: 0x00000001001635fc
frame #20: 0x00000001001632ac
frame #21: 0x0000000100160f4c
frame #22: 0x00000001001635fc
frame #23: 0x00000001001632ac
frame #24: 0x0000000100160f4c
frame #25: 0x0000000100154589
frame #26: 0x00000001001636aa
frame #27: 0x00000001001632ac
frame #28: 0x0000000100160f4c
frame #29: 0x0000000100154589
frame #30: 0x000000010014ed99
frame #31: 0x000000010008b562
frame #32: 0x0000000100161a10
frame #33: 0x0000000100154589
frame #34: 0x00000001001636aa
frame #35: 0x00000001001632ac
frame #36: 0x0000000100160f4c
frame #37: 0x00000001001635fc
frame #38: 0x00000001001632ac
frame #39: 0x0000000100160f4c
frame #40: 0x00000001001635fc
frame #41: 0x00000001001632ac
frame #42: 0x0000000100160f4c
frame #43: 0x00000001001635fc
frame #44: 0x00000001001632ac
frame #45: 0x0000000100160f4c
frame #46: 0x0000000100163d4f
frame #47: 0x0000000100009e80
frame #48: 0x00000001000130da
frame #49: 0x0000000100188674
frame #50: 0x000000010015ee17
frame #51: 0x0000000100154589
frame #52: 0x00000001001af599
frame #53: 0x00000001001af437
frame #54: 0x00000001001d1b16
frame #55: 0x0000000100001e7d
frame #56: 0x00007fffa8b23235
(lldb)
If not I'll come by with a mac tomorrow.
Okay I have added a flag to the build process that will build the main library (not the plugins though) with debug symbols.
git clean -fdx
git pull
python setup.py build --debug
python setup.py install
Load that up into the debugger and you'll get a more helpful stack trace. All of the source files live in vmd/vmd_src/src.
Still haven't managed to get debug symbols or resolve the issue, but I noticed something strange when building:
LIB: libtcl8.5.dylib -> /usr/lib
INC: tcl.h -> /Users/rfonseca/anaconda3/envs/py36_np1.13.3/include
LIB: libsqlite3.dylib -> /Users/rfonseca/anaconda3/envs/py36_np1.13.3/lib
INC: sqlite3.h -> /Users/rfonseca/anaconda3/envs/py36_np1.13.3/include
LIB: libexpat.dylib -> /Users/rfonseca/anaconda3/envs/py36_np1.13.3/lib
INC: expat.h -> /Users/rfonseca/anaconda3/envs/py36_np1.13.3/include
LIB: libnetcdf.dylib -> /Users/rfonseca/anaconda3/envs/py36_np1.13.3/lib
INC: netcdf.h -> /Users/rfonseca/anaconda3/envs/py36_np1.13.3/include
LIB: libpython3.6*.dylib -> /Users/rfonseca/anaconda3/envs/py36_np1.13.3/lib
Isn't this weird given there's a perfectly valid /Users/rfonseca/anaconda3/envs/py36_np1.13.3/lib/libtcl8.6.dylib
?
I think that was the problem. setting up my conda environment with tk=8.5
solves the problem.
Ok, so for the record, creating a conda-environment the following way:
conda create -n vmd-python python=3.6 netcdf4 numpy expat tk=8.5
conda activate vmd-python
cd path/to/vmd-python
python setup.py build
python setup.py install
.. works. I guess the problem was that it was detecting the specific tcl version (8.5) in /usr/lib
but not caring where it got the includes from, so they didn't match because the most recent conda version was 8.6. Specifically installing tk 8.5 in conda solved this.
Just did a clean install of anaconda and I'm now getting segfaults when importing: