【问题标题】:libatomic is missing on macOS Mojave 10.14.2macOS Mojave 10.14.2 上缺少 libatomic
【发布时间】:2019-01-01 03:02:38
【问题描述】:

尝试在 macOS Mojave (10.14.2) 上从源代码构建 mongodb 4.1.6(最新版本)会出现配置错误。缺少一些libatomic。我尝试在网上搜索解决方案,但到目前为止都没有。

看起来最有希望的解决方案来自这里:Can't compile C program on a Mac after upgrade to Mojave

但它也没有解决我的问题。

这里是配置输出:

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

这里是config.log 的详细信息:

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

任何建议都会有所帮助。

【问题讨论】:

    标签: mongodb macos-mojave


    【解决方案1】:

    问题根本不在于 libatomic。错误是因为这个问题ld: warning: text-based stub file are out of sync. Falling back to library file for linking

    修复

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

    然后执行这个脚本:https://gist.github.com/karololszacki/dec8fd80b20e081b0e91a6bbd639c8fe

    【讨论】:

      猜你喜欢
      • 2019-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-12
      • 1970-01-01
      • 2020-06-15
      • 2019-03-02
      • 2019-07-11
      相关资源
      最近更新 更多