dotnet / runtimelab

This repo is for experimentation and exploring new ideas that may or may not make it into the main dotnet/runtime repo.
MIT License
1.36k stars 188 forks source link

[Question] [NativeAOT-LLVM] Is there a docker image with `as` ? #2619

Closed yowl closed 1 week ago

yowl commented 1 week ago

A follow up to #2618 , it appears that the image azurelinux-3.0-cross-amd64-net9.0 does not have as installed as attempting to configure LLVM results in

-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/__w/1/s/wasm-tools/llvm-project/build-release/CMakeFiles/CMakeScratch/TryCompile-9Q7hx4'

    Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_347b8/fast
    /usr/bin/make  -f CMakeFiles/cmTC_347b8.dir/build.make CMakeFiles/cmTC_347b8.dir/build
    make[1]: Entering directory '/__w/1/s/wasm-tools/llvm-project/build-release/CMakeFiles/CMakeScratch/TryCompile-9Q7hx4'
    Building C object CMakeFiles/cmTC_347b8.dir/testCCompiler.c.o
    /usr/bin/cc    -o CMakeFiles/cmTC_347b8.dir/testCCompiler.c.o -c /__w/1/s/wasm-tools/llvm-project/build-release/CMakeFiles/CMakeScratch/TryCompile-9Q7hx4/testCCompiler.c
    cc: fatal error: cannot execute 'as': execvp: No such file or directory
    compilation terminated.
    make[1]: *** [CMakeFiles/cmTC_347b8.dir/build.make:78: CMakeFiles/cmTC_347b8.dir/testCCompiler.c.o] Error 1
    make[1]: Leaving directory '/__w/1/s/wasm-tools/llvm-project/build-release/CMakeFiles/CMakeScratch/TryCompile-9Q7hx4'
    make: *** [Makefile:127: cmTC_347b8/fast] Error 2

Is this expected, if so, is there another image that contains as or can it be installed?

jkotas commented 1 week ago

This image is setup to use clang-18 both as the C/C++ compiler and the assembler.

This is example of build log from dotnet/runtime build https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_apis/build/builds/717075/logs/439

Look for:

2024-06-22T23:25:19.1457207Z   -- Check for working C compiler: /usr/local/bin/clang-18 - skipped
2024-06-22T23:25:19.1465561Z   -- Detecting C compile features
2024-06-22T23:25:19.1473467Z   -- Detecting C compile features - done
2024-06-22T23:25:19.1661111Z   -- Detecting CXX compiler ABI info
2024-06-22T23:25:19.2681211Z   -- Detecting CXX compiler ABI info - done
2024-06-22T23:25:19.2774567Z   -- Check for working CXX compiler: /usr/local/bin/clang++ - skipped
2024-06-22T23:25:19.2780740Z   -- Detecting CXX compile features
2024-06-22T23:25:19.2787635Z   -- Detecting CXX compile features - done
2024-06-22T23:25:19.3269188Z   Detected Linux x86_64
2024-06-22T23:25:19.3275136Z   -- Performing Test COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG
2024-06-22T23:25:19.4124657Z   -- Performing Test COMPILER_SUPPORTS_F_STACK_PROTECTOR_STRONG - Success
2024-06-22T23:25:19.4129833Z   -- Performing Test COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH
2024-06-22T23:25:19.4981939Z   -- Performing Test COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH - Success
2024-06-22T23:25:19.4988554Z   -- Performing Test COMPILER_SUPPORTS_W_RESERVED_IDENTIFIER
2024-06-22T23:25:19.5850024Z   -- Performing Test COMPILER_SUPPORTS_W_RESERVED_IDENTIFIER - Success
2024-06-22T23:25:19.6336920Z   -- The ASM compiler identification is Clang 18.1.4 with GNU-like command-line
2024-06-22T23:25:19.6368436Z   -- Found assembler: /usr/local/bin/clang-18
jkotas commented 1 week ago

The compiler gets configured through https://github.com/dotnet/runtime/blob/main/eng/native/gen-buildsys.sh#L30-L31 script that exports CCC_CC and CCC_CXX environment variables. I would expect that llvm build via cmake is going to respect these env variables as well. Try to set these env variables directly or run this script to set them.