简体   繁体   中英

libatomic is missing on macOS Mojave 10.14.2

Trying to build mongodb 4.1.6 (the latest) from source on macOS Mojave (10.14.2) is giving configuration error. Some libatomic is missing. I tried searching for the solution on the web but none has worked so far.

Solution that looked most promising was from here: Can't compile C program on a Mac after upgrade to Mojave

But it didn't solve my problem either.

Here is the configuration outout:

scons: Reading SConscript files ...
scons version: 3.0.1
python version: 2 7 10 'final' 0
Checking whether the C compiler works... yes
Checking whether the C++ compiler works... yes
Checking that the C++ compiler can link a C++ program... 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 macOS is supported by the toolchain... yes
Checking if C compiler is clang 3.8 (or Apple XCode 8.3.2) or newer...yes
Checking if C++ compiler is clang 3.8 (or Apple XCode 8.3.2) or newer...yes
Checking for sufficient macOS target version minimum... 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-tautological-constant-compare... yes
Checking if C compiler supports -Wno-tautological-unsigned-zero-compare... yes
Checking if C compiler supports -Wno-tautological-unsigned-enum-zero-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 C++ compiler supports -Wno-undefined-var-template... yes
Checking if C++ compiler supports -Wno-instantiation-after-specialization... yes
Checking if C compiler supports -Wno-unused-lambda-capture... yes
Checking if C compiler supports -Wno-exceptions... yes
Checking if C compiler supports -Wno-format-truncation... no
Checking if C++ compiler supports -Wno-class-memaccess... no
Checking -Wnon-virtual-dtor for false positives... no
Checking if C compiler supports -Wunguarded-availability... yes
Checking if C compiler supports -fstack-protector-strong... yes
Checking if we are using libstdc++... no
Checking if C++ compiler supports -std=c++14... yes
Checking if C compiler supports -std=c11... yes
Checking for C++14... 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,--build-id... no
Checking if linker supports -Wl,--hash-style=gnu... no
Checking if linker supports -Wl,-z,noexecstack... no
Checking if linker supports -Wl,--warn-execstack... no
Checking if linker supports -Wl,-z,relro... no
Checking if C compiler supports -fno-builtin-memcmp... yes
Checking for storage class thread_local yes
Checking for C++14 std::enable_if_t support...yes
Checking for C++14 std::make_unique support... yes
Checking if pthread_setname_np is supported... no
Using SSL Provider: apple
Checking for C library rt... no
Checking for C library dl... no
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... no
Checking for C library wpcap... no
Checking if std::atomic<int64_t> works... no
Checking for C library atomic... no
Some atomic ops are not intrinsically supported, but no libatomic found
See /Users/dibyendu/Downloads/build/mongo-virtual-env/mongo/build/scons/config.log for details

And here is the config.log details:

scons: Configure: Checking if std::atomic<int64_t> works... 
build/scons/opt/sconf_temp/conftest_64.cpp <-
  |
  |#include <atomic>
  |
  |int main(int argc, char* argv[]) {
  |    std::atomic<int64_t> x;
  |
  |    x.store(0);
  |    // Use argc to ensure we can't optimize everything away.
  |    int64_t y = argc;
  |    x.fetch_add(y);
  |    x.fetch_sub(y);
  |    x.exchange(y);
  |    if (x.compare_exchange_strong(y, x) && x.is_lock_free())
  |        return 0;
  |    return x.load();
  |}
  |
Compiling build/scons/opt/sconf_temp/conftest_64.o
Linking build/scons/opt/sconf_temp/conftest_64
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
ld: fatal warning(s) induced error (-fatal_warnings)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: Configure: no

scons: Configure: Checking for C library atomic... 
build/scons/opt/sconf_temp/conftest_65.c <-
  |
  |
  |
  |int
  |main() {
  |  
  |return 0;
  |}
  |
Compiling build/scons/opt/sconf_temp/conftest_65.o
Linking build/scons/opt/sconf_temp/conftest_65
ld: library not found for -latomic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: Configure: no

Any suggestion would be helpful.

The problem was not with libatomic at all. The error was coming because of this issue ld: warning: text-based stub file are out of sync. Falling back to library file for linking

Fix :

$ rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install 

and then executing this script: https://gist.github.com/karololszacki/dec8fd80b20e081b0e91a6bbd639c8fe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM