Skip to content

Commit

Permalink
Merge pull request ceph#8298 from wjwithagen/wip-wjw-freebsd-autobuild-2
Browse files Browse the repository at this point in the history
build: many fixes for freebsd

Reviewed-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed May 16, 2016
2 parents b58173f + 5fdec84 commit 8980f84
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 18 deletions.
59 changes: 59 additions & 0 deletions README.FreeBSD
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

The FreeBSD build will build most of the tools in Ceph.
Note that the RBD dependant items will not work since FreeBSD does not have RBS

Build Prerequisites
===================

Compiling and building Ceph is tested on 11-CURRENT
It uses the CLANG toolset that is available, which needs to be atleast 3.7
Clang 3.4 (on 10.2-STABLE) does not have all required capabilites to compile everything

The following setup will get things running for FreeBSD:

- Install bash and link it in /bin
# requires root privileges
sudo pkg install bash
sudo ln -s /usr/local/bin/bash /bin/bash

Building Ceph
=============
- Go and start building
./do_freebsd.sh

Parts not (yet) included:
=========================

- RBD kernel client
Rados Block Devices is implemented in the Linux kernel
It seems that there used to be a userspace implementation first.
And perhaps ggated could be used as a template since it does some of the
same, other than just between 2 disks. And it has a userspace counterpart.
* @trociny suggests:
Userspace RBD is available under FreeBSD (both librbd and rbd tool
(without linux specific commands) are buildable).
- BlueStore.
FreeBSD and Linux have different AIO API, and that needs to be made compatible
Next to that is there discussion in FreeBSD about aio_cancel not working for all
devicetypes
- CephFS
Cython tries to access an internal field in dirent which does not compile

Tests that verify the correct working of the above are also excluded from the testset

Test not (yet) include:
=======================

- ceph-detect-init/run-tox.sh
Because the current implementation does not know anything about FreeBSD rc-init.
- Tests that make use on nosestests.
Calling these doest not really work since nostests is not in /usr/bin, and calling
thru /usr/bin/env/nosetests does not work on FreeBSD.
test/pybind/test_ceph_argparse.py
test/pybind/test_ceph_daemon.py

Things to investigate:
======================

- ceph-{osd,mon} need 2 signals before they actually terminate.

63 changes: 63 additions & 0 deletions autogen_freebsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Set the FreeBSD specific configure flags
FREEBSD_CONFIGURE_FLAGS=
if [ x`uname`x = x"FreeBSD"x ]; then
MAKE=gmake
# We need at least something > clang 3.4
# tested with package clang37 on FreeBSD 10.2 ( Which has 3.4 as default )
if clang -v 2>&1 | grep -q "3.8" ; then
CC=clang
CXX=clang++
elif [ -f /usr/local/bin/clang37 ]; then
CC=clang37
CXX=clang++37
else
echo "Need a better compiler"
exit 1
fi
CWARN=""
CLANGWARN="-Wno-unused-function -Wno-unused-local-typedef -Wno-inconsistent-missing-override"
CLANGWARN="$CLANGWARN -Wno-unused-private-field"
CLANGWARN="$CLANGWARN -Wno-varargs"
CLANGWARN="$CLANGWARN -Wno-gnu-designator"

# "-Wno-unused-local-typedef -Wno-mismatched-tags -Wno-macro-redefined -Wno-unused-function -Wno-unused-label -Wno-undefined-bool-conversion -Wno-unused-private-field -Wno-unused-local-typedef -Wno-uninitialized -Wno-gnu-designator -Wno-inconsistent-missing-override -Wno-deprecated-declarations -Wno-parentheses"

CFLAGS="-g -I/usr/local/include ${CWARN} ${CLANGWARN}"
CXXFLAGS="-g -DGTEST_USE_OWN_TR1_TUPLE=1 -I/usr/local/include ${CWARN} ${CLANGWARN}"
LDFLAGS="-g ${LDFLAGS} -L/usr/local/lib -export-dynamic -luuid"
FREEBSD_CONFIGURE_FLAGS="
--disable-silent-rules
--disable-gitversion
--with-debug
--with-rados
--without-rbd
--with-radosgw
--with-radosstriper
--with-mon
--with-osd
--with-mds
--with-radosgw
--with-nss
--without-tcmalloc
--without-libaio
--without-libxfs
--without-fuse
--without-lttng
--with-libzfs=no
--without-rocksdb
--without-cephfs
"
# --without-radosgw
# --with-gnu-ld
fi

CONFIGURE_FLAGS="${FREEBSD_CONFIGURE_FLAGS}"

# Export these so that ./configure will pick up
export MAKE
export CC
export CXX
export CFLAGS
export CXXFLAGS
export CONFIGURE_FLAGS
export LDFLAGS
11 changes: 9 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RPM_RELEASE=0
AC_SUBST(RPM_RELEASE)
if test -d ".git" ; then
AC_CHECK_PROG(GIT_CHECK, git, yes)
if test x"$GIT_CHECK" = x"yes"; then
if test x"$GIT_CHECK" = x"yes" -a x"$freebsd" != x"yes"; then
RPM_RELEASE=`if expr index $(git describe --always) '-' > /dev/null ; then git describe --always | cut -d- -f2- | tr '-' '.' ; else echo "0"; fi`
fi
fi
Expand Down Expand Up @@ -244,7 +244,14 @@ AC_CHECK_PROG(YASM_CHECK, yasm, yes)
if test x"$YASM_CHECK" = x"yes"; then
if yasm -f elf64 src/common/crc32c_intel_fast_asm.S -o /dev/null; then
echo 'we have a modern and working yasm'
if test `arch` = "x86_64" ; then
# FreeBSD has uname -p not arch(1), so do not exec arch
arch_x86_64=0
if test x`uname -p`x = x"amd64"x ; then
arch_x86_64=1
elif which arch 2>&1 > /dev/null; then
test x`arch`x = x"x86_64"x && arch_x86_64=1
fi
if test $arch_x86_64 -eq 1 ; then
echo 'we are x86_64'
arch_x32=0
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
Expand Down
19 changes: 19 additions & 0 deletions do_freebsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh -xve
NPROC=`sysctl -n hw.ncpu`

if [ x"$1"x = x"--deps"x ]; then
# we need bash first otherwise almost nothing will work
sudo pkg install bash
if [ ! -L /bin/bash ]; then
echo linking /bin/bash to /usr/local/bin/bash
ln -s /usr/local/bin/bash /bin/bash
fi
sudo ./install-deps.sh
fi
. ./autogen_freebsd.sh
./autogen.sh
./configure ${CONFIGURE_FLAGS}
( cd src/gmock/gtest; patch < /usr/ports/devel/googletest/files/patch-bsd-defines )
gmake -j$NPROC ENABLE_GIT_VERSION=OFF
gmake -j$NPROC check ENABLE_GIT_VERSION=OFF CEPH_BUFFER_NO_BENCH=yes

37 changes: 37 additions & 0 deletions install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,43 @@ if test $(id -u) != 0 ; then
fi
export LC_ALL=C # the following is vulnerable to i18n

if [ x`uname`x = xFreeBSDx ]; then
$SUDO pkg install -yq \
devel/git \
devel/gmake \
devel/automake \
devel/yasm \
devel/boost-all \
devel/valgrind \
devel/pkgconf \
devel/libatomic_ops \
devel/libedit \
devel/libtool \
devel/google-perftools \
lang/cython \
devel/py-virtualenv \
databases/leveldb \
net/openldap24-client \
security/nss \
security/cryptopp \
archivers/snappy \
ftp/curl \
misc/e2fsprogs-libuuid \
textproc/expat2 \
textproc/libxml2 \
textproc/xmlstarlet \
emulators/fuse \
java/junit \
lang/python27 \
devel/py-argparse \
devel/py-nose \
www/py-flask \
www/fcgi \
sysutils/flock \

exit
fi

if test -f /etc/redhat-release ; then
$SUDO yum install -y redhat-lsb-core
fi
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile-env.am
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ AM_COMMON_CPPFLAGS = \
-D__STDC_FORMAT_MACROS \
-D_GNU_SOURCE \
-DCEPH_LIBDIR=\"${libdir}\" \
-DCEPH_PKGLIBDIR=\"${pkglibdir}\" \
-DGTEST_USE_OWN_TR1_TUPLE=0
-DCEPH_PKGLIBDIR=\"${pkglibdir}\"

if LINUX
AM_COMMON_CPPFLAGS += \
-DGTEST_USE_OWN_TR1_TUPLE=0 \
-D_REENTRANT
endif

Expand Down
11 changes: 8 additions & 3 deletions src/kv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ if WITH_SLIBROCKSDB
# build rocksdb with its own makefile
# for some stupid reason this needs -fPIC...
# PORTABLE=1 fixes the aarch64 build (-march=native doesn't work there)
NPROC = nproc

ROCKSDBCXX_FLAGS = "-fPIC"
if FREEBSD
NPROC = sysctl -n hw.ncpu
NPROC = sysctl -n hw.ncpu
ROCKSDBCXX_FLAGS += "-Wmismatched-tags"
else
NPROC = nproc
endif

rocksdb/librocksdb.a:
cd rocksdb && CC="${CC}" CXX="${CXX}" EXTRA_CXXFLAGS=-fPIC PORTABLE=1 $(MAKE) -j$(shell ${NPROC}) static_lib
cd rocksdb && CC="${CC}" CXX="${CXX}" EXTRA_CXXFLAGS="${ROCKSDBCXX_FLAGS}" PORTABLE=1 ${MAKE} -j$(shell ${NPROC}) static_lib
libkv_a_CXXFLAGS += -I rocksdb/include -fPIC
libkv_a_SOURCES += kv/RocksDBStore.cc
libkv_a_LIBADD += rocksdb/librocksdb.a
Expand Down
14 changes: 12 additions & 2 deletions src/rgw/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ librgw_la_SOURCES = \

if WITH_OPENLDAP
librgw_la_SOURCES += rgw/rgw_ldap.cc

endif

librgw_la_CXXFLAGS = -Woverloaded-virtual -fPIC -I$(srcdir)/xxHash \
Expand All @@ -113,8 +114,17 @@ LIBRGW_DEPS += \
-lcurl \
-lexpat \
-lm \
-lfcgi \
-ldl
-lfcgi

if LINUX
LIBRGW_DEPS += \
-ldl
endif

if FREEBSD
LIBRGW_DEPS += \
-lldap
endif

librgw_la_LIBADD = $(LIBRGW_DEPS) \
$(PTHREAD_LIBS) $(RESOLV_LIBS) libglobal.la \
Expand Down
17 changes: 9 additions & 8 deletions src/test/Makefile-client.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ceph_dencoder_SOURCES = \
$(DENCODER_SOURCES)
ceph_dencoder_LDADD = \
$(LIBRGW) \
$(LIBRGW_DEPS) \
$(LIBRADOS) \
$(LIBRBD_TYPES) \
$(LIBOSD_TYPES) \
Expand Down Expand Up @@ -680,7 +681,7 @@ endif # WITH_BUILD_TESTS

ceph_test_cors_SOURCES = test/test_cors.cc
ceph_test_cors_LDADD = \
$(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \
$(LIBRADOS) $(LIBRGW) $(LIBRGW_DEPS) $(CEPH_GLOBAL) \
$(UNITTEST_LDADD) \
-lcurl -lexpat
ceph_test_cors_CXXFLAGS = $(UNITTEST_CXXFLAGS)
Expand Down Expand Up @@ -713,7 +714,7 @@ bin_DEBUGPROGRAMS += ceph_test_rgw_obj

ceph_test_cls_rgw_meta_SOURCES = test/test_rgw_admin_meta.cc
ceph_test_cls_rgw_meta_LDADD = \
$(LIBRGW) $(LIBRADOS) $(CEPH_GLOBAL) \
$(LIBRGW) $(LIBRGW_DEPS) $(LIBRADOS) $(CEPH_GLOBAL) \
$(UNITTEST_LDADD) $(CRYPTO_LIBS) \
-lcurl -lexpat \
libcls_timeindex_client.la \
Expand All @@ -736,7 +737,7 @@ bin_DEBUGPROGRAMS += ceph_test_cls_rgw_log

ceph_test_cls_rgw_opstate_SOURCES = test/test_rgw_admin_opstate.cc
ceph_test_cls_rgw_opstate_LDADD = \
$(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \
$(LIBRADOS) $(LIBRGW) $(LIBRGW_DEPS) $(CEPH_GLOBAL) \
$(UNITTEST_LDADD) $(CRYPTO_LIBS) \
-lcurl -lexpat \
libcls_version_client.la libcls_log_client.la \
Expand All @@ -758,31 +759,31 @@ bin_DEBUGPROGRAMS += ceph_test_cls_rgw
librgw_file_SOURCES = test/librgw_file.cc
librgw_file_CXXFLAGS = -I$(srcdir)/xxHash $(UNITTEST_CXXFLAGS)
librgw_file_LDADD = $(UNITTEST_LDADD) \
librgw.la librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
$(LIBRGW) $(LIBRGW_DEPS) librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
bin_DEBUGPROGRAMS += librgw_file

librgw_file_cd_SOURCES = test/librgw_file_cd.cc
librgw_file_cd_CXXFLAGS = -I$(srcdir)/xxHash $(UNITTEST_CXXFLAGS)
librgw_file_cd_LDADD = $(UNITTEST_LDADD) \
librgw.la librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
$(LIBRGW) $(LIBRGW_DEPS) librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
bin_DEBUGPROGRAMS += librgw_file_cd

librgw_file_gp_SOURCES = test/librgw_file_gp.cc
librgw_file_gp_CXXFLAGS = -I$(srcdir)/xxHash $(UNITTEST_CXXFLAGS)
librgw_file_gp_LDADD = $(UNITTEST_LDADD) \
librgw.la librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
$(LIBRGW) $(LIBRGW_DEPS) librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
bin_DEBUGPROGRAMS += librgw_file_gp

librgw_file_aw_SOURCES = test/librgw_file_aw.cc
librgw_file_aw_CXXFLAGS = -I$(srcdir)/xxHash $(UNITTEST_CXXFLAGS)
librgw_file_aw_LDADD = $(UNITTEST_LDADD) \
librgw.la librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
$(LIBRGW) $(LIBRGW_DEPS) librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
bin_DEBUGPROGRAMS += librgw_file_aw

librgw_file_nfsns_SOURCES = test/librgw_file_nfsns.cc
librgw_file_nfsns_CXXFLAGS = -I$(srcdir)/xxHash $(UNITTEST_CXXFLAGS)
librgw_file_nfsns_LDADD = $(UNITTEST_LDADD) \
librgw.la librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
$(LIBRGW) $(LIBRGW_DEPS) librados.la $(PTHREAD_LIBS) $(CEPH_GLOBAL) $(EXTRALIBS)
bin_DEBUGPROGRAMS += librgw_file_nfsns

#
Expand Down
11 changes: 11 additions & 0 deletions src/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ UNITTEST_LDADD += \
-lsocket -lnsl
endif

if FREEBSD
UNITTEST_LDADD += \
-lexecinfo
endif

unittest_addrs_SOURCES = test/test_addrs.cc
unittest_addrs_CXXFLAGS = $(UNITTEST_CXXFLAGS)
unittest_addrs_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL)
Expand Down Expand Up @@ -447,8 +452,14 @@ unittest_async_compressor_CXXFLAGS = $(UNITTEST_CXXFLAGS)
unittest_async_compressor_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) $(LIBCOMPRESSOR) $(LIBCOMMON)
check_PROGRAMS += unittest_async_compressor

if LINUX
#
# XXX FREEBSD
# These tests use nosetests and getting that to work thusfar has not worked
#
check_SCRIPTS += test/pybind/test_ceph_argparse.py
check_SCRIPTS += test/pybind/test_ceph_daemon.py
endif

ceph_test_objectcacher_stress_SOURCES = \
test/osdc/object_cacher_stress.cc \
Expand Down
Loading

0 comments on commit 8980f84

Please sign in to comment.