[Problem] Building percona-server-mongodb-3.2.9-2.1 from source on macOS Sierra

57 views
Skip to first unread message

Mark G.

unread,
Oct 6, 2016, 1:16:36 PM10/6/16
to Percona Discussion
Hi all,

Hopefully someone might have had the same issue and know they resolution, or a workaround. I'm trying to build the latest release on my machine so I can play around with the in-memory storage engine as a memcached replacement. However, I'm running into a compiling issue that I see no obvious way to fix. Here is a snipped version of the scons checks at the top, and the last several lines before the error:

$ scons all

scons: Reading SConscript files ...

Mkdir("build/scons")

scons version: 2.5.0

python version: 2 7 10 'final' 0

Checking whether the C++ compiler works... yes

Checking whether the C compiler works... yes

Checking if C++ compiler "g++" is GCC... no

Checking if C++ compiler "g++" is clang... yes

Checking if C compiler "gcc" is clang... yes

Detected a x86_64 processor

Checking if target OS osx is supported by the toolchain yes

Checking if C compiler is clang 3.4 (or Apple XCode 5.1.1) or newer...yes

Checking if C++ compiler is clang 3.4 (or Apple XCode 5.1.1) or newer...yes

Checking if C compiler supports -Wno-unused-local-typedefs... yes

Checking if C compiler supports -Wno-unused-function... yes

Checking if C compiler supports -Wno-unused-private-field... yes

Checking if C compiler supports -Wno-deprecated-declarations... yes

Checking if C compiler supports -Wno-tautological-constant-out-of-range-compare... yes

Checking if C compiler supports -Wno-unused-const-variable... yes

Checking if C compiler supports -Wno-unused-but-set-variable... no

Checking if C compiler supports -Wno-missing-braces... yes

Checking if C compiler supports -Wno-inconsistent-missing-override... yes

Checking if C compiler supports -Wno-potentially-evaluated-expression... yes

Checking if C++ compiler supports -Wpessimizing-move... yes

Checking if C++ compiler supports -Wredundant-move... yes

Checking if C++ compiler supports -Wno-maybe-uninitialized... no

Checking if implicit boost::shared_ptr null conversion is supported... yes

Checking if we are using libstdc++... no

Checking if C++ compiler supports -std=c++11... yes

Checking if C compiler supports -std=c99... yes

Checking for C++11... yes

Checking for memset_s... yes

Checking for C function strnlen()... yes

Checking if we are on a POSIX system... yes

Checking if the POSIX monotonic clock is supported... no

Checking off_t is 8 bytes... yes

Checking if linker supports -fuse-ld=gold... no

Checking if linker supports -Wl,-z,noexecstack... no

Checking if linker supports -Wl,--warn-execstack... no

Checking if C compiler supports -fno-builtin-memcmp... yes

Checking for storage class thread_local yes

Checking for storage class __thread yes

Checking for storage class __declspec(thread) no

Checking for C++11 is_trivially_copyable support... yes

Checking for C++14 std::make_unique support... no

Checking for C++11 std::align support... no

Checking for C library rt... no

Checking for C library dl... yes

Checking for C library pthread... yes

Checking for C++ header file execinfo.h... yes

Checking whether backtrace is declared... yes

Checking whether backtrace_symbols is declared... yes

Checking whether backtrace_symbols_fd is declared... yes

Checking for C library pcap... yes

Checking if std::atomic<int64_t> works... yes

Checking if std::atomic<uint64_t> works... yes

Checking if std::atomic<int32_t> works... yes

Checking if std::atomic<uint32_t> works... yes

Checking for C function fallocate()... no

Checking for C function sync_file_range()... no

Checking for C header file x86intrin.h... yes

scons: done reading SConscript files.

scons: Building targets ...


<BIG SNIP>

Compiling build/opt/mongo/db/storage/kv_heap/kv_heap_sorted_data_impl_test_harness.o

Compiling build/opt/mongo/db/storage/kv/dictionary/kv_dictionary.o

Compiling build/opt/mongo/db/storage/kv/dictionary/kv_dictionary_update.o

Generating placeholder library build/opt/mongo/db/storage/kv/dictionary/libkv_dictionary.a

Skipping ranlib for build/opt/mongo/db/storage/kv/dictionary/libkv_dictionary.a

Compiling build/opt/mongo/db/storage/kv/dictionary/kv_engine_impl.o

In file included from src/mongo/db/storage/kv/dictionary/kv_engine_impl.cpp:29:

src/mongo/db/storage/kv/dictionary/kv_record_store.h:37:5: error: class 'CollectionOptions' was previously declared as a struct

     [-Werror,-Wmismatched-tags]

   class CollectionOptions;

   ^

src/mongo/db/catalog/collection_options.h:38:8: note: previous use is here

struct CollectionOptions {

       ^

src/mongo/db/storage/kv/dictionary/kv_record_store.h:37:5: note: did you mean struct here?

   class CollectionOptions;

   ^~~~~

   struct

1 error generated.

scons: *** [build/opt/mongo/db/storage/kv/dictionary/kv_engine_impl.o] Error 1

scons: building terminated because of errors.



Any thoughts?

--Mark G.

David Bennett

unread,
Oct 7, 2016, 5:26:56 AM10/7/16
to Percona Discussion
Hi Mark,

While we currently do not support PSMDB on MacOS,  you might try disabling the compiler check:

--- a/src/mongo/db/storage/kv/dictionary/SConscript
+++ b/src/mongo/db/storage/kv/dictionary/SConscript
@@ -1,5 +1,10 @@
Import("env")
 
+env = env.Clone()
+
+if env.ToolchainIs('clang'):
+    env.Append(CCFLAGS=['-Wno-mismatched-tags'])
+
env.Library(
    target='kv_dictionary',
    source=[
diff --git a/src/third_party/rocksdb b/src/third_party/rocksdb
--- a/src/third_party/rocksdb
+++ b/src/third_party/rocksdb

Mark G.

unread,
Oct 7, 2016, 12:07:42 PM10/7/16
to Percona Discussion
Thanks David. I was able to get it built (with passing tests) by adding your patch to two SConscript files. To help with the google-fu of others trying to do this:

Help on Installing Percona Server for MongoDB on macOS Sierra including MongoRocks (RocksDB) and inMemory Storage Engines
This is current for PSMDB 3.2.9-2.1. This uses Homebrew package management.
  1. brew install rocksdb (This is only needed if you want the MongoRocks storage engine)
  2. Download and untar the source code found at: https://www.percona.com/downloads/percona-server-mongodb-3.2/LATEST/source/
  3. In your untarred source folder, open these two files for editing:
    1. src/mongo/db/storage/kv/dictionary/SConscript
    2. src/mongo/db/storage/kv_heap/SConscript
  4. Add the following lines below the first line of each file:
    1. env = env.Clone()
      env
      .Append(CCFLAGS=['-Wno-mismatched-tags'])
  5. In the untarred source folder run: scons install --inmemory --wiredtiger --rocksdb all
  6. Go get a cup of coffee or lunch, the build takes awhile.
  7. When done, the binaries to put into your /usr/local/sbin are located in build/install/bin.
  8. You will need to make your own startup service (I cribbed from the Homebrew MongoDB community install) and be sure to have a configuration file. There is a default one at percona-packaging/conf/mongod.conf in the untarred source directory.
--Mark
Reply all
Reply to author
Forward
0 new messages