Go version

Not applicable

Output of go env in your module/workspace:

# Dockerfile for building gollvm
FROM ubuntu:latest
ARG TARGETPLATFORM
RUN echo "Building for target platform: $TARGETPLATFORM" && \
    if [ "$TARGETPLATFORM" != "linux/amd64" ]; then \
    echo "❌ Gollvm requires linux/amd64 for -fsplit-stack support" && exit 1; \
    fi

# Basic tools

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    build-essential cmake ninja-build git curl m4 python3 \
    zlib1g-dev libtinfo-dev libxml2-dev libedit-dev binutils-gold \
    libssl-dev libffi-dev pkg-config \
    libc6-dev linux-libc-dev libpthread-stubs0-dev \
    libz-dev \
    libncurses-dev


WORKDIR /home/workarea

# Clone all required sources
RUN git clone https://github.com/llvm/llvm-project.git && \
    cd llvm-project && \
    git checkout release/16.x && \
    cd llvm/tools && \
    git clone https://go.googlesource.com/gollvm && \
    cd gollvm && \
    git clone https://go.googlesource.com/gofrontend && \
    cd libgo && \
    git clone https://github.com/libffi/libffi.git && \
    git clone https://github.com/ianlancetaylor/libbacktrace.git

ENV CC=gcc
ENV CXX=g++


RUN cd /home/ && \
    mkdir gollvm && \
    cd /home/workarea && \
    mkdir build.rel && \
    cd build.rel && \
    cmake -DCMAKE_INSTALL_PREFIX=/home/gollvm -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -G Ninja ../llvm-project/llvm &&\
    ninja gollvm && \
    ninja install-gollvm

ENV LD_LIBRARY_PATH="/home/gollvm/lib64:$LD_LIBRARY_PATH"
ENV PATH="/home/gollvm/bin:$PATH"

ENTRYPOINT [ "bash" ]

What did you do?

I followed the directions from this page on building gollvm: https://go.googlesource.com/gollvm. Using the latest commit. I was at the step to run this command: ninja gollvm. Tried llvm latest branch and 16.x

gollvm: update to LLVM mainline

What did you see happen?

latest

3031.7 510 | Options, driver_.reconcileRelocModel(), 3031.7 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3031.7 511 | CM, cgolvl_)); 3031.7 | ~~~~~~~~~~~~ 3031.7 In file included from /home/workarea/llvm-project/llvm/tools/gollvm/driver/CompileGo.cpp:49: 3031.7 /home/workarea/llvm-project/llvm/include/llvm/MC/TargetRegistry.h:478:18: note: declared here 3031.7 478 | TargetMachine *createTargetMachine( 3031.7 | ^~~~~~~~~~~~~~~~~~~ 3031.7 /home/workarea/llvm-project/llvm/tools/gollvm/driver/CompileGo.cpp: In member function 'bool gollvm::driver::CompileGoImpl::initBridge()': 3031.7 /home/workarea/llvm-project/llvm/tools/gollvm/driver/CompileGo.cpp:539:45: error: cannot convert 'const std::string' {aka 'const std::__cxx11::basic_string'} to 'llvm::Triple' 3031.7 539 | module_->setTargetTriple(triple_.getTriple()); 3031.7 | ~~~~~~~~~~~~~~~~~^~ 3031.7 | | 3031.7 | const std::string {aka const std::__cxx11::basic_string} 3031.7 In file included from /home/workarea/llvm-project/llvm/include/llvm/Analysis/TargetLibraryInfo.h:15, 3031.7 from /home/workarea/llvm-project/llvm/tools/gollvm/driver/CompileGo.cpp:36: 3031.7 /home/workarea/llvm-project/llvm/include/llvm/IR/Module.h:324:31: note: initializing argument 1 of 'void llvm::Module::setTargetTriple(llvm::Triple)' 3031.7 324 | void setTargetTriple(Triple T) { TargetTriple = std::move(T); } 3031.7 | ~~~~~~~^ 3031.7 ninja: build stopped: subcommand failed.


16.x

1736.9 [2591/4201] Linking CXX static library lib/libLLVMX86AsmParser.a 1737.3 [2592/4201] Building CXX object tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o 1737.3 FAILED: tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o 1737.3 /usr/bin/g++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/workarea/build.rel/tools/gollvm/passes -I/home/workarea/llvm-project/llvm/tools/gollvm/passes -I/home/workarea/build.rel/include -I/home/workarea/llvm-project/llvm/include -I/home/workarea/llvm-project/llvm/tools/gollvm/driver -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -Wno-suggest-override -fno-exceptions -fno-rtti -fcf-protection=none -MD -MT tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o -MF tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o.d -o tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoStatepoints.cpp.o -c /home/workarea/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp 1737.3 /home/workarea/llvm-project/llvm/tools/gollvm/passes/GoStatepoints.cpp:35:10: fatal error: llvm/IR/AttributeMask.h: No such file or directory 1737.3 35 | #include "llvm/IR/AttributeMask.h" 1737.3 | ^~~~~~~~~~~~~~~~~~~~~~~~~ 1737.3 compilation terminated. 1738.0 [2593/4201] Building CXX object lib/TextAPI/CMakeFiles/LLVMTextAPI.dir/TextStub.cpp.o 1739.4 [2594/4201] Building CXX object tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoSafeGetg.cpp.o 1739.9 [2595/4201] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilderPipelines.cpp.o 1739.9 In file included from /home/workarea/llvm-project/llvm/lib/Passes/PassBuilderPipelines.cpp:112: 1739.9 /home/workarea/llvm-project/llvm/include/llvm/Transforms/Scalar/SROA.h:95:7: warning: 'llvm::SROAPass' declared with greater visibility than the type of its field 'llvm::SROAPass::SelectsToRewrite' [-Wattributes] 1739.9 95 | class SROAPass : public PassInfoMixin { 1739.9 | ^~~~~~~~ 1740.0 [2596/4201] Building CXX object tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GC.cpp.o 1740.2 [2597/4201] Building CXX object tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoAnnotation.cpp.o 1740.2 [2598/4201] Building CXX object tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoWrappers.cpp.o 1740.7 [2599/4201] Building CXX object tools/gollvm/passes/CMakeFiles/LLVMCppGoPasses.dir/GoNilChecks.cpp.o 1741.4 [2600/4201] Performing download step (download, verify and extract) for 'libgmp' 1741.4 -- Downloading... 1741.4 dst='/home/workarea/build.rel/tools/gollvm/external-downloads/gmp-6.2.0.tar.bz2' 1741.4 timeout='none' 1741.4 inactivity timeout='none' 1741.4 -- Using src='https://gmplib.org/download/gmp/gmp-6.2.0.tar.bz2'

What did you expect to see?

managed to compile

Comment From: gabyhelp

Related Issues

Related Discussions

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)