Advice on MacOS development environment? (ld: library not found for -Lsystem)

21 views
Skip to first unread message

Nathan Martinez

unread,
Oct 23, 2022, 8:30:04 PM10/23/22
to ClickHouse
Hi guys - I'm setting up a MacOS dev environment to work on ClickHouse. Trying to do the steps here (specifically, cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -S . -B build) throws the error ld: library not found for -lSystem.

Any advice to work around this? I've read online that the LIBRARY_PATH, LD_LIBRARY_PATH, or DYLD_LIBRARY_PATH variables may help ld find the needed libraries, but I can't get it to work.

Anyone have advice beyond the ClickHouse MacOS setup doc for setting up their MacOS environment? Would love to just copy someone's setup.

Things I already did to setup my dev env:
  1. Installed everything from the brew install... step here
  2. Do the PATH, CC, and CXX environment variables from this step
  3. Confirm LLVM clang is being used instead of Apple clang (already got around that error)
Full compiler output:

ClickHouse % cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -S . -B build
-- The C compiler identification is Clang 15.0.3
-- The CXX compiler identification is Clang 15.0.3
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /usr/local/opt/llvm/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang - broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/usr/local/opt/llvm/bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/nmartinez/c/github.com/ClickHouse/ClickHouse/build/CMakeFiles/CMakeTmp
   
    Run Build Command(s):/usr/local/bin/ninja cmTC_9c38c && [1/2] Building C object CMakeFiles/cmTC_9c38c.dir/testCCompiler.c.o
    [2/2] Linking C executable cmTC_9c38c
    FAILED: cmTC_9c38c
    : && /usr/local/opt/llvm/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/cmTC_9c38c.dir/testCCompiler.c.o -o cmTC_9c38c   && :
    ld: library not found for -lSystem
    clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

-- Configuring incomplete, errors occurred!
See also "/Users/nmartinez/c/github.com/ClickHouse/ClickHouse/build/CMakeFiles/CMakeOutput.log".
See also "/Users/nmartinez/c/github.com/ClickHouse/ClickHouse/build/CMakeFiles/CMakeError.log".


Other environment info:
ClickHouse % which clang
/usr/local/opt/llvm/bin/clang

On MacOS Monterey 12.6

Thanks in advance.

Nathan Martinez

unread,
Oct 23, 2022, 8:33:36 PM10/23/22
to ClickHouse
Also, anyone have advice on configuring CLion on MacOS so code navigation works well? Thank you again.
Reply all
Reply to author
Forward
0 new messages