From e0add8d5cb4fdb408efda292f64e029aa7ebbad2 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 18 Oct 2011 09:35:45 -0700 Subject: Fixing Darwin compilation: -) Using clang instead of gcc for the native target (*sigh*) -) Fixing libeio (*sigh*) -) "Fixing" the connect() call in Sockets because Darwin is stupid (*SIIIIIIIGH*) Although the Threads unit test isn't working properly. --- Makefile | 8 +++++--- darwin-config.h | 2 ++ includes/Exceptions.h | 1 + libeio | 2 +- src/Socket.cc | 3 ++- tests/test-Threads.cc | 1 + 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 498f331..051d84c 100644 --- a/Makefile +++ b/Makefile @@ -27,12 +27,14 @@ INCLUDES = includes libcoro libeio libev LIBS = ifeq ($(SYSTEM),Darwin) + CC = clang + CXX = clang++ CPPFLAGS += -fPIC LDFLAGS += -fPIC LIBS += pthread iconv CONFIG_H = darwin-config.h ARCH_FLAGS = -arch i386 - LD = g++ -arch i386 + LD = clang++ -arch i386 STRIP = strip -x ifeq ($(TRUESYSTEM),Linux) CROSSCOMPILE = true @@ -190,10 +192,10 @@ libBalau.a: $(BALAU_OBJECTS) dep: $(ALL_DEPS) %.dep : %.cc - $(CXX) $(CXXFLAGS) $(CPPFLAGS_NO_ARCH) -M -MF $@ $< + $(CXX) $(CXXFLAGS) $(CPPFLAGS_NO_ARCH) -M $< > $@ %.dep : %.c - $(CC) $(CFLAGS) $(CPPFLAGS_NO_ARCH) -M -MF $@ $< + $(CC) $(CFLAGS) $(CPPFLAGS_NO_ARCH) -M $< > $@ -include $(ALL_DEPS) diff --git a/darwin-config.h b/darwin-config.h index b37d5b5..63f568a 100644 --- a/darwin-config.h +++ b/darwin-config.h @@ -27,3 +27,5 @@ #define HAVE_POLL_H 1 #define HAVE_SYS_EVENT_H 1 #define HAVE_SYS_SELECT_H 1 + +#define __i386__ 1 \ No newline at end of file diff --git a/includes/Exceptions.h b/includes/Exceptions.h index b6730c1..e17e468 100644 --- a/includes/Exceptions.h +++ b/includes/Exceptions.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include diff --git a/libeio b/libeio index a7fb04f..f6a4a63 160000 --- a/libeio +++ b/libeio @@ -1 +1 @@ -Subproject commit a7fb04fdd2397af195ab09afd57372a30ba85de8 +Subproject commit f6a4a63e6978359f5742136c28a6412f4e0979ac diff --git a/src/Socket.cc b/src/Socket.cc index 65991a9..f14a8d3 100644 --- a/src/Socket.cc +++ b/src/Socket.cc @@ -390,7 +390,8 @@ bool Balau::Socket::connect(const char * hostname, int port) { do { Printer::elog(E_SOCKET, "Connecting now..."); - if (::connect(m_fd, (sockaddr *) &m_remoteAddr, sizeof(m_remoteAddr)) == 0) { + int r = ::connect(m_fd, (sockaddr *) &m_remoteAddr, sizeof(m_remoteAddr)); + if ((r == 0) || ((r < 0) && (errno == EISCONN))) { m_connected = true; m_connecting = false; diff --git a/tests/test-Threads.cc b/tests/test-Threads.cc index daebf5f..82bc9ec 100644 --- a/tests/test-Threads.cc +++ b/tests/test-Threads.cc @@ -12,6 +12,7 @@ class TestThread : public Thread { void * TestThread::proc() { Printer::log(M_STATUS, "Into a thread"); + return NULL; } void MainTask::Do() { -- cgit v1.2.3