Solaris compilation/build changes

Signed-off-by: Rohan Mars <code@rohanmars.com>
This commit is contained in:
Rohan Mars 2015-10-26 21:50:30 -07:00
parent 2a1b9f9ac9
commit b7cc9d4fc3
11 changed files with 83 additions and 2 deletions

30
README.solaris Normal file
View File

@ -0,0 +1,30 @@
The Solaris build will only build the librados library.
Build Prerequisites
===================
The following Solaris packages are required for compilation:
git
autoconf
libtool
automake
gcc-c++-48
gnu-make
(use the "pkg install <packagename>" command to install, as root)
Download and Compile Boost 1.59 (or higher)
Building Ceph
=============
export LDFLAGS="-L<pathtoboost>/boost_1_59_0/stage/lib"
export CPPFLAGS="-I<pathtoboost>/boost/boost_1_59_0"
./autogen.sh
./configure --disable-server --without-fuse --without-tcmalloc --without-libatomic-ops --without-libaio --without-libxfs
cd src
gmake librados.la

View File

@ -67,10 +67,14 @@ linux*)
freebsd*)
freebsd="yes"
;;
solaris*)
solaris="yes"
;;
esac
AM_CONDITIONAL(LINUX, test x"$linux" = x"yes")
AM_CONDITIONAL(FREEBSD, test x"$freebsd" = x"yes")
AM_CONDITIONAL(DARWIN, test x"$darwin" = x"yes")
AM_CONDITIONAL(SOLARIS, test x"$solaris" = x"yes")
# Checks for programs.
AC_PROG_CXX
@ -956,6 +960,7 @@ AC_CHECK_HEADERS([ \
sys/time.h \
sys/vfs.h \
sys/xattr.h \
sys/cdefs.h \
syslog.h \
utime.h \
])

View File

@ -120,6 +120,9 @@ AM_COMMON_CFLAGS = \
if !CLANG
AM_COMMON_CFLAGS += -rdynamic
endif
if SOLARIS
AM_COMMON_CFLAGS += -Wno-unused-local-typedefs
endif
AM_CFLAGS = $(AM_COMMON_CFLAGS) $(HARDENING_CFLAGS)
AM_CPPFLAGS = $(AM_COMMON_CPPFLAGS)
@ -133,6 +136,11 @@ if !CLANG
AM_CXXFLAGS += -Wstrict-null-sentinel
endif
# solaris harding
if SOLARIS
AM_CXXFLAGS += -lssp_nonshared
endif
# note: this is position dependant, it affects the -l options that
# come after it on the command line. when you use ${AM_LDFLAGS} in
# later rules, take care where you place it. for more information, see

View File

@ -30,8 +30,9 @@
/* $KAME: sctp_crc32.c,v 1.12 2005/03/06 16:04:17 itojun Exp $ */
#ifdef HAVE_SYS_TYPES_H
#include <sys/cdefs.h>
#endif
#if 0
__FBSDID("$FreeBSD: src/sys/netinet/sctp_crc32.c,v 1.8 2007/05/08 17:01:10 rrs Exp $");

View File

@ -40,9 +40,17 @@ void install_sighandler(int signum, signal_handler_t handler, int flags)
ret = sigaction(signum, &act, &oldact);
if (ret != 0) {
char buf[1024];
#if defined(__sun)
char message[SIG2STR_MAX];
sig2str(signum,message);
snprintf(buf, sizeof(buf), "install_sighandler: sigaction returned "
"%d when trying to install a signal handler for %s\n",
ret, message);
#else
snprintf(buf, sizeof(buf), "install_sighandler: sigaction returned "
"%d when trying to install a signal handler for %s\n",
ret, sys_siglist[signum]);
#endif
dout_emergency(buf);
exit(1);
}
@ -79,8 +87,15 @@ static void handle_fatal_signal(int signum)
// case, SA_RESETHAND specifies that the default signal handler--
// presumably dump core-- will handle it.
char buf[1024];
#if defined(__sun)
char message[SIG2STR_MAX];
sig2str(signum,message);
snprintf(buf, sizeof(buf), "*** Caught signal (%s) **\n "
"in thread %llx\n", message, (unsigned long long)pthread_self());
#else
snprintf(buf, sizeof(buf), "*** Caught signal (%s) **\n "
"in thread %llx\n", sys_siglist[signum], (unsigned long long)pthread_self());
#endif
dout_emergency(buf);
pidfile_remove();

View File

@ -11,6 +11,9 @@
#elif defined(__FreeBSD__)
#include <sys/cdefs.h>
#define __GNUC_PREREQ(minor, major) __GNUC_PREREQ__(minor, major)
#elif defined(__sun)
#include "include/compat.h"
#include <assert.h>
#endif
#ifdef __CEPH__

View File

@ -53,4 +53,11 @@
#define lseek64(fd, offset, whence) lseek(fd, offset, whence)
#endif
#if defined(__sun)
#define LOG_AUTHPRIV (10<<3)
#define LOG_FTP (11<<3)
#define __STRING(x) "x"
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#endif
#endif /* !CEPH_COMPAT_H */

View File

@ -62,7 +62,9 @@ inline void decode_raw(T& t, bufferlist::iterator &p)
inline void decode(type &v, bufferlist::iterator& p) { __ASSERT_FUNCTION decode_raw(v, p); }
WRITE_RAW_ENCODER(__u8)
#ifndef _CHAR_IS_SIGNED
WRITE_RAW_ENCODER(__s8)
#endif
WRITE_RAW_ENCODER(char)
WRITE_RAW_ENCODER(ceph_le64)
WRITE_RAW_ENCODER(ceph_le32)

View File

@ -83,6 +83,11 @@ typedef off_t loff_t;
typedef off_t off64_t;
#endif
#ifdef __sun
typedef off_t loff_t;
#endif
// -- io helpers --
template<class A, class B>

View File

@ -27,7 +27,7 @@
#include <vector>
#include <map>
#if defined(DARWIN) || defined(__FreeBSD__)
#if defined(DARWIN) || defined(__FreeBSD__) || defined(__sun)
#include <sys/statvfs.h>
#else
#include <sys/vfs.h> /* or <sys/statfs.h> */

View File

@ -136,6 +136,11 @@ UNITTEST_LDADD = \
$(top_builddir)/src/gmock/gtest/lib/libgtest.la \
$(PTHREAD_LIBS)
if SOLARIS
UNITTEST_LDADD += \
-lsocket -lnsl
endif
unittest_addrs_SOURCES = test/test_addrs.cc
unittest_addrs_CXXFLAGS = $(UNITTEST_CXXFLAGS)
unittest_addrs_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL)