Skip to content

Commit

Permalink
Solaris compilation/build changes
Browse files Browse the repository at this point in the history
Signed-off-by: Rohan Mars <[email protected]>
  • Loading branch information
rohanmars committed Nov 13, 2015
1 parent 2a1b9f9 commit b7cc9d4
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 2 deletions.
30 changes: 30 additions & 0 deletions README.solaris
Original file line number Diff line number Diff line change
@@ -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

5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -956,6 +960,7 @@ AC_CHECK_HEADERS([ \
sys/time.h \
sys/vfs.h \
sys/xattr.h \
sys/cdefs.h \
syslog.h \
utime.h \
])
Expand Down
8 changes: 8 additions & 0 deletions src/Makefile-env.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/common/sctp_crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 $");

Expand Down
15 changes: 15 additions & 0 deletions src/global/signal_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();

Expand Down
3 changes: 3 additions & 0 deletions src/include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
7 changes: 7 additions & 0 deletions src/include/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 2 additions & 0 deletions src/include/encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/os/ObjectStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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> */
Expand Down
5 changes: 5 additions & 0 deletions src/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b7cc9d4

Please sign in to comment.