Mac OS X 10.5 missing posix_memalign function warning

Issue #5 resolved
Kelvin Wong
created an issue

Installing py-scrypt on a system running Mac OS X 10.5 Leopard and Python 2.6.8 results in a build warning due to the fact that posix_memalign is not present in stdlib.h. This is the warning:
{{{
/usr/bin/gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -O2 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c scrypt-1.1.6/lib/crypto/crypto_scrypt-nosse.c -o build/temp.macosx-10.5-i386-2.6/scrypt-1.1.6/lib/crypto/crypto_scrypt-nosse.o

scrypt-1.1.6/lib/crypto/crypto_scrypt-nosse.c: In function ‘crypto_scrypt’:
scrypt-1.1.6/lib/crypto/crypto_scrypt-nosse.c:277: warning: implicit declaration of function ‘posix_memalign’

}}}

The completed artifacts are then installed. Unfortunately they don't work:

{{{

Python 2.6.8 (unknown, May 4 2012, 03:06:15)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import scrypt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/kelvin/.virtualenvs/django_hacking_py2.6/lib/python2.6/site-packages/scrypt.so, 2): Symbol not found: _posix_memalign
Referenced from: /Users/kelvin/.virtualenvs/django_hacking_py2.6/lib/python2.6/site-packages/scrypt.so
Expected in: dynamic lookup
}}}

The problem is solved by moving the //HAVE_POSIX_MEMALIGN// macro from config.h into the setup.py. I have made these changes to a fork and submitting a pull request for consideration.

Comments (1)

  1. Log in to comment