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

osx compile from source (high sierra 10.13.2, python 3.6) #190

Closed
trentbrooks opened this issue Mar 13, 2018 · 7 comments
Closed

osx compile from source (high sierra 10.13.2, python 3.6) #190

trentbrooks opened this issue Mar 13, 2018 · 7 comments

Comments

@trentbrooks
Copy link

Hi,

Thanks for such a great tool. It works perfectly via the pip install, but I need to compile from source to address the floating point precision mentioned here: #151. Hoping you can point me in the right direction as I'm getting an error during make.

Following instructions here:
$ ./configure --prefix=/usr
$ make
$ sudo make install

But it fails at the first 'make' for me with the following error:
libtool: link: (cd .libs/libta_lib.lax/libta_abstract.a && ar x "/Users/trentbrooks/Downloads/ta-lib 3/src/ta_abstract/.libs/libta_abstract.a")
../libtool: line 1717: cd: .libs/libta_lib.lax/libta_abstract.a: No such file or directory
make[2]: *** [libta_lib.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

Full logs here:
configure: https://www.dropbox.com/s/dspkcmltxbp7v1p/talib-configure-result.txt
make: https://www.dropbox.com/s/2h5tft7xpw3r9i3/talb-make-result.txt

I'm running osx high sierra 10.13.2, python 3.6.

@mrjbq7
Copy link
Collaborator

mrjbq7 commented Mar 13, 2018

On a mac laptop running macOS 10.13.3:

  1. downloaded ta-lib-0.4.0-src.tar.gz
  2. tar xvfz ta-lib-0.4.0-src.tar.gz
  3. applied the two-line patch bollinger bands are the same for upper, middle and lower #151 (comment)
  4. then ran make
  5. aside from a couple of warnings it completed just fine.
gcc -DHAVE_CONFIG_H -I. -I../../../include  -I../../ta_common   -g -O2 -MT gen_code-gen_code.o -MD -MP -MF .deps/gen_code-gen_code.Tpo -c -o gen_code-gen_code.o `test -f 'gen_code.c' || echo './'`gen_code.c
gen_code.c:3456:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
   fprintf( out, prefix );
                 ^~~~~~
gen_code.c:3456:18: note: treat the string as an argument to avoid this
   fprintf( out, prefix );
                 ^
                 "%s", 
1 warning generated.

I wasn't sure why you got that error? But, was thinking...

Some older programs don't like directories with spaces in it (yours looks like ~/Downloads/ta-lib 3). I tried again by putting it in a directory with a space and ... it broke the same way.

So, make sure it's not in a directory hierarchy with spaces in the directory names and you should be good to go.

@mrjbq7 mrjbq7 closed this as completed Mar 13, 2018
mrjbq7 added a commit that referenced this issue Mar 13, 2018
It doesn't work if in a directory path that has spaces in it. See #190.
@trentbrooks
Copy link
Author

Thankyou - I can confirm this removed the above error.

I'm now getting much further down in the compile but getting this error:
Making all in ta_regtest
gcc -DHAVE_CONFIG_H -I. -I../../../include -I../../ta_func -I../../ta_common/trio -I../../ta_common/mt -I../../ta_common -I../../ta_abstract -g -O2 -MT ta_regtest-ta_regtest.o -MD -MP -MF .deps/ta_regtest-ta_regtest.Tpo -c -o ta_regtest-ta_regtest.o test -f 'ta_regtest.c' || echo './'ta_regtest.c
ta_regtest.c:138:21: warning: implicit declaration of function 'time' is invalid in C99 [-Wimplicit-function-declaration]
srand( (unsigned)time( NULL ) );
^
ta_regtest.c:178:25: error: use of undeclared identifier 'CLOCKS_PER_SEC'
freq = (double)CLOCKS_PER_SEC;

I checked ta_regtest.c, and can see #include <time.h> is there, so not sure how my compiler is not seeing it.

@mrjbq7
Copy link
Collaborator

mrjbq7 commented Mar 14, 2018

Hmm, not sure!

For what it's worth, I was using clang.

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@dsilletti
Copy link

dsilletti commented Mar 19, 2018

Procedure successfully tested on MacOS High Sierra 10.13.3 + Homebrew

build ta-lib from sources:

brew install --build-from-source ta-lib

uninstall ta-lib (sources will not be removed):

brew uninstall ta-lib

you will find the sources in the path:

cd ~/Library/Caches/Homebrew

edit ta_utility.h

replace:

#define TA_IS_ZERO(v) (((-0.00000001)<v)&&(v<0.00000001))
#define TA_IS_ZERO_OR_NEG(v) (v<0.00000001)

with:

#define TA_IS_ZERO(v) (((-0.000000000000000001)<v)&&(v<0.000000000000000001))
#define TA_IS_ZERO_OR_NEG(v) (v<0.000000000000000001)

configure, make, make install, create link:

./configure --prefix=/usr/local/Cellar/ta-lib/0.4.0 && make && make install && brew link ta-lib

Enjoy

@trentbrooks
Copy link
Author

Thanks for advice @dsilletti and @mrjbq7 - can confirm this works. Process is not great for installing on multiple machines / cross compilation, but ok for prototypes I guess. For now I'm sticking with custom numpy/panda versions of bollinger bands and standard deviation functions until the floating point precision is increased in the default installer.

@dsilletti
Copy link

You are welcome @trentbrooks, the problem is that TA-Lib is discontinued since 2007 https://www.ta-lib.org/hdr_dw.html Version: 0.4 (September 2007) and probably this change will never be implemented (in that time was not needed the precision we need for the cryptocurrencies now)

@mfenner1
Copy link

@trentbrooks If you are still looking at this, you could consider:

  1. Download the source tar.gz from https://ta-lib.org/hdr_dw.html
  2. Edit the files with the changes listed above and/or create a true diff patch file for it.
  3. Use the patched version and/or pull the tar.gz and the diff file to local machines.
  4. Run the build process.

That could all be automated by scripts and/or you could make a package management tool recipe for it (brew, ports, etc.).

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

4 participants