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

Unable to build on Debian #852

Open
avrono opened this issue Nov 8, 2024 · 8 comments · May be fixed by #853
Open

Unable to build on Debian #852

avrono opened this issue Nov 8, 2024 · 8 comments · May be fixed by #853
Assignees
Labels
question Further information is requested

Comments

@avrono
Copy link

avrono commented Nov 8, 2024

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 avrono added the question Further information is requested label Nov 8, 2024
@avrono
Copy link
Author

avrono commented Nov 8, 2024

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
Copy link
Contributor

jovezhong commented Nov 8, 2024

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

@avrono
Copy link
Author

avrono commented Nov 8, 2024

I solved it with

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

@jovezhong
Copy link
Contributor

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

@avrono
Copy link
Author

avrono commented Nov 8, 2024

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
Copy link
Collaborator

yokofly commented Nov 9, 2024

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

proton/cmake/tools.cmake

Lines 68 to 83 in 8e6b797

if (LINKER_NAME)
find_program (LLD_PATH NAMES ${LINKER_NAME})
if (NOT LLD_PATH)
message (FATAL_ERROR "Using linker ${LINKER_NAME} but can't find its path.")
endif ()
# This a temporary quirk to emit .debug_aranges with ThinLTO, it is only the case clang/llvm <16
if (COMPILER_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
set (LLD_WRAPPER "${CMAKE_CURRENT_BINARY_DIR}/ld.lld")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/ld.lld.in" "${LLD_WRAPPER}" @ONLY)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --ld-path=${LLD_WRAPPER}")
else ()
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --ld-path=${LLD_PATH}")
endif()
endif ()

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
Copy link
Collaborator

yokofly commented Nov 9, 2024

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 .. 

@yokofly yokofly linked a pull request Nov 9, 2024 that will close this issue
@avrono
Copy link
Author

avrono commented Nov 9, 2024

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants