Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't build within foundationdb/build container #5717

Closed
aduermael opened this issue Oct 2, 2021 · 2 comments
Closed

can't build within foundationdb/build container #5717

aduermael opened this issue Oct 2, 2021 · 2 comments
Assignees

Comments

@aduermael
Copy link

aduermael commented Oct 2, 2021

I'm getting an error when I try to build FoundationDB within foundationdb/build Docker container (latest tag).

What I did:

  • docker run -ti --rm foundationdb/build
  • cd /tmp
  • git clone https://github.com/apple/foundationdb.git
  • mkdir build
  • cd build
  • cmake -G Ninja /tmp/foundationdb

Output:

-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is Clang 11.0.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/bin/clang++
-- Check for working CXX compiler: /usr/local/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- /tmp/foundationdb /tmp/build
-- Setting build type to 'Release' as none was specified
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Looking for stdatomic.h
-- Looking for stdatomic.h - not found
CMake Error at cmake/ConfigureCompiler.cmake:89 (message):
  C compiler does not support c11 atomics
Call Stack (most recent call first):
  CMakeLists.txt:64 (include)


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

CMakeError.log:

Determining if the pthread_create exist failed with the following output:
Change Dir: /tmp/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/ninja" "cmTC_99735"
[1/2] Building C object CMakeFiles/cmTC_99735.dir/CheckSymbolExists.c.o
[2/2] Linking C executable cmTC_99735
FAILED: cmTC_99735
: && /usr/bin/cc    CMakeFiles/cmTC_99735.dir/CheckSymbolExists.c.o  -o cmTC_99735   && :
CMakeFiles/cmTC_99735.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text+0x16): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

File /tmp/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the include file stdatomic.h exists failed with the following output:
Change Dir: /tmp/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/ninja" "cmTC_7ac2d"
[1/2] Building C object CMakeFiles/cmTC_7ac2d.dir/CheckIncludeFile.c.o
FAILED: CMakeFiles/cmTC_7ac2d.dir/CheckIncludeFile.c.o
/usr/bin/cc  -Istdlib.h -Imalloc.h -std=gnu11 -o CMakeFiles/cmTC_7ac2d.dir/CheckIncludeFile.c.o   -c CheckIncludeFile.c
CheckIncludeFile.c:1:23: fatal error: stdatomic.h: No such file or directory
 #include <stdatomic.h>
                       ^
compilation terminated.
ninja: build stopped: subcommand failed.
@PierreZ
Copy link
Contributor

PierreZ commented Oct 2, 2021

There is some missing documentation on how to use the official dockerfile to build FoundationDB. You need to source some files in order to use the right compiler. Here’s an example taken from some github actions:

source /opt/rh/devtoolset-8/enable && source /opt/rh/rh-python36/enable && cmake -G Ninja ../foundationdb

EDIT: use rh-python38 instead of rh-python36 as the dep has been upgraded

@jzhou77
Copy link
Contributor

jzhou77 commented Oct 4, 2021

We need better documentation at https://github.com/FoundationDB/fdb-build-support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants