folly icon indicating copy to clipboard operation
folly copied to clipboard

Libatomic issue

Open kolchanov opened this issue 4 years ago • 16 comments

I'm trying to build folly on centos 8 g++ (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3)

cmake . CMake Error at CMake/folly-deps.cmake:150 (message): unable to link C++ std::atomic code: you may need to install GNU libatomic

I have installed libatomic package

yum search libatomic Last metadata expiration check: 0:23:57 ago on Wed 02 Oct 2019 10:08:15 PM UTC. ==================================================================================== Name Exactly Matched: libatomic ==================================================================================== libatomic.x86_64 : The GNU Atomic library libatomic.i686 : The GNU Atomic library libatomic.x86_64 : The GNU Atomic library ======================================================================================== Name Matched: libatomic ======================================================================================== libatomic_ops.x86_64 : Atomic memory update operations libatomic_ops.i686 : Atomic memory update operations libatomic_ops.x86_64 : Atomic memory update operations libatomic-static.i686 : The GNU Atomic static library libatomic-static.x86_64 : The GNU Atomic static library

kolchanov avatar Oct 02 '19 22:10 kolchanov

Have the same issue with CentOS 7.6 on the last folly release from few days ago..

cmake ..

CMake Error at CMake/folly-deps.cmake:164 (message): unable to link C++ std::atomic code: you may need to install GNU libatomic Call Stack (most recent call first): CMakeLists.txt:113 (include)

GCC: gcc --version gcc (GCC) 9.2.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

libatomic: yum search libatomic ============================================================ N/S matched: libatomic ============================================================= devtoolset-3-libatomic-devel.x86_64 : The GNU Atomic static library devtoolset-4-libatomic-devel.x86_64 : The GNU Atomic static library devtoolset-6-libatomic-devel.x86_64 : The GNU Atomic static library devtoolset-7-libatomic-devel.x86_64 : The GNU Atomic static library devtoolset-8-libatomic-devel.x86_64 : The GNU Atomic static library libatomic.x86_64 : The GNU Atomic library libatomic.i686 : The GNU Atomic library libatomic-static.x86_64 : The GNU Atomic static library libatomic-static.i686 : The GNU Atomic static library libatomic_ops-devel.i686 : Atomic memory update operations libatomic_ops-devel.x86_64 : Atomic memory update operations

bartuaf avatar Oct 28 '19 09:10 bartuaf

I have the same problem with centos7.7 . What should I do for it ?

z6833 avatar Dec 04 '19 01:12 z6833

  • I have the same problem with centos7.2 .

cmake ../ -- Could NOT find DOUBLE_CONVERSION (missing: DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR) -- Using third-party bundled double-conversion -- Found gflags from package config /lib64/cmake/gflags/gflags-config.cmake -- Found libevent: /usr/lib64/libevent.so -- Could NOT find LibLZMA (missing: LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET) (found version "5.2.2") -- Found LZ4: /usr/lib64/liblz4.so -- Could NOT find ZSTD (missing: ZSTD_LIBRARY ZSTD_INCLUDE_DIR) -- Could NOT find LIBDWARF (missing: LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR) -- Could NOT find LIBIBERTY (missing: LIBIBERTY_LIBRARY LIBIBERTY_INCLUDE_DIR) -- Could NOT find LIBAIO (missing: LIBAIO_LIBRARY LIBAIO_INCLUDE_DIR) -- Could NOT find LIBURING (missing: LIBURING_LIBRARY LIBURING_INCLUDE_DIR) -- Could NOT find LIBSODIUM (missing: LIBSODIUM_LIBRARY LIBSODIUM_INCLUDE_DIR) -- Setting FOLLY_USE_SYMBOLIZER: OFF CMake Error at CMake/folly-deps.cmake:168 (message): unable to link C++ std::atomic code: you may need to install GNU libatomic Call Stack (most recent call first): CMakeLists.txt:113 (include)

-- Configuring incomplete, errors occurred! See also "/.../folly/_build/CMakeFiles/CMakeOutput.log". See also "/.../folly_test/folly/_build/CMakeFiles/CMakeError.log".

$rpm -qa | grep libatomic libatomic-8.3.1-1.alios7.x86_64 libatomic-static-8.3.1-1.alios7.x86_64

  • CMakeError.log i checked error log, I'm confused with the error log. <<<<< Run Build Command(s):/usr/bin/gmake cmTC_07f4a/fast && /usr/bin/gmake -f CMakeFiles/cmTC_07f4a.dir/build.make CMakeFiles/cmTC_07f4a.dir/build
    gmake[1]: Entering directory /home/longfei.alf/folly_test/folly/_build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_07f4a.dir/src.c.o /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_07f4a.dir/src.c.o -c /home/longfei.alf/folly_test/folly/_build/CMakeFiles/CMakeTmp/src.c Linking C executable cmTC_07f4a /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_07f4a.dir/link.txt --verbose=1 /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic CMakeFiles/cmTC_07f4a.dir/src.c.o -o cmTC_07f4a CMakeFiles/cmTC_07f4a.dir/src.c.o: In function main': src.c:(.text+0x2d): undefined reference to pthread_create' src.c:(.text+0x39): undefined reference to pthread_detach' src.c:(.text+0x4a): undefined reference to pthread_join' collect2: error: ld returned 1 exit status gmake[1]: *** [cmTC_07f4a] Error 1 gmake[1]: Leaving directory /home/longfei.alf/folly_test/folly/_build/CMakeFiles/CMakeTmp' gmake: *** [cmTC_07f4a/fast] Error 2 >>>>

anlongfei avatar Dec 05 '19 10:12 anlongfei

Try: $ cmake .. -DCMAKE_CXX_FLAGS='-Wno-local-type-template-args'

Make sure to remove the _build directory, make sure cmake started from scratch.

What is happening is that the "test" to check if libatomic is needed is triggering a warning because it uses a local type in a template.

pikatchu avatar Dec 10 '19 22:12 pikatchu

Try: $ cmake .. -DCMAKE_CXX_FLAGS='-Wno-local-type-template-args'

Make sure to remove the _build directory, make sure cmake started from scratch.

What is happening is that the "test" to check if libatomic is needed is triggering a warning because it uses a local type in a template.

still not work.

cmake .. -DCMAKE_CXX_FLAGS='-Wno-local-type-template-args' -- Could NOT find DOUBLE_CONVERSION (missing: DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR) -- Using third-party bundled double-conversion -- Found gflags from package config /lib64/cmake/gflags/gflags-config.cmake -- Found libevent: /usr/lib64/libevent.so -- Could NOT find LibLZMA (missing: LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET) (found version "5.2.2") -- Found LZ4: /usr/lib64/liblz4.so -- Could NOT find ZSTD (missing: ZSTD_LIBRARY ZSTD_INCLUDE_DIR) -- Could NOT find LIBDWARF (missing: LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR) -- Could NOT find LIBIBERTY (missing: LIBIBERTY_LIBRARY LIBIBERTY_INCLUDE_DIR) -- Could NOT find LIBAIO (missing: LIBAIO_LIBRARY LIBAIO_INCLUDE_DIR) -- Could NOT find LIBURING (missing: LIBURING_LIBRARY LIBURING_INCLUDE_DIR) -- Could NOT find LIBSODIUM (missing: LIBSODIUM_LIBRARY LIBSODIUM_INCLUDE_DIR) -- Setting FOLLY_USE_SYMBOLIZER: OFF CMake Error at CMake/folly-deps.cmake:168 (message): unable to link C++ std::atomic code: you may need to install GNU libatomic Call Stack (most recent call first): CMakeLists.txt:113 (include)

-- Configuring incomplete, errors occurred! See also ".../CMakeOutput.log". See also ".../CMakeError.log".

anlongfei avatar Dec 11 '19 05:12 anlongfei

I was facing a similar issue with RedHat. The issue is usually that one of the dependencies is missing and cmake is unable to link the test code due to it. You can run cmake with --debug-trycompile option and look at the output file. Usually running the link step from it should show the real cause of the error.

phoenixchinar avatar Dec 15 '19 14:12 phoenixchinar

I am also facing a same issue when building it on CentOS. Did anyone find a resolution for this?

ugaresuyash avatar May 14 '20 10:05 ugaresuyash

Any update on this?

soumyakantiroychowdhury avatar May 31 '20 18:05 soumyakantiroychowdhury

Same on Amazon Linux 2.

psyhtest avatar Jul 21 '20 12:07 psyhtest

May you should update your gcc version , folly need gcc 4.9+ , I install success on gcc 5.0

dusong7 avatar Aug 04 '20 07:08 dusong7

I am also facing the same issue when building old version of folly, but after check out the master branch of folly, the issue goes away. After some digging, i think https://github.com/facebook/folly/commit/648bc92b845378ead2e81532cdf01f113bd779df commit fix this issuse. polluted CMAKE_REQUIRED_LIBRARIES cause check_cxx_source_compiles failed.

here is the verbose log of _build/CMakeFiles/CMakeError.log:

Performing C++ SOURCE FILE Test FOLLY_CPP_ATOMIC_BUILTIN failed with the following output:
Change Dir: /data/folly/_build/CMakeFiles/CMakeTmp

Run Build Command(s):/opt/rh/devtoolset-7/root/usr/bin/gmake cmTC_d3a40/fast && /opt/rh/devtoolset-7/root/usr/bin/gmake  -f CMakeFiles/cmTC_d3a40.dir/build.make CMakeFiles/cmTC_d3a40.dir/build
gmake[1]: Entering directory '/data/folly/_build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_d3a40.dir/src.cxx.o
/opt/rh/devtoolset-7/root/usr/bin/c++  -D_GNU_SOURCE  -DFOLLY_CPP_ATOMIC_BUILTIN  -std=gnu++1z   -pthread -o CMakeFiles/cmTC_d3a40.dir/src.cxx.o -c /data/folly/_build/CMakeFiles/CMakeTmp/src.cxx
gmake[1]: *** No rule to make target 'gflags', needed by 'cmTC_d3a40'.  Stop.
gmake[1]: Leaving directory '/data/folly/_build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:141: cmTC_d3a40/fast] Error 2

gflags in the log shows CMAKE_REQUIRED_LIBRARIES is polluted. I think this issue can be closed.

yaozongyou avatar Dec 31 '20 03:12 yaozongyou

I am getting the same error when trying to build folly from master, which is now well past 648bc92. It still happens the same way when I check out 648bc92 or the commit before it... so this issue is still open.

At the moment folly is being built as part of the proxygen build... I'll try building it directly and see if I can get any more details. I'm on CentOS Linux release 7.9.2009 (Core).

richls avatar Jan 15 '21 01:01 richls

Using gcc 7.3.1 from devtoolset-7 gets me past the issue. (The problem happened when trying to compile with gcc 4.8.5.)

richls avatar Jan 15 '21 15:01 richls

I faced the problem in CentOS 7, although @richls comment is close, what helped me solve the issue was the following sequence of commands:

// toolset-7 sudo yum install devtoolset-7-libatomic-devel yum install llvm-toolset-7

//(optional) echo "source scl_source enable devtoolset-7 llvm-toolset-7" >> ~/.bashrc

https://stackoverflow.com/questions/59641984/red-hat-using-atomic-compiles-fine-but-linker-cant-find-atomic-store-16-w

tmgli avatar Jan 20 '22 19:01 tmgli

Got it on ubuntu with clang

  • Performing Test FOLLY_CPP_ATOMIC_WITH_LIBATOMIC - Failed CMake Error at source_subfolder/CMake/folly-deps.cmake:164 (message): unable to link C++ std::atomic code: you may need to install GNU libatomic Call Stack (most recent call first): source_subfolder/CMakeLists.txt:113 (include)

-- Configuring incomplete, errors occurred! See also "/home/marcpawl/.conan/data/folly/2019.10.21.00///build/d52eb24998d6c47f9674b154f4a1df3349c51e60/CMakeFiles/CMakeOutput.log". See also "/home/marcpawl/.conan/data/folly/2019.10.21.00///build/d52eb24998d6c47f9674b154f4a1df3349c51e60/CMakeFiles/CMakeError.log". folly/2019.10.21.00: folly/2019.10.21.00: ERROR: Package 'd52eb24998d6c47f9674b154f4a1df3349c51e60' build failed folly/2019.10.21.00: WARN: Build folder /home/marcpawl/.conan/data/folly/2019.10.21.00///build/d52eb24998d6c47f9674b154f4a1df3349c51e60 ERROR: folly/2019.10.21.00: Error in build() method, line 163 cmake = self.configure_cmake() while calling 'configure_cmake', line 157 cmake.configure() ConanException: Error 1 while executing cd '/home/marcpawl/.conan/data/folly/2019.10.21.00///build/d52eb24998d6c47f9674b154f4a1df3349c51e60' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Debug" -DCONAN_CMAKE_CXX_STANDARD="20" -DCONAN_CMAKE_CXX_EXTENSIONS="OFF" -DCONAN_STD_CXX_FLAG="-std=c++20" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="clang" -DCONAN_COMPILER_VERSION="13" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libstdc++11" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/marcpawl/.conan/data/folly/2019.10.21.00///package/d52eb24998d6c47f9674b154f4a1df3349c51e60" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCONAN_CMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_MODULE_PATH="/home/marcpawl/.conan/data/folly/2019.10.21.00///build/d52eb24998d6c47f9674b154f4a1df3349c51e60" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DCMAKE_POSITION_INDEPENDENT_CODE="True" -DCXX_STD="20" -DMSVC_ENABLE_ALL_WARNINGS="False" -DMSVC_USE_STATIC_RUNTIME="False" -Wno-dev '/home/marcpawl/.conan/data/folly/2019.10.21.00///build/d52eb24998d6c47f9674b154f4a1df3349c51e60' CMake Error at out/build/linux-clang-debug/conan.cmake:638 (message): Conan install failed='1' Call Stack (most recent call first): out/build/linux-clang-debug/_deps/_project_options-src/src/Conan.cmake:44 (conan_cmake_install) out/build/linux-clang-debug/_deps/_project_options-src/src/Index.cmake:186 (run_conan) out/build/linux-clang-debug/_deps/_project_options-src/src/DynamicProjectOptions.cmake:143 (project_options) CMakeLists.txt:89 (dynamic_project_options)

marcpawl@ubuntu:~/cpp_starter_project-1-main$ clang --version Ubuntu clang version 13.0.0-2 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin

marcpawl avatar Apr 15 '22 17:04 marcpawl

@marcpawl Did you resolve this with clang? I'm seeing it with clang-14 on Ubuntu jammy.

EDIT: Answering my own question. The problem was that I had this:

export CXX=clang-14

and I needed this:

export CXX=clang++-14

jeaye avatar Sep 13 '22 03:09 jeaye