-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Trying to build ta-lib from source if the library is not found #110
Conversation
git-subtree-dir: vendor/ta-lib git-subtree-split: 2ee32d04e2b7686dc0931e17c6a420682c46f3a3
Hmm, thats a neat idea but I'm not sure I want to link to an "unofficial mirror"... |
@mrjbq7 That's true. Sadly the upstream on sourceforge has no update for quite a few years. Would you like to take over the https://github.com/TA-Lib and make it part of mrjbq7/ta-lib ? |
Are you the owner of that org? |
@mrjbq7 Yes. I've just invited you. The code is import from http://svn.code.sf.net/p/ta-lib/code/trunk/ta-lib/c/ using GitHub Importer. You may check using |
f7a10fa
to
4e80590
Compare
The PR above should work on OSX (At least the tests could pass) but it failed on Linux. A few problems ahead: There's one global variable |
Is the problem too many python C extensions? It's an open thing to resolve because of the extra memory that implies with keeping three copies around but I didn't realize it would be problematic for this PR. |
The 3 Python C Extensions is dependent with each other:
First I tried to compile all the ".c" files and all the ".h" headers from the TA-Lib vendor with each of the 4 Python C Extensions(namely Later I tried compile each I think first we may need to make each of the C source code is used only by one Python C Extension (or just make sure there's only one Python C Extension), such that there'll be only one |
I just tried(https://github.com/mckelvin/python-ta-lib/tree/vendor-makefile-static) to compile the c library as a static library first, by running make command before build Python C extensions. The Python C extensions will link the The result is similar to what I tried at the very beginning. The test case failed.
I think combine the |
One extension is on my todo list, but I have some travel coming up and can't get to it for a couple weeks. |
@mrjbq7 Enjoy your journey! I've done that and I'll send another PR latter. |
This is a failed attempt trying since there's a global variable in the c library, which make it impossible to share the global variable among multi extensions (which are compiled separately) if linked statically.
SEE ALSO: #111
Hi @mrjbq7
Thanks for developing and maintaining the Cython wrapper for ta-lib. The purpose of the PR is to make it easier to build and install ta-lib. It's quite hard to install the c library of
ta-lib
, especially for debian user as there's no system package and the project seems out of maintain. The PR may also be helpful to #88, #75.One way to solve the problem is fallback to build from source if the library is not found. Like what https://github.com/redis/hiredis-py do.
Changes:
git subtree add --prefix vendor/ta-lib https://github.com/TA-Lib/ta-lib.git v0.4.0 --squash
(https://github.com/TA-Lib/ta-lib/releases/tag/v0.4.0)setup.py
to make it fallback to build-from-sourcetests
and refactor for py.test (a better alternative to nose)python setup.py test