timeplus-io / proton

A stream processing engine and database, and a fast and lightweight alternative to ksqlDB and Apache Flink, 🚀 powered by ClickHouse
https://timeplus.com
Apache License 2.0
1.58k stars 69 forks source link

Unable to build on Debian #852

Open avrono opened 2 weeks ago

avrono commented 2 weeks ago

Following instructions in build.md getting this error on 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 GNU/Linux

CMake Error at cmake/tools.cmake:8 (message):
  Compiler GNU is not supported
Call Stack (most recent call first):
  CMakeLists.txt:19 (include)

Seems like it is looking for Clang as the default compiler

if (CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
    set (COMPILER_CLANG 1) # Safe to treat AppleClang as a regular Clang, in general.
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    set (COMPILER_CLANG 1)
else ()
    message (FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} is not supported")
endif ()
avrono commented 2 weeks ago

Ok, so Debian build progress with cmake -D CMAKE_C_COMPILER=/usr/bin/clang -D CMAKE_CXX_COMPILER=/usr/bin/clang++ ..

Debian still shipping 14.06 have to upgrade to 15+

jovezhong commented 2 weeks ago

@yokofly , would you please check the Debian build process and refine build.md? Thanks.

avrono commented 2 weeks ago

I solved it with

  1. updating to Clang 15,
  2. using -D flag and
  3. installing the linker
jovezhong commented 2 weeks ago

Thanks,maybe build.md can be refined. Feel free to propose the change as a comment, or as a PR

avrono commented 2 weeks ago

Not problem will take notes, now getting build failure on protoc

ld.lld --version                                                                   1 err  3s 
Debian LLD 14.0.6 (compatible with GNU linkers)

Maybe linker needs to be 15+ (I guess) ?

ninja                                                                                127 err 
[0/2] Re-checking globbed directories...
[2531/11759] Linking CXX executable contrib/protobuf-cmake/protoc
FAILED: contrib/protobuf-cmake/protoc 
: && /usr/bin/clang++ --target=x86_64-linux-gnu --sysroot=/home/avrono/workspace/proton/cmake/linux/../../contrib/sysroot/linux-x86_64/x86_64-linux-gnu/libc --gcc-toolchain=/home/avrono/workspace/proton/cmake/linux/../../contrib/sysroot/linux-x86_64 -fdiagnostics-color=always -Xclang -fuse-ctor-homing -fsized-deallocation  -gdwarf-aranges -pipe -mssse3 -msse4.1 -msse4.2 -mpclmul -mpopcnt -fasynchronous-unwind-tables -ffile-prefix-map=/home/avrono/workspace/proton=. -falign-functions=32 -mbranches-within-32B-boundaries   -Wall -Wno-unused-command-line-argument  -fdiagnostics-absolute-paths -fstrict-vtable-pointers -w -O2 -g -DNDEBUG -O3 -g -gdwarf-4  -fno-pie --gcc-toolchain=/home/avrono/workspace/proton/cmake/linux/../../contrib/sysroot/linux-x86_64 --ld-path=/home/avrono/workspace/proton/build/ld.lld -rdynamic -Wl,--gdb-index -Wl,--build-id=sha1 -no-pie -Wl,-no-pie    -Xlinker --no-undefined contrib/protobuf-cmake/CMakeFiles/protoc.dir/__/protobuf/src/google/protobuf/compiler/main.cc.o -o contrib/protobuf-cmake/protoc  contrib/protobuf-cmake/lib_libprotoc.a  contrib/protobuf-cmake/lib_libprotobuf.a  -lpthread  contrib/zlib-ng-cmake/lib_zlib.a  -Wl,--start-group  base/glibc-compatibility/libglibc-compatibility.a  base/glibc-compatibility/memcpy/libmemcpy.a  contrib/libcxx-cmake/libcxx.a  contrib/libcxxabi-cmake/libcxxabi.a  contrib/libunwind-cmake/libunwind.a  -Wl,--end-group  -nodefaultlibs /usr/lib/llvm-15/lib/clang/15.0.6/lib/linux/libclang_rt.builtins-x86_64.a  -lc -lm -lrt -lpthread -ldl && :
clang: error: invalid linker name in argument '--ld-path=/home/avrono/workspace/proton/build/ld.lld'
[2544/11759] Building CXX object contrib/grpc/CMakeFiles/grpc.dir/src/core/ext/filters/client_channel/client_channel.cc.o
ninja: build stopped: subcommand failed.
yokofly commented 1 week ago

I can reproduce it, upgrade linker to 15+ is still not working. the cmake here hard-write linker path.

https://github.com/timeplus-io/proton/blob/8e6b79732115d34d1afe25c8ea1447642b28599a/cmake/tools.cmake#L68-L83

root@77df7248ea10:/work/build_debian_release# ninja     
[0/2] Re-checking globbed directories...
[1559/10761] Linking CXX executable contrib/protobuf-cmake/protoc
FAILED: contrib/protobuf-cmake/protoc 
: && /usr/bin/clang++-15 --target=x86_64-linux-gnu --sysroot=/work/cmake/linux/../../contrib/sysroot/linux-x86_64/x86_64-linux-gnu/libc --gcc-toolchain=/work/cmake/linux/../../contrib/sysroot/linux-x86_64 -fdiagnostics-color=always -Xclang -fuse-ctor-homing -fsized-deallocation  -gdwarf-aranges -pipe -mssse3 -msse4.1 -msse4.2 -mpclmul -mpopcnt -fasynchronous-unwind-tables -ffile-prefix-map=/work=. -falign-functions=32 -mbranches-within-32B-boundaries   -Wall -Wno-unused-command-line-argument  -fdiagnostics-absolute-paths -fstrict-vtable-pointers -w -O2 -g -DNDEBUG -O3 -g -gdwarf-4  -fno-pie --gcc-toolchain=/work/cmake/linux/../../contrib/sysroot/linux-x86_64 --ld-path=/work/build_debian_release/ld.lld -rdynamic -Wl,--gdb-index -Wl,--build-id=sha1 -no-pie -Wl,-no-pie    -Xlinker --no-undefined contrib/protobuf-cmake/CMakeFiles/protoc.dir/__/protobuf/src/google/protobuf/compiler/main.cc.o -o contrib/protobuf-cmake/protoc  contrib/protobuf-cmake/lib_libprotoc.a  contrib/protobuf-cmake/lib_libprotobuf.a  -lpthread  contrib/zlib-ng-cmake/lib_zlib.a  -Wl,--start-group  base/glibc-compatibility/libglibc-compatibility.a  base/glibc-compatibility/memcpy/libmemcpy.a  contrib/libcxx-cmake/libcxx.a  contrib/libcxxabi-cmake/libcxxabi.a  contrib/libunwind-cmake/libunwind.a  -Wl,--end-group  -nodefaultlibs /usr/lib/llvm-15/lib/clang/15.0.7/lib/linux/libclang_rt.builtins-x86_64.a  -lc -lm -lrt -lpthread -ldl && :
clang: error: invalid linker name in argument '--ld-path=/work/build_debian_release/ld.lld'
[1580/10761] Building CXX object contrib/grpc/CMakeFiles/grpc.dir/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc.o
ninja: build stopped: subcommand failed.
root@77df7248ea10:/work/build_debian_release# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:    12
Codename:   bookworm
root@77df7248ea10:/work/build_debian_release# 

I will upgrade to clang-16 to test.

yokofly commented 1 week ago

hi @avrono clang-16 works. the package is from :

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16

and my command to build:

CC=clang-16 CXX=clang++-16 PATH=/usr/lib/llvm-16/bin/:$PATH cmake .. 
avrono commented 1 week ago

Hi @yokofly thanks, I did also try with other version including 17. I will investigate further.

Further @yokofly that worked with the supplied build command. Thanks !