Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation fixes for Mac OSX 10.9.4 #4

Open
pvagovic opened this issue Oct 8, 2014 · 0 comments
Open

Installation fixes for Mac OSX 10.9.4 #4

pvagovic opened this issue Oct 8, 2014 · 0 comments

Comments

@pvagovic
Copy link

pvagovic commented Oct 8, 2014

Compilation and link errors have been fixed for OSX 10.9 using the macport python 2.7 distribution ...

During compiling the sources of SRW I was getting following errors:

g++ -shared -O3 -fPIC -I..//src/core -I..//src/lib -I..//src/ext/auxparse -I..//src/ext/genmath -D_GNU_SOURCE -D__USE_XOPEN2K8 -DFFTW_ENABLE_FLOAT -D_GM_WITHOUT_BASE -DSRWLIB_STATIC -DNO_TIMER -DANSI_DECLARATORS -DTRILIBRARY -DLINUX -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -L/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 -o srwlpy.so ../src/clients/python/srwlpy.cpp libsrw.a -L..//../ext_lib -lm -lfftw
Undefined symbols for architecture x86_64:
"_PyArg_ParseTuple", referenced from:

This was fixed by adding -lpython2.7 into PYFLAGS in the srw makefile:

PYFLAGS= -I$(PYPATH)/include/python2.7 -L$(PYPATH)/lib/python2.7 -lpython2.7

After this I was able to compile but in python I was not able to import srwlib due to wrong linking.
In ipython console I was getting this error:

import srwlpy
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

This was caused by linking of the srwlib.o to wrong python. Using otool I could se this output:
srwlpy.so:
srwlpy.so (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
/opt/local/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.20.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

So the linking to /System/Library/ .... /2.7/Python is wrong .... this I was able to fix my manual relinking using install_name_tool:

install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python srwlpy.so

Now using otool linking was done correctly and srwlib can be imported to python:

otool -L srwlpy.so
srwlpy.so:
srwlpy.so (compatibility version 0.0.0, current version 0.0.0)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
/opt/local/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.20.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant