简体   繁体   中英

cannot install blpapi in macOS

I have just tried to install blpapi into my MacBook and I have the below error. I have installed the C++ SDK and export both BLPAPI_ROOT and DYLD_LIBRARY_PATH to the right directory. It generates errors like

error: use of undeclared identifier 'blpapi_SessionOptions_print'

Does anyone know or have encountered this issue before?

export BLPAPI_ROOT=/Users/kc/Documents/python/blpapi_cpp_3.8.1.1
export DYLD_LIBRARY_PATH=/Users/kc/Documents/python/blpapi_cpp_3.8.1.1/Darwin

copying blpapi/datetime.py -> build/lib.macosx-10.6-x86_64-2.7/blpapi
  copying blpapi/identity.py -> build/lib.macosx-10.6-x86_64-2.7/blpapi
  copying blpapi/topiclist.py -> build/lib.macosx-10.6-x86_64-2.7/blpapi
  copying blpapi/schema.py -> build/lib.macosx-10.6-x86_64-2.7/blpapi
  running build_ext
  building 'blpapi._internals' extension
  creating build/temp.macosx-10.6-x86_64-2.7
  creating build/temp.macosx-10.6-x86_64-2.7/blpapi
  gcc -fno-strict-aliasing -I/anaconda3/envs/py2.7/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/kelvincheng/Documents/python/kensho/blpapi_cpp_3.8.1.1/include -I/anaconda3/envs/py2.7/include/python2.7 -c blpapi/internals_wrap.cxx -o build/temp.macosx-10.6-x86_64-2.7/blpapi/internals_wrap.o
  blpapi/internals_wrap.cxx:3346:5: error: use of undeclared identifier 'blpapi_SessionOptions_print'
      blpapi_SessionOptions_print(
      ^
  blpapi/internals_wrap.cxx:3473:62: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings]
      PyObject* result = PyObject_CallFunction(loggerCallback, "KiIss",
                                                               ^
  blpapi/internals_wrap.cxx:4562:11: error: use of undeclared identifier 'blpapi_ProviderSession_terminateSubscriptionsOnTopics'
      res = blpapi_ProviderSession_terminateSubscriptionsOnTopics(sessionHandle, &topic, 1, message);
            ^
  blpapi/internals_wrap.cxx:4570:14: error: use of undeclared identifier 'blpapi_ProviderSession_flushPublishedEvents'
      int rc = blpapi_ProviderSession_flushPublishedEvents(
               ^
  blpapi/internals_wrap.cxx:9741:21: error: use of undeclared identifier 'blpapi_EventFormatter_appendFragmentedRecapMessage'
        result = (int)blpapi_EventFormatter_appendFragmentedRecapMessage(arg1,(char const *)arg2,arg3,(blpapi_Topic const *)arg4,(blpapi_CorrelationId_t_ const *)arg5,arg6);
                      ^
  blpapi/internals_wrap.cxx:9831:21: error: use of undeclared identifier 'blpapi_EventFormatter_appendFragmentedRecapMessageSeq'
        result = (int)blpapi_EventFormatter_appendFragmentedRecapMessageSeq(arg1,(char const *)arg2,arg3,(blpapi_Topic const *)arg4,arg5,arg6);
                      ^
  blpapi/internals_wrap.cxx:12598:21: error: use of undeclared identifier 'blpapi_SessionOptions_setServiceCheckTimeout'; did you mean '_wrap_blpapi_SessionOptions_setServiceCheckTimeout'?
        result = (int)blpapi_SessionOptions_setServiceCheckTimeout(arg1,arg2);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      _wrap_blpapi_SessionOptions_setServiceCheckTimeout
  blpapi/internals_wrap.cxx:12571:22: note: '_wrap_blpapi_SessionOptions_setServiceCheckTimeout' declared here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setServiceCheckTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                       ^
  blpapi/internals_wrap.cxx:12598:66: error: cannot initialize a parameter of type 'PyObject *' (aka '_object *') with an lvalue of type 'blpapi_SessionOptions_t *' (aka 'blpapi_SessionOptions *')
        result = (int)blpapi_SessionOptions_setServiceCheckTimeout(arg1,arg2);
                                                                   ^~~~
  blpapi/internals_wrap.cxx:12571:103: note: passing argument to parameter here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setServiceCheckTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                                                                                                        ^
  blpapi/internals_wrap.cxx:12649:21: error: use of undeclared identifier 'blpapi_SessionOptions_setServiceDownloadTimeout'; did you mean '_wrap_blpapi_SessionOptions_setServiceDownloadTimeout'?
        result = (int)blpapi_SessionOptions_setServiceDownloadTimeout(arg1,arg2);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      _wrap_blpapi_SessionOptions_setServiceDownloadTimeout
  blpapi/internals_wrap.cxx:12622:22: note: '_wrap_blpapi_SessionOptions_setServiceDownloadTimeout' declared here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setServiceDownloadTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                       ^
  blpapi/internals_wrap.cxx:12649:69: error: cannot initialize a parameter of type 'PyObject *' (aka '_object *') with an lvalue of type 'blpapi_SessionOptions_t *' (aka 'blpapi_SessionOptions *')
        result = (int)blpapi_SessionOptions_setServiceDownloadTimeout(arg1,arg2);
                                                                      ^~~~
  blpapi/internals_wrap.cxx:12622:106: note: passing argument to parameter here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setServiceDownloadTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                                                                                                           ^
  blpapi/internals_wrap.cxx:12676:3: error: unknown type name 'blpapi_TlsOptions_t'
    blpapi_TlsOptions_t *arg2 = (blpapi_TlsOptions_t *) 0 ;
    ^
  blpapi/internals_wrap.cxx:12676:32: error: use of undeclared identifier 'blpapi_TlsOptions_t'
    blpapi_TlsOptions_t *arg2 = (blpapi_TlsOptions_t *) 0 ;
                                 ^
  blpapi/internals_wrap.cxx:12676:53: error: expected expression
    blpapi_TlsOptions_t *arg2 = (blpapi_TlsOptions_t *) 0 ;
                                                      ^
  blpapi/internals_wrap.cxx:12694:28: error: unknown type name 'blpapi_TlsOptions_t'
    arg2 = reinterpret_cast< blpapi_TlsOptions_t * >(argp2);
                             ^
  blpapi/internals_wrap.cxx:12699:49: error: use of undeclared identifier 'blpapi_TlsOptions'
        blpapi_SessionOptions_setTlsOptions(arg1,(blpapi_TlsOptions const *)arg2);
                                                  ^
  blpapi/internals_wrap.cxx:12750:21: error: use of undeclared identifier 'blpapi_SessionOptions_setFlushPublishedEventsTimeout'; did you mean '_wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout'?
        result = (int)blpapi_SessionOptions_setFlushPublishedEventsTimeout(arg1,arg2);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      _wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout
  blpapi/internals_wrap.cxx:12723:22: note: '_wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout' declared here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                       ^
  blpapi/internals_wrap.cxx:12750:74: error: cannot initialize a parameter of type 'PyObject *' (aka '_object *') with an lvalue of type 'blpapi_SessionOptions_t *' (aka 'blpapi_SessionOptions *')
        result = (int)blpapi_SessionOptions_setFlushPublishedEventsTimeout(arg1,arg2);
                                                                           ^~~~
  blpapi/internals_wrap.cxx:12723:111: note: passing argument to parameter here
  SWIGINTERN PyObject *_wrap_blpapi_SessionOptions_setFlushPublishedEventsTimeout(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
                                                                                                                ^
  blpapi/internals_wrap.cxx:13693:21: error: use of undeclared identifier 'blpapi_SessionOptions_serviceCheckTimeout'; did you mean 'blpapi_SessionOptions_connectTimeout'?
        result = (int)blpapi_SessionOptions_serviceCheckTimeout(arg1);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      blpapi_SessionOptions_connectTimeout
  /Users/kelvincheng/Documents/python/kensho/blpapi_cpp_3.8.1.1/include/blpapi_sessionoptions.h:214:14: note: 'blpapi_SessionOptions_connectTimeout' declared here
  unsigned int blpapi_SessionOptions_connectTimeout(
               ^
  blpapi/internals_wrap.cxx:13735:21: error: use of undeclared identifier 'blpapi_SessionOptions_serviceDownloadTimeout'
        result = (int)blpapi_SessionOptions_serviceDownloadTimeout(arg1);
                      ^
  blpapi/internals_wrap.cxx:13777:21: error: use of undeclared identifier 'blpapi_SessionOptions_flushPublishedEventsTimeout'
        result = (int)blpapi_SessionOptions_flushPublishedEventsTimeout(arg1);
                      ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  1 warning and 20 errors generated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------      
    Failed building wheel for blpapi
  Running setup.py clean for blpapi
Failed to build blpapi
Installing collected packages: blpapi
  Running setup.py install for blpapi ... error
    Complete output from command /anaconda3/envs/py2.7/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-install-SjJNQg/blpapi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-record-QCtiNA/install-record.txt --single-version-externally-managed --compile:

fatal error: too many errors emitted, stopping now [-ferror-limit=]
    1 warning and 20 errors generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/anaconda3/envs/py2.7/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-install-SjJNQg/blpapi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-record-QCtiNA/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/pr/0ctg47rj1b9bj1dk943ll6n80000gn/T/pip-install-SjJNQg/blpapi/

一种快速的解决方案是从conda-forge渠道使用conda进行安装,因为那里有一个mac版本,即

conda install -c conda-forge blpapi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM