I am trying to install this package on a system where I must install libsnappy-dev in a nonstandard location, and don't know how to include the right flags in the automatic installation to help gcc find the dev files.
Predictably, when I attempt to install from github with
pip git+git://github.com/andrix/python-snappy
I get a compiling error because the .h files (in a nonstandard place) can't be found.
Running setup.py install for python-snappy
building '_snappy' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/include/python2.7 -c snappymodule.cc -o build/temp.linux-x86_64-2.7/snappymodule.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
snappymodule.cc:31:22: error: snappy-c.h: No such file or directory
snappymodule.cc:77: error: ‘snappy_status’ was not declared in this scope
snappymodule.cc:78: error: expected ‘,’ or ‘;’ before ‘{’ token
snappymodule.cc:45: warning: ‘_state’ defined but not used
snappymodule.cc:56: warning: ‘SnappyCompressError’ defined but not used
snappymodule.cc:57: warning: ‘SnappyUncompressError’ defined but not used
snappymodule.cc:58: warning: ‘SnappyInvalidCompressedInputError’ defined but not used
snappymodule.cc:59: warning: ‘SnappyCompressedLengthError’ defined but not used
snappymodule.cc:77: warning: ‘snappy_strerror’ defined but not used
error: command 'gcc' failed with exit status 1
Complete output from command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_u41994/python-snappy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3otpv5-record/install-record.txt --single-version-externally-managed --compile:
running install
I am just a hacker with building software, but I think I need to set the LDFLAGS variable like so:
export LDFLAGS="-L/app/vendor/snappy/usr/local/lib -L/app/vendor/snappy/usr/local/include"
However, that is not making it into the gcc invocation as listed above. Any thoughts on how to resolve this?
EDIT: Progress. Forking snappy and changing
snappymodule = Extension('_snappy',
libraries=['snappy'],
sources=['snappymodule.cc', 'crc32c.c'])
to
snappymodule = Extension('_snappy',
libraries=['snappy'],
sources=['snappymodule.cc', 'crc32c.c'],
extra_compile_args=['-L/app/vendor/snappy/usr/local/lib -L/app/vendor/snappy/usr/local/include',
'-I/app/vendor/snappy/usr/local/lib -I/app/vendor/snappy/usr/local/include'])
has progressed the error to
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/app/.heroku/python/include/python2.7 -c snappymodule.cc -o build/temp.linux-x86_64-2.7/snappymodule.o -L/app/vendor/snappy/usr/local/lib -L/app/vendor/snappy/usr/local/include -I/app/vendor/snappy/usr/local/lib -I/app/vendor/snappy/usr/local/include
meaning we can at least pass flags in. Still trying to figure out what the right flags are. Manual checking still confirms that snappy.h is around.
~/vendor/snappy/usr/local/include $ pwd
/app/vendor/snappy/usr/local/include
~/vendor/snappy/usr/local/include $ ls
snappy-c.h snappy.h snappy-sinksource.h snappy-stubs-public.h