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

Fix inlining demo after Fuchsia toolchain updates #252

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

boomanaiden154
Copy link
Collaborator

Fuchsia recently updated their toolchain to include llvm-debuginfod which needs an additional dependency, cpp-httplib in order to build LLVM properly. This patch adds instructions on how to build this dependency so that the demo still works.

Fuchsia recently updated their toolchain to include llvm-debuginfod
which needs an additional dependency, cpp-httplib in order to build LLVM
properly. This patch adds instructions on how to build this dependency
so that the demo still works.
@boomanaiden154
Copy link
Collaborator Author

Waiting on yhirose/cpp-httplib#1580.

As far as I can tell since llvm-debuginfod has been added to the toolchain in the stage 2 CMake cache, it's hard to just disable it in the CMake invocation without doing something slightly hacky that would probably be more prone to breaking things.

@boomanaiden154 boomanaiden154 marked this pull request as ready for review June 6, 2023 08:44
@boomanaiden154
Copy link
Collaborator Author

@mtrofin @petrhosek Do one of you mind giving this a review? The mentioned prerequisite patch has landed now.

@boomanaiden154
Copy link
Collaborator Author

Nevermind. Looks like this might still need some more work. Currently failing on building the riscv64 runtimes as CMake claims lld is unable to find the necessary libraries, but the paths seem to be setup correctly.

[35/135] Performing configure step for 'runtimes-riscv64-unknown-fuchsia'
Not searching for unused variables given on the command line.
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
CMake Error at /llvm-project/llvm/cmake/modules/HandleLLVMOptions.cmake:330 (message):
  Host compiler does not support '-fuse-ld=lld'
Call Stack (most recent call first):
  CMakeLists.txt:156 (include)


-- Configuring incomplete, errors occurred!
See also "/llvm-build/runtimes/runtimes-riscv64-unknown-fuchsia-bins/CMakeFiles/CMakeOutput.log".
See also "/llvm-build/runtimes/runtimes-riscv64-unknown-fuchsia-bins/CMakeFiles/CMakeError.log".
FAILED: runtimes/runtimes-riscv64-unknown-fuchsia-stamps/runtimes-riscv64-unknown-fuchsia-configure /llvm-build/runtimes/runtimes-riscv64-unknown-fuchsia-stamps/runtimes-riscv64-unknown-fuchsia-configure 
cd /llvm-build/runtimes/runtimes-riscv64-unknown-fuchsia-bins && /usr/bin/cmake --no-warn-unused-cli -DCMAKE_C_COMPILER=/llvm-build/./bin/clang -DCMAKE_CXX_COMPILER=/llvm-build/./bin/clang++ -DCMAKE_ASM_COMPILER=/llvm-build/./bin/clang -DCMAKE_LINKER=/llvm-build/./bin/ld.lld -DCMAKE_AR=/llvm-build/./bin/llvm-ar -DCMAKE_RANLIB=/llvm-build/./bin/llvm-ranlib -DCMAKE_NM=/llvm-build/./bin/llvm-nm -DCMAKE_OBJDUMP=/llvm-build/./bin/llvm-objdump -DCMAKE_OBJCOPY=/llvm-build/./bin/llvm-objcopy -DCMAKE_STRIP=/llvm-build/./bin/llvm-strip -DCMAKE_READELF=/llvm-build/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=riscv64-unknown-fuchsia -DCMAKE_CXX_COMPILER_TARGET=riscv64-unknown-fuchsia -DCMAKE_ASM_COMPILER_TARGET=riscv64-unknown-fuchsia -DCMAKE_INSTALL_PREFIX= -DLLVM_BINARY_DIR=/llvm-build -DLLVM_CONFIG_PATH=/llvm-build/bin/llvm-config -DLLVM_ENABLE_WERROR=OFF -DLLVM_HOST_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_HAVE_LINK_VERSION_SCRIPT=1 -DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF -DLLVM_USE_RELATIVE_PATHS_IN_FILES=ON -DLLVM_LIT_ARGS=-sv -DLLVM_SOURCE_PREFIX= -DPACKAGE_VERSION=17.0.0git -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/usr/local/bin/ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=OFF -DLLVM_INCLUDE_TESTS=ON -DLLVM_ENABLE_PROJECTS_USED=ON -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_ASM_COMPILER_WORKS=ON -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON -DLLVM_RUNTIMES_TARGET=riscv64-unknown-fuchsia -DHAVE_LLVM_LIT=ON -DLLVM_DEFAULT_TARGET_TRIPLE=riscv64-unknown-fuchsia "-DLLVM_ENABLE_RUNTIMES=compiler-rt;libcxx;libcxxabi;libunwind" -DLLVM_USE_LINKER=lld "-DCMAKE_ASM_FLAGS=--target=riscv64-unknown-fuchsia -I/fuchsia-idk/pkg/sync/include -I/fuchsia-idk/pkg/fdio/include" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON "-DCMAKE_CXX_FLAGS=--target=riscv64-unknown-fuchsia -I/fuchsia-idk/pkg/sync/include -I/fuchsia-idk/pkg/fdio/include" "-DCMAKE_C_FLAGS=--target=riscv64-unknown-fuchsia -I/fuchsia-idk/pkg/sync/include -I/fuchsia-idk/pkg/fdio/include" -DCMAKE_EXE_LINKER_FLAGS=-L/fuchsia-idk/arch/riscv64/lib -DCMAKE_MODULE_LINKER_FLAGS=-L/fuchsia-idk/arch/riscv64/lib -DCMAKE_SHARED_LINKER_FLAGS=-L/fuchsia-idk/arch/riscv64/lib -DCMAKE_SYSROOT=/fuchsia-idk/arch/riscv64/sysroot -DCMAKE_SYSTEM_NAME=Fuchsia -DCOMPILER_RT_CXX_LIBRARY=libcxx -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON -DCOMPILER_RT_USE_LLVM_UNWINDER=ON -DLIBCXXABI_HERMETIC_STATIC_LIBRARY=ON -DLIBCXXABI_INSTALL_STATIC_LIBRARY=OFF -DLIBCXXABI_USE_COMPILER_RT=ON -DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXX_ABI_VERSION=2 -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON -DLIBCXX_HERMETIC_STATIC_LIBRARY=ON -DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF -DLIBCXX_USE_COMPILER_RT=ON -DLIBUNWIND_HIDE_SYMBOLS=ON -DLIBUNWIND_USE_COMPILER_RT=ON -DLLVM_ENABLE_ASSERTIONS=OFF "-DLLVM_ENABLE_RUNTIMES=compiler-rt;libcxx;libcxxabi;libunwind" -GNinja /llvm-project/llvm/runtimes/../../runtimes && /usr/bin/cmake -E touch /llvm-build/runtimes/runtimes-riscv64-unknown-fuchsia-stamps//runtimes-riscv64-unknown-fuchsia-configure
ninja: build stopped: subcommand failed.

@petrhosek
Copy link
Collaborator

We're currently in an interim state where we're bringing up Fuchsia on RISC-V but don't yet include RISC-V sysroot in our SDK because it's not ready yet. To workaround this, we have a script that can generate an artificial SDK stubs for RISC-V which is needed here. To use it, you'll need need the following invocation on line 105:

${FUCHSIA_SRCDIR}/scripts/clang/generate_sysroot.py --sdk-dir=${IDK_DIR} --arch=riscv64 --ifs-path=${FUCHSIA_SRCDIR}/prebuilt/third_party/clang/linux-x64/bin/llvm-ifs

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

Successfully merging this pull request may close these issues.

2 participants