Commit 34ad62e5 authored by Axel Auweter's avatar Axel Auweter
Browse files

Cross platform issues compiling C++11 code (Mac OS has two C++ standard...

Cross platform issues compiling C++11 code (Mac OS has two C++ standard libraries, only one supports C++11 but Thrift fails to build with it).
Fix: Replace C++11 system_error with Boost system_error.
Some other minor fixes.
parent a65bde4b
include ../config.mk
CXXFLAGS = $(shell ./cxx11flags.sh $(CXX) -O0 -g -Wall -fmessage-length=0 -I$(DCDBDEPLOYPATH)/include/ | head -1)
#CXXFLAGS = $(shell ./cxx11flags.sh $(CXX) -O0 -g -Wall -fmessage-length=0 -I$(DCDBDEPLOYPATH)/include/ | head -1)
CXXFLAGS = -O0 -g -Wall -fmessage-length=0 -I$(DCDBDEPLOYPATH)/include/
OBJS = collectagent.o simplemqttserver.o simplemqttserverthread.o simplemqttservermessage.o cassandra/Cassandra.o cassandra/cassandra_constants.o cassandra/cassandra_types.o
SRC = $(patsubst cassandra/%,,$(OBJS:.o=.cpp))
LIBS = $(shell ./cxx11flags.sh $(CXX) -L$(DCDBDEPLOYPATH)/lib/ -lthrift -lssl -lcrypto -lpthread -lboost_system | tail -1)
#LIBS = $(shell ./cxx11flags.sh $(CXX) -L$(DCDBDEPLOYPATH)/lib/ -lthrift -lssl -lcrypto -lpthread -lboost_system | tail -1)
LIBS = -L$(DCDBDEPLOYPATH)/lib/ -lthrift -lssl -lcrypto -lpthread -lboost_system
TARGET = collectagent
SUBTARGETS = cassandra/Cassandra.h
......
......@@ -156,6 +156,8 @@ void SimpleMQTTServer::init(string addr, string port)
throw new invalid_argument("Network port is not numeric.");
listenPort = port;
messageCallback = NULL;
/*
* Set up the sockets.
*/
......
......@@ -16,11 +16,11 @@
#include <exception>
#include <stdexcept>
#include <system_error>
#include <boost/ptr_container/ptr_list.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/system/system_error.hpp>
#ifndef SIMPLEMQTTSERVER_H_
#define SIMPLEMQTTSERVER_H_
......@@ -64,7 +64,7 @@
/*
* Enable verbose output of the MQTT server.
*/
//#define SimpleMQTTVerbose
#define SimpleMQTTVerbose
#include "simplemqttservermessage.h"
typedef void (*SimpleMQTTMessageCallback)(SimpleMQTTMessage*);
......@@ -92,7 +92,7 @@ protected:
std::string listenPort;
boost::ptr_vector<int> listenSockets;
boost::ptr_list<SimpleMQTTServerAcceptThread> acceptThreads;
SimpleMQTTMessageCallback messageCallback = NULL;
SimpleMQTTMessageCallback messageCallback;
void init(std::string addr, std::string port);
void initSockets(void);
......
......@@ -8,6 +8,7 @@
#include "simplemqttserver.h"
using namespace std;
using namespace boost::system;
#ifdef SimpleMQTTVerbose
static boost::mutex coutMtx;
......@@ -190,7 +191,7 @@ ssize_t SimpleMQTTMessage::appendRawData(void* buf, size_t len)
void SimpleMQTTMessage::dump()
{
#if SimpleMQTTVerbose
#ifdef SimpleMQTTVerbose
coutMtx.lock();
#endif
cout << "Dump of SimpleMQTTMessage (" << this << "):\n";
......@@ -227,7 +228,7 @@ void SimpleMQTTMessage::dump()
<< ", RETAIN=" << hex << (int)fixedHeader.bits.retain << "\n";
cout << " Bytes Processed: " << bytesProcessed << "\n";
cout << " Remaining Length: " << remainingLength << "\n";
#if SimpleMQTTVerbose
#ifdef SimpleMQTTVerbose
coutMtx.unlock();
#endif
}
......
......@@ -8,6 +8,7 @@
#include "simplemqttserver.h"
using namespace std;
using namespace boost::system;
static boost::mutex threadMtx;
......
......@@ -71,7 +71,8 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
@echo ""
@echo "Building Boost..."
$(eval B := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*boost/boost/' | sed 's/\ .*//'))
@cd $(DCDBDEPSPATH)/$(B) && ./bootstrap.sh --prefix=$(DCDBDEPLOYPATH) --with-libraries=atomic,chrono,date_time,exception,filesystem,program_options,thread,timer && ./b2 -j $(MAKETHREADS) install
@cd $(DCDBDEPSPATH)/$(B) && ./bootstrap.sh --prefix=$(DCDBDEPLOYPATH) \
--with-libraries=atomic,chrono,date_time,exception,filesystem,program_options,thread,timer && ./b2 -j $(MAKETHREADS) install
@echo ""
@echo "Buidling Thrift..."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment