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

Installation error while building LLVM, Clang & Clad from source #689

Closed
u-rox23 opened this issue Dec 23, 2023 · 5 comments · Fixed by #743
Closed

Installation error while building LLVM, Clang & Clad from source #689

u-rox23 opened this issue Dec 23, 2023 · 5 comments · Fixed by #743
Assignees
Milestone

Comments

@u-rox23
Copy link

u-rox23 commented Dec 23, 2023

Followed the installation guide in the README for building Clang and Clad from source using the following commands:

sudo -H pip install lit
git clone https://github.com/llvm/llvm-project.git src
cd src; git chekout llvmorg-13.0.0
cd llvm/tools
git clone https://github.com/vgvassilev/clad.git clad
cd ../../../
mkdir obj inst
cd obj
cmake -S ../src/llvm -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE="Debug" -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_INSTALL_PREFIX=../inst
make -j8 clang
make -j8 clad

Failure log:

[100%] Building IntrinsicsXCore.h...
[100%] Building IntrinsicsVE.h...
[100%] Built target intrinsics_gen
[100%] Building CXX object tools/clad/lib/Differentiator/CMakeFiles/cladDifferentiator.dir/BaseForwardModeVisitor.cpp.o
In file included from /home/rox/Desktop/clad-dev/src/llvm/tools/clad/include/clad/Differentiator/BaseForwardModeVisitor.h:4,
                 from /home/rox/Desktop/clad-dev/src/llvm/tools/clad/lib/Differentiator/BaseForwardModeVisitor.cpp:7:
/home/rox/Desktop/clad-dev/src/llvm/tools/clad/include/clad/Differentiator/Compatibility.h:11:10: fatal error: clang/AST/ASTContext.h: No such file or directory
   11 | #include "clang/AST/ASTContext.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [tools/clad/lib/Differentiator/CMakeFiles/cladDifferentiator.dir/build.make:80: tools/clad/lib/Differentiator/CMakeFiles/cladDifferentiator.dir/BaseForwardModeVisitor.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:64310: tools/clad/lib/Differentiator/CMakeFiles/cladDifferentiator.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:64476: tools/clad/tools/CMakeFiles/clad.dir/rule] Error 2
make: *** [Makefile:14645: clad] Error 2

Checking the install directory inst contains these header files in the include directory. Below is the log from CMakeError.log although couldn't find anything dubious other than some regular non-linux flag errors.
CMakeError.log
CMakeOutput.log

Could anyone help me in figuring the issue as to why the cmake build isn't able to resolve the header paths?

@vgvassilev
Copy link
Owner

@u-rox23 apologies for the delay. This approach of building is not often used and has changed in when LLVM moved to the "LLVM monorepo". Alternatively, you can build it by cloning clad in a separate folder and pass -DLLVM_DIR=path/to/llvm/inst

@u-rox23
Copy link
Author

u-rox23 commented Jan 6, 2024

Thanks @vgvassilev, building it separately fixed the issue for me. Resolving, thanks again for the help!

@u-rox23 u-rox23 closed this as completed Jan 6, 2024
@u-rox23
Copy link
Author

u-rox23 commented Jan 6, 2024

Reopening the issue due to another failure I'm facing. The cmake build and install was successful, however the tests failed following the below command:

make check-clad

Below is one of the failure reason:

Script:
--
: 'RUN: at line 1';   /home/rox/Desktop/clad-dev/inst/bin/clang++ -DCLAD_NO_NUM_DIFF  -std=c++11 -Xclang -add-plugin -Xclang clad -Xclang         -plugin-arg-clad -Xclang -fdump-derived-fn -Xclang         -load -Xclang /home/rox/Desktop/clad-dev/clad_obj/./lib/clad.so /home/rox/Desktop/clad-dev/clad/test/ROOT/Interface.C -I/home/rox/Desktop/clad-dev/clad/test/ROOT/../../include -oInterface.out 2>&1 | /home/rox/Desktop/clad-dev/inst/bin/FileCheck /home/rox/Desktop/clad-dev/clad/test/ROOT/Interface.C
: 'RUN: at line 2';   ./Interface.out | /home/rox/Desktop/clad-dev/inst/bin/FileCheck -check-prefix=CHECK-EXEC /home/rox/Desktop/clad-dev/clad/test/ROOT/Interface.C
: 'RUN: at line 3';   /home/rox/Desktop/clad-dev/inst/bin/clang++ -DCLAD_NO_NUM_DIFF  -std=c++11 -Xclang -add-plugin -Xclang clad -Xclang         -plugin-arg-clad -Xclang -fdump-derived-fn -Xclang         -load -Xclang /home/rox/Desktop/clad-dev/clad_obj/./lib/clad.so -Xclang -plugin-arg-clad -Xclang -enable-tbr /home/rox/Desktop/clad-dev/clad/test/ROOT/Interface.C -I/home/rox/Desktop/clad-dev/clad/test/ROOT/../../include -oInterface.out
: 'RUN: at line 4';   ./Interface.out | /home/rox/Desktop/clad-dev/inst/bin/FileCheck -check-prefix=CHECK-EXEC /home/rox/Desktop/clad-dev/clad/test/ROOT/Interface.C
--
Exit Code: 127

Command Output (stderr):
--
/home/rox/Desktop/clad-dev/clad_obj/test/ROOT/Output/Interface.C.script: line 1: /home/rox/Desktop/clad-dev/inst/bin/FileCheck: No such file or directory

--

Could anyone please provide any help here?

@u-rox23 u-rox23 reopened this Jan 6, 2024
@sauravUppoor
Copy link
Contributor

@u-rox23 - It seems like the LLVM FileCheck utility is missing. You can do the following to get your tests working:

  1. Ensure that your source has the FileCheck utility present for your LLVM version (in /llvm/utils/), ideally if you are using anything above 3.x it should be present in that specified path. If it doesn't exist, consider upgrading your LLVM version to a latest release.
  2. If it exists, check if you had the -DLLVM_INSTALL_UTILS=ON flag in you cmake command. (As of March 08, 2016 auxiliary utilities are not built by default.)

@vgvassilev
Copy link
Owner

We should update our documentation to capture the suggested build process for developer builds.

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 a pull request may close this issue.

4 participants