jeog / TDAmeritradeAPI

Front-end library - with C, C++, Python, and Java interfaces - for the recently expanded TDAmeritrade API
GNU General Public License v3.0
238 stars 61 forks source link

Building on Mac #4

Open brw59 opened 5 years ago

brw59 commented 5 years ago

I would really like to be able to run your library on a Mac. Your readme says: "For Mac OS/X you'll have to download/install the necessary libraries and adjust the makefiles." What is it that I'm supposed to change?

Here is my process ... starting from a fresh download of your repo: 1) Go to Release folder. 2) Do a 'make'. 2a) errors come up ... add "std::" before 'nullptr_t' to fix them:

../src/streaming/../../include/_tdma_api.h:218:39: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
                std::is_same<ProxyTy, nullptr_t>::value
../src/streaming/../../include/_tdma_api.h:231:43: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
template<typename ExcTy, typename ProxyTy=nullptr_t>

3) 'make clean' 4) do a 'make' again 5) error on sigtimedwait (Macintosh doesn't like this function for some reason, it's not included in the Mac version of the library):

g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/util.d" -MT"src/util.o" -o "src/util.o" "../src/util.cpp"
../src/util.cpp:57:16: error: use of undeclared identifier 'sigtimedwait'
        while( sigtimedwait(&_mask, 0, &t) > 0 )

5a) replace this:

SignalBlocker::~SignalBlocker()
{
    if( _active ){
        timespec t{};

        /* grab the pending signals */
        while( sigtimedwait(&_mask, 0, &t) > 0 )
        {}
        if( errno != EAGAIN ){
            throw std::runtime_error(
                "sigtimedwait failed: " + std::to_string(errno)
                );
        }

        /* reset to original state */
        if( pthread_sigmask(SIG_SETMASK, &_mask_old, 0) == -1 ){
            throw std::runtime_error(
                "pthread_sigmask failed: " + std::to_string(errno)
                );
        }
    }
}

with this:

SignalBlocker::~SignalBlocker()
{
    if( _active ){
        // timespec t{};
        int er;
        /* grab the pending signals */
        while( sigwait(&_mask, &er) > 0 )
        {}
        if( er != EAGAIN ){
            throw std::runtime_error(
                "sigtimedwait failed: " + std::to_string(errno)
                );
        }

        /* reset to original state */
        if( pthread_sigmask(SIG_SETMASK, &_mask_old, 0) == -1 ){
            throw std::runtime_error(
                "pthread_sigmask failed: " + std::to_string(errno)
                );
        }
    }
}

(I think it probably will do the same thing) 6) 'make clean' 7) 'make' 7a) For all that I try, I cannot get past this point. I keep getting the "ld: symbol(s) not found for architecture x86_64" error, which doesn't make sense to me since I'm compiling from scratch. ... And just to point out, the online suggestions of reinstalling the command line tools on Mac doesn't work either. ... Here's the error when it tries to create the libTDAmeritradeAPI.so file at the end of the 'make' command:

Building target: libTDAmeritradeAPI.so
Invoking: GCC C++ Linker
g++ -shared -o "libTDAmeritradeAPI.so"  ./uWebSockets/Epoll.o ./uWebSockets/Extensions.o ./uWebSockets/Group.o ./uWebSockets/HTTPSocket.o ./uWebSockets/Hub.o ./uWebSockets/Networking.o ./uWebSockets/Node.o ./uWebSockets/Room.o ./uWebSockets/Socket.o ./uWebSockets/WebSocket.o  ./src/streaming/streaming.o ./src/streaming/streaming_session.o ./src/streaming/streaming_subscriptions.o  ./src/get/account.o ./src/get/get.o ./src/get/historical.o ./src/get/instrument_info.o ./src/get/market_hours.o ./src/get/movers.o ./src/get/options.o ./src/get/quotes.o  ./src/execute/execute.o ./src/execute/order_leg.o ./src/execute/order_ticket.o  ./src/auth.o ./src/common.o ./src/curl_connect.o ./src/error.o ./src/tdma_connect.o ./src/util.o ./src/websocket_connect.o   -lssl -lz -lcurl -lpthread -lutil -ldl
Undefined symbols for architecture x86_64:
  "_EVP_CIPHER_CTX_free", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_CIPHER_CTX_new", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_DecryptFinal", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
  "_EVP_DecryptInit", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
  "_EVP_DecryptUpdate", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
  "_EVP_DigestFinal", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_DigestInit", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_DigestUpdate", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_EncryptFinal", referenced from:
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_EncryptInit", referenced from:
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_EncryptUpdate", referenced from:
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_MD_CTX_create", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_MD_CTX_destroy", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_MD_size", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_aes_256_cbc", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_sha256", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_SHA1", referenced from:
      uWS::HttpSocket<true>::upgrade(char const*, char const*, unsigned long, char const*, unsigned long, bool*) in HTTPSocket.o
  "_uv_async_init", referenced from:
      uWS::Group<true>::addAsync() in Group.o
      uWS::Group<true>::listen(uWS::ListenOptions) in Group.o
      uWS::Group<false>::addAsync() in Group.o
      uWS::Group<false>::listen(uWS::ListenOptions) in Group.o
      conn::WebSocketClient::WebSocketClient(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in websocket_connect.o
  "_uv_async_send", referenced from:
      uS::Socket::changePoll(uS::Socket*) in HTTPSocket.o
      uS::Socket::changePoll(uS::Socket*) in WebSocket.o
      uS::Socket::transfer(uS::NodeData*, void (*)(uS::Poll*))::'lambda'(uS::Poll*)::__invoke(uS::Poll*) in WebSocket.o
      conn::WebSocketClient::close(bool) in websocket_connect.o
      conn::WebSocketClient::send(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in websocket_connect.o
  "_uv_close", referenced from:
      uWS::Group<true>::removeHttpSocket(uWS::HttpSocket<true>*) in Group.o
      uWS::Group<true>::stopListening() in Group.o
      uWS::Group<true>::close(int, char*, unsigned long) in Group.o
      uWS::Group<false>::removeHttpSocket(uWS::HttpSocket<false>*) in Group.o
      uWS::Group<false>::stopListening() in Group.o
      uWS::Group<false>::terminate() in Group.o
      uWS::Group<false>::close(int, char*, unsigned long) in Group.o
      ...
  "_uv_default_loop", referenced from:
      uS::Node::Node(int, int, int, bool) in Node.o
      uS::Node::~Node() in Node.o
  "_uv_is_closing", referenced from:
      uWS::HttpSocket<true>::onData(uS::Socket*, char*, unsigned long) in HTTPSocket.o
      uWS::HttpSocket<false>::onData(uS::Socket*, char*, unsigned long) in HTTPSocket.o
      void uS::Socket::sslIoHandler<uWS::WebSocket<true> >(uS::Poll*, int, int) in HTTPSocket.o
      void uS::Socket::sslIoHandler<uWS::WebSocket<false> >(uS::Poll*, int, int) in HTTPSocket.o
      void uS::Socket::sslIoHandler<uWS::HttpSocket<true> >(uS::Poll*, int, int) in Hub.o
      void uS::Socket::sslIoHandler<uWS::HttpSocket<false> >(uS::Poll*, int, int) in Hub.o
      void uS::Socket::sslIoHandler<uWS::WebSocket<true> >(uS::Poll*, int, int) in Hub.o
      ...
  "_uv_loop_delete", referenced from:
      uS::Node::~Node() in Node.o
  "_uv_loop_new", referenced from:
      uS::Node::Node(int, int, int, bool) in Node.o
  "_uv_poll_init_socket", referenced from:
      bool uS::Node::listen<&(uWS::Hub::onServerAccept(uS::Socket*))>(char const*, int, uS::TLS::Context, int, uS::NodeData*, void*) in Hub.o
      uS::Socket* uS::Node::connect<&(uWS::allocateHttpSocket(uS::Socket*)), &(uWS::Hub::onClientConnection(uS::Socket*, bool))>(char const*, int, bool, uS::NodeData*) in Hub.o
      uWS::Hub::upgrade(int, char const*, ssl_st*, char const*, unsigned long, char const*, unsigned long, uWS::Group<true>*) in Hub.o
      void uS::Node::accept_cb<&(uWS::Hub::onServerAccept(uS::Socket*)), false>(uS::ListenSocket*) in Hub.o
      void uS::Node::accept_cb<&(uWS::Hub::onServerAccept(uS::Socket*)), true>(uS::ListenSocket*) in Hub.o
      uS::NodeData::asyncCallback(uS::Async*) in Node.o
  "_uv_poll_start", referenced from:
      uWS::HttpSocket<true>::onData(uS::Socket*, char*, unsigned long) in HTTPSocket.o
      uWS::HttpSocket<false>::onData(uS::Socket*, char*, unsigned long) in HTTPSocket.o
      uS::Socket::changePoll(uS::Socket*) in HTTPSocket.o
      void uS::Socket::sslIoHandler<uWS::WebSocket<true> >(uS::Poll*, int, int) in HTTPSocket.o
      void uS::Socket::ioHandler<uWS::WebSocket<true> >(uS::Poll*, int, int) in HTTPSocket.o
      void uS::Socket::sslIoHandler<uWS::WebSocket<false> >(uS::Poll*, int, int) in HTTPSocket.o
      void uS::Socket::ioHandler<uWS::WebSocket<false> >(uS::Poll*, int, int) in HTTPSocket.o
      ...
  "_uv_poll_stop", referenced from:
      uWS::Group<true>::stopListening() in Group.o
      uWS::HttpSocket<true>::onEnd(uS::Socket*) in HTTPSocket.o
      uWS::HttpSocket<false>::onEnd(uS::Socket*) in HTTPSocket.o
      void uS::Node::accept_cb<&(uWS::Hub::onServerAccept(uS::Socket*)), false>(uS::ListenSocket*) in Hub.o
      uWS::WebSocket<true>::onEnd(uS::Socket*) in WebSocket.o
      uWS::WebSocket<true>::transfer(uWS::Group<true>*) in WebSocket.o
      uWS::WebSocket<false>::onEnd(uS::Socket*) in WebSocket.o
      ...
  "_uv_run", referenced from:
      uS::Node::run() in Node.o
      uS::Node::poll() in Node.o
  "_uv_timer_init", referenced from:
      uWS::Group<true>::addHttpSocket(uWS::HttpSocket<true>*) in Group.o
      uWS::Group<true>::startAutoPing(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in Group.o
      uWS::Group<false>::addHttpSocket(uWS::HttpSocket<false>*) in Group.o
      uWS::Group<false>::startAutoPing(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in Group.o
      uWS::Hub::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >, int, uWS::Group<false>*) in Hub.o
      void uS::Node::accept_cb<&(uWS::Hub::onServerAccept(uS::Socket*)), false>(uS::ListenSocket*) in Hub.o
      uWS::WebSocket<true>::close(int, char const*, unsigned long) in WebSocket.o
      ...
  "_uv_timer_start", referenced from:
      uWS::Group<true>::addHttpSocket(uWS::HttpSocket<true>*) in Group.o
      uWS::Group<true>::startAutoPing(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in Group.o
      uWS::Group<false>::addHttpSocket(uWS::HttpSocket<false>*) in Group.o
      uWS::Group<false>::startAutoPing(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in Group.o
      uWS::Hub::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, void*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >, int, uWS::Group<false>*) in Hub.o
      void uS::Node::accept_cb<&(uWS::Hub::onServerAccept(uS::Socket*)), false>(uS::ListenSocket*) in Hub.o
      uWS::WebSocket<true>::close(int, char const*, unsigned long) in WebSocket.o
      ...
  "_uv_timer_stop", referenced from:
      uWS::Group<true>::removeHttpSocket(uWS::HttpSocket<true>*) in Group.o
      uWS::Group<true>::stopListening() in Group.o
      uWS::Group<true>::close(int, char*, unsigned long) in Group.o
      uWS::Group<false>::removeHttpSocket(uWS::HttpSocket<false>*) in Group.o
      uWS::Group<false>::close(int, char*, unsigned long) in Group.o
      uWS::HttpSocket<true>::onEnd(uS::Socket*) in HTTPSocket.o
      uWS::HttpSocket<false>::onEnd(uS::Socket*) in HTTPSocket.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libTDAmeritradeAPI.so] Error 1

Any idea for how to fix this?

jeog commented 5 years ago

Thanks for filing the issue, hopefully we can get this working so I can add a build option for mac. The problem is I have no experience w/ mac so I may not be a ton of help. The error indicates a problem linking w/ the openssl and uv libraries.

First, can you check to see you have these two libraries installed in the standard path.

Also, since libuv is not necessary on linux I don't have it in the makefile. Try changing the following line in objects.mk from LIBS := -lssl -lz -lcurl -lpthread -lutil -ldl to LIBS := -lssl -lz -lcurl -lpthread -lutil -ldl -luv

If possible keep track of any changes you make along the way so I can update the project once we get this working.

-jon

brw59 commented 5 years ago

I do have both installed already: brew install openssl Warning: openssl 1.0.2q is already installed and up-to-date brew install libuv Warning: libuv 1.26.0 is already installed and up-to-date <-- the results of the brew command indicate that I already have those libraries installed.

Adding the -luv at the end of the objects.mk seems to have taken care of the second half of the errors I was getting before, as I now only get the first half:

Building target: libTDAmeritradeAPI.so
Invoking: GCC C++ Linker
g++ -shared -o "libTDAmeritradeAPI.so"  ./uWebSockets/Epoll.o ./uWebSockets/Extensions.o ./uWebSockets/Group.o ./uWebSockets/HTTPSocket.o ./uWebSockets/Hub.o ./uWebSockets/Networking.o ./uWebSockets/Node.o ./uWebSockets/Room.o ./uWebSockets/Socket.o ./uWebSockets/WebSocket.o  ./src/streaming/streaming.o ./src/streaming/streaming_session.o ./src/streaming/streaming_subscriptions.o  ./src/get/account.o ./src/get/get.o ./src/get/historical.o ./src/get/instrument_info.o ./src/get/market_hours.o ./src/get/movers.o ./src/get/options.o ./src/get/quotes.o  ./src/execute/execute.o ./src/execute/order_leg.o ./src/execute/order_ticket.o  ./src/auth.o ./src/common.o ./src/curl_connect.o ./src/error.o ./src/tdma_connect.o ./src/util.o ./src/websocket_connect.o   -lssl -lz -lcurl -lpthread -lutil -ldl -luv
Undefined symbols for architecture x86_64:
  "_EVP_CIPHER_CTX_free", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_CIPHER_CTX_new", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_DecryptFinal", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
  "_EVP_DecryptInit", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
  "_EVP_DecryptUpdate", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
  "_EVP_DigestFinal", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_DigestInit", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_DigestUpdate", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_EncryptFinal", referenced from:
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_EncryptInit", referenced from:
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_EncryptUpdate", referenced from:
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_MD_CTX_create", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_MD_CTX_destroy", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_MD_size", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_EVP_aes_256_cbc", referenced from:
      (anonymous namespace)::load_credentials(std::__1::basic_fstream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in auth.o
      (anonymous namespace)::store_credentials(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Credentials const*) in auth.o
  "_EVP_sha256", referenced from:
      (anonymous namespace)::hash_sha256((anonymous namespace)::SmartBuffer<unsigned char>&) in auth.o
  "_SHA1", referenced from:
      uWS::HttpSocket<true>::upgrade(char const*, char const*, unsigned long, char const*, unsigned long, bool*) in HTTPSocket.o
ld: symbol(s) not found for architecture x86_64

I will be sure to track any changes I make from here on out.

jeog commented 5 years ago

Those functions are from the crypto library. Trying adding -lcrypto after -luv

brw59 commented 5 years ago

Finished building target: libTDAmeritradeAPI.so

I've tried for so long to make this work ... To think it was as simple as adding some flags. Due to my ignorance I didn't know which ones to add. I'll have to test it out later, but I think it has all worked out. Thank you very much. I will update later this week if I find any more problems.

jeog commented 5 years ago

Glad it worked. I think you may have an issue using sigwait instead of sigtimedwait, the latter returns the singal number (> 0) on success and the former sets the 'sig' arg and returns 0. Also sigtimedwait will simply poll and return immediately while sigwait will block. In your update I think you'll freeze in the destructor: either the sigwait will hang or you'll never break out of the empty while loop.

I remember this was a pain to get working in the first place and sigtimedwait was one of the few ways to get everything to work. May need to do some googling to find an alternative.

jeog commented 5 years ago

I just pushed a new branch 'mac-build' that fixes the things you mentioned and adds a workaround to the 'sigtimedwait' issue that appears to work on linux - so far.

When you get a chance switch over to that branch and let me know if you're able to build w/o having to change anything.

brw59 commented 5 years ago

With no changes your mac-build branch built the libTDAmeritradeAPI.so wonderfully. I see you ended up with a better ~signalBlocker() too ... I discovered that you were right about it hanging in the version I posted

jeog commented 5 years ago

I merged these updates to master EXCEPT -luv, which should be manually added to objects.mk. (The makefiles are automatically generated and I didn't want to force an unnecessary dependency on linux; hopefully at some point I'll convert this to a makefile project for a more portable build.)

jeog commented 5 years ago

brw59,

I'm trying to transition to a single makefile build. If you have a minute can you checkout branch 'to-makefile-project' and try to build w/ make all from the root directory to see if works on Mac. It should send all the binaries to 'build/release' and 'build/debug'.

thanks

ima-10 commented 5 years ago

Jeog thanks for your work on this. I'm trying to build this on a mac (OS 10.14.6) and am getting the error:

In file included from ../src/streaming/streaming.cpp:22: In file included from ../src/streaming/../../include/_streaming.h:22: In file included from ../src/streaming/../../include/_tdma_api.h:30: In file included from ../src/streaming/../../include/tdma_common.h:28: ../src/streaming/../../include/json.hpp:1201:9: error: static_assert failed "could not find from_json() method in T's namespace" static_assert(sizeof(BasicJsonType) == 0,

Same error on master, mac-build, and to-makefile-project branches.

jeog commented 5 years ago

That's coming from the external json header/library. I'll have to take a look at their docs and see what exactly that error message means because I haven't seen it before. But first, can you try replacing line 30 in tdma_common.h

using json = nlohmann::json;

with

namespace tdma{
using json = nlohmann::json;
}

and see what happens

ima-10 commented 5 years ago

I made the suggested edit but am still getting the same error. Searching turned up some possibilities:

https://github.com/nlohmann/json/issues/539

You need to define the to_json function in the namespace of the class you want to convert to JSON. It has to have exactly two parameters: json & and a const reference of your class type.

https://github.com/nlohmann/json/issues/917

... the to_json/from_json functions MUST BE free functions (i.e. outside of your class)

jeog commented 5 years ago

Those functions shouldn't have to be defined since we're only parsing json strings and creating json objects through inline initializers which should all be supported by default. It seems to be when compiled with msvc, and gcc.

Can you paste an example of the compile command make is using (make clean, make -n will do a dry run and spit out the commands).

ima-10 commented 5 years ago

Using the mac-build branch and make clean, make -n gives this output:

echo 'Building file: ../uWebSockets/Epoll.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/Epoll.d" -MT"uWebSockets/Epoll.o" -o "uWebSockets/Epoll.o" "../uWebSockets/Epoll.cpp" echo 'Finished building: ../uWebSockets/Epoll.cpp' echo ' ' echo 'Building file: ../uWebSockets/Extensions.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/Extensions.d" -MT"uWebSockets/Extensions.o" -o "uWebSockets/Extensions.o" "../uWebSockets/Extensions.cpp" echo 'Finished building: ../uWebSockets/Extensions.cpp' echo ' ' echo 'Building file: ../uWebSockets/Group.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/Group.d" -MT"uWebSockets/Group.o" -o "uWebSockets/Group.o" "../uWebSockets/Group.cpp" echo 'Finished building: ../uWebSockets/Group.cpp' echo ' ' echo 'Building file: ../uWebSockets/HTTPSocket.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/HTTPSocket.d" -MT"uWebSockets/HTTPSocket.o" -o "uWebSockets/HTTPSocket.o" "../uWebSockets/HTTPSocket.cpp" echo 'Finished building: ../uWebSockets/HTTPSocket.cpp' echo ' ' echo 'Building file: ../uWebSockets/Hub.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/Hub.d" -MT"uWebSockets/Hub.o" -o "uWebSockets/Hub.o" "../uWebSockets/Hub.cpp" echo 'Finished building: ../uWebSockets/Hub.cpp' echo ' ' echo 'Building file: ../uWebSockets/Networking.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/Networking.d" -MT"uWebSockets/Networking.o" -o "uWebSockets/Networking.o" "../uWebSockets/Networking.cpp" echo 'Finished building: ../uWebSockets/Networking.cpp' echo ' ' echo 'Building file: ../uWebSockets/Node.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/Node.d" -MT"uWebSockets/Node.o" -o "uWebSockets/Node.o" "../uWebSockets/Node.cpp" echo 'Finished building: ../uWebSockets/Node.cpp' echo ' ' echo 'Building file: ../uWebSockets/Room.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/Room.d" -MT"uWebSockets/Room.o" -o "uWebSockets/Room.o" "../uWebSockets/Room.cpp" echo 'Finished building: ../uWebSockets/Room.cpp' echo ' ' echo 'Building file: ../uWebSockets/Socket.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/Socket.d" -MT"uWebSockets/Socket.o" -o "uWebSockets/Socket.o" "../uWebSockets/Socket.cpp" echo 'Finished building: ../uWebSockets/Socket.cpp' echo ' ' echo 'Building file: ../uWebSockets/WebSocket.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"uWebSockets/WebSocket.d" -MT"uWebSockets/WebSocket.o" -o "uWebSockets/WebSocket.o" "../uWebSockets/WebSocket.cpp" echo 'Finished building: ../uWebSockets/WebSocket.cpp' echo ' ' echo 'Building file: ../src/streaming/streaming.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/streaming/streaming.d" -MT"src/streaming/streaming.o" -o "src/streaming/streaming.o" "../src/streaming/streaming.cpp" echo 'Finished building: ../src/streaming/streaming.cpp' echo ' ' echo 'Building file: ../src/streaming/streaming_session.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/streaming/streaming_session.d" -MT"src/streaming/streaming_session.o" -o "src/streaming/streaming_session.o" "../src/streaming/streaming_session.cpp" echo 'Finished building: ../src/streaming/streaming_session.cpp' echo ' ' echo 'Building file: ../src/streaming/streaming_subscriptions.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/streaming/streaming_subscriptions.d" -MT"src/streaming/streaming_subscriptions.o" -o "src/streaming/streaming_subscriptions.o" "../src/streaming/streaming_subscriptions.cpp" echo 'Finished building: ../src/streaming/streaming_subscriptions.cpp' echo ' ' echo 'Building file: ../src/get/account.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/get/account.d" -MT"src/get/account.o" -o "src/get/account.o" "../src/get/account.cpp" echo 'Finished building: ../src/get/account.cpp' echo ' ' echo 'Building file: ../src/get/get.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/get/get.d" -MT"src/get/get.o" -o "src/get/get.o" "../src/get/get.cpp" echo 'Finished building: ../src/get/get.cpp' echo ' ' echo 'Building file: ../src/get/historical.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/get/historical.d" -MT"src/get/historical.o" -o "src/get/historical.o" "../src/get/historical.cpp" echo 'Finished building: ../src/get/historical.cpp' echo ' ' echo 'Building file: ../src/get/instrument_info.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/get/instrument_info.d" -MT"src/get/instrument_info.o" -o "src/get/instrument_info.o" "../src/get/instrument_info.cpp" echo 'Finished building: ../src/get/instrument_info.cpp' echo ' ' echo 'Building file: ../src/get/market_hours.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/get/market_hours.d" -MT"src/get/market_hours.o" -o "src/get/market_hours.o" "../src/get/market_hours.cpp" echo 'Finished building: ../src/get/market_hours.cpp' echo ' ' echo 'Building file: ../src/get/movers.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/get/movers.d" -MT"src/get/movers.o" -o "src/get/movers.o" "../src/get/movers.cpp" echo 'Finished building: ../src/get/movers.cpp' echo ' ' echo 'Building file: ../src/get/options.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/get/options.d" -MT"src/get/options.o" -o "src/get/options.o" "../src/get/options.cpp" echo 'Finished building: ../src/get/options.cpp' echo ' ' echo 'Building file: ../src/get/quotes.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/get/quotes.d" -MT"src/get/quotes.o" -o "src/get/quotes.o" "../src/get/quotes.cpp" echo 'Finished building: ../src/get/quotes.cpp' echo ' ' echo 'Building file: ../src/execute/execute.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/execute/execute.d" -MT"src/execute/execute.o" -o "src/execute/execute.o" "../src/execute/execute.cpp" echo 'Finished building: ../src/execute/execute.cpp' echo ' ' echo 'Building file: ../src/execute/order_leg.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/execute/order_leg.d" -MT"src/execute/order_leg.o" -o "src/execute/order_leg.o" "../src/execute/order_leg.cpp" echo 'Finished building: ../src/execute/order_leg.cpp' echo ' ' echo 'Building file: ../src/execute/order_ticket.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/execute/order_ticket.d" -MT"src/execute/order_ticket.o" -o "src/execute/order_ticket.o" "../src/execute/order_ticket.cpp" echo 'Finished building: ../src/execute/order_ticket.cpp' echo ' ' echo 'Building file: ../src/auth.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/auth.d" -MT"src/auth.o" -o "src/auth.o" "../src/auth.cpp" echo 'Finished building: ../src/auth.cpp' echo ' ' echo 'Building file: ../src/common.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/common.d" -MT"src/common.o" -o "src/common.o" "../src/common.cpp" echo 'Finished building: ../src/common.cpp' echo ' ' echo 'Building file: ../src/curl_connect.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/curl_connect.d" -MT"src/curl_connect.o" -o "src/curl_connect.o" "../src/curl_connect.cpp" echo 'Finished building: ../src/curl_connect.cpp' echo ' ' echo 'Building file: ../src/error.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/error.d" -MT"src/error.o" -o "src/error.o" "../src/error.cpp" echo 'Finished building: ../src/error.cpp' echo ' ' echo 'Building file: ../src/tdma_connect.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/tdma_connect.d" -MT"src/tdma_connect.o" -o "src/tdma_connect.o" "../src/tdma_connect.cpp" echo 'Finished building: ../src/tdma_connect.cpp' echo ' ' echo 'Building file: ../src/util.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/util.d" -MT"src/util.o" -o "src/util.o" "../src/util.cpp" echo 'Finished building: ../src/util.cpp' echo ' ' echo 'Building file: ../src/websocket_connect.cpp' echo 'Invoking: GCC C++ Compiler' g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"src/websocket_connect.d" -MT"src/websocket_connect.o" -o "src/websocket_connect.o" "../src/websocket_connect.cpp" echo 'Finished building: ../src/websocket_connect.cpp' echo ' ' echo 'Building target: libTDAmeritradeAPI.so' echo 'Invoking: GCC C++ Linker' g++ -shared -o "libTDAmeritradeAPI.so" ./uWebSockets/Epoll.o ./uWebSockets/Extensions.o ./uWebSockets/Group.o ./uWebSockets/HTTPSocket.o ./uWebSockets/Hub.o ./uWebSockets/Networking.o ./uWebSockets/Node.o ./uWebSockets/Room.o ./uWebSockets/Socket.o ./uWebSockets/WebSocket.o ./src/streaming/streaming.o ./src/streaming/streaming_session.o ./src/streaming/streaming_subscriptions.o ./src/get/account.o ./src/get/get.o ./src/get/historical.o ./src/get/instrument_info.o ./src/get/market_hours.o ./src/get/movers.o ./src/get/options.o ./src/get/quotes.o ./src/execute/execute.o ./src/execute/order_leg.o ./src/execute/order_ticket.o ./src/auth.o ./src/common.o ./src/curl_connect.o ./src/error.o ./src/tdma_connect.o ./src/util.o ./src/websocket_connect.o -lssl -lcrypto -lz -lcurl -lpthread -lutil -ldl -luv echo 'Finished building target: libTDAmeritradeAPI.so' echo ' '

jeog commented 5 years ago

Thanks, the problem seems to be related to initializing/assigning json objects from stl objects in streaming.cpp that, for some reason, json.hpp is not recognizing and trying to look for custom to_json methods. I'll have to investigate, if I can't find anything I'll file an issue with the json project.

One thing to try is replace include/json.hpp with the most recent version: https://github.com/nlohmann/json/tree/develop/single_include/nlohmann. Maybe something was changed/fixed since I included it months ago.

If you notice any other errors in the compile output please share.

ima-10 commented 5 years ago

Looks like the error is due to the version of json that is included. I included version 3.7.0 and make got past the previous error. Now it's getting to the -lssl flag and failing to find it on my system, despite using Hombrew's instructions for setup:

ld: library not found for -lssl

I'm working on getting this fixed (@brw59 did you have this issue?), and will post an update when I have one.

ima-10 commented 5 years ago

Alright the openssl issue is resolved. For my system the fix was:

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

I found it at https://github.com/brianmario/mysql2/issues/795 (for future searchers). After that make ran without errors, the Python installation worked, and I can import tdma_api. Will let you know if I run into any issues, thank you for your input @jeog.

jeog commented 5 years ago

good to hear, I just pushed a commit to master w/ the most recent json.hpp

corncobb commented 3 years ago

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ right after brew install openssl solved my issue. Thanks @ima-10

krishna919 commented 3 years ago

I'm getting this issue even after including openssl in LIBRARY_PATH

`../src/auth.cpp:29:10: fatal error: 'openssl/evp.h' file not found

include "openssl/evp.h"`

krishna919 commented 3 years ago

I'm getting this issue even after including openssl in LIBRARY_PATH

../src/auth.cpp:29:10: fatal error: 'openssl/evp.h' file not found #include "openssl/evp.h"

Doing this resolved the SSL error $ cd /usr/local/include $ ln -s ../opt/openssl/include/openssl .

jhawleyjr commented 2 years ago

I'm on Mac with the M1 (ARM) chip and had the same issue as @krishna919 but their solution of creating a symbolic link didn't work for me. After trying everything, the only way I got it to work was by making small changes to the makefile.

For anyone else with an M1 chip that's having issues, use homebrew to install openssl and libuv. Then in the makefile add:

LDFLAGS := -L/opt/homebrew/opt/openssl@1.1/lib -L//opt/homebrew/opt/libuv/lib CPPFLAGS := -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libuv/include

Then when invoking g++ for libTDAmeritradeAPI.so, append $(LDFLAGS)

g++ -shared -o "libTDAmeritradeAPI.so" $(OBJS) $(USER_OBJS) $(LIBS) $(LDFLAGS)

And the same for src and uWebSockets except append $(CPPFLAGS) instead

g++ -std=c++0x -DTHIS_EXPORTS_INTERFACE -DNDEBUG -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" $(CPPFLAGS)

If anyone has an easier solution that doesn't involve changing the makefile, please let me know.