Hi,
I'm not sure if this is the right forum to ask this question. But I take my chances anyways. I am trying to build the branch swif/tensorflow llvm repo. I am facing following issues.
I am building the toolchain on Linux Ubuntu 18.04 machine. (Build also fails on the mater please check the EDIT section of the post below)
Here are the steps I'm following as per the build instructions from the Readme.md file. I have installed all the dependencies as suggested before trying to compile the code.
git clone https://github.com/apple/llvm-project.git
cd llvm-project
git checkout swift/tensorflow
mkdir build
cd build
cmake -G "Unix Makefiles" --DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" ../llvm
cmake -build .
I do face some errors regarding the -fpermissive
In file included from /home/gl-245/swift_stuff/cherry_pick_ex/my_llvm_fork/llvm-project/clang/lib/CrossTU/CrossTranslationUnit.cpp:18:0:
/home/gl-245/swift_stuff/cherry_pick_ex/my_llvm_fork/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:196:48: error: declaration of âllvm::IntrusiveRefCntPtr<clang::InMemoryOutputFileSystem> clang::CompilerInstance::InMemoryOutputFileSystemâ [-fpermissive]
IntrusiveRefCntPtr<InMemoryOutputFileSystem> InMemoryOutputFileSystem;
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/gl-245/swift_stuff/cherry_pick_ex/my_llvm_fork/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:15:0,
from /home/gl-245/swift_stuff/cherry_pick_ex/my_llvm_fork/llvm-project/clang/lib/CrossTU/CrossTranslationUnit.cpp:18:
/home/gl-245/swift_stuff/cherry_pick_ex/my_llvm_fork/llvm-project/clang/include/clang/Basic/InMemoryOutputFileSystem.h:31:7: error: changes meaning of âInMemoryOutputFileSystemâ from âclass clang::InMemoryOutputFileSystemâ [-fpermissive]
class InMemoryOutputFileSystem : public llvm::vfs::FileSystem {
^~~~~~~~~~~~~~~~~~~~~~~~
I did fix this error by renaming the variable InMemoryOutputFileSystem to InMemoryOutputFileSystemVar (Just changed the name so that class and the variable names will not collide) In couple of places in where this variable is used.
modified: clang/include/clang/Frontend/CompilerInstance.h
modified: clang/lib/Frontend/CompilerInstance.cpp
After that build is passing the compilation stage. But I'm facing the linking errors. Not sure how to fix this linker error.
[ 85%] Linking CXX executable ../../../../bin/clang
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
tools/clang/tools/driver/CMakeFiles/clang.dir/build.make:335: recipe for target 'bin/clang-10' failed
make[2]: *** [bin/clang-10] Error 1
make[2]: *** Deleting file 'bin/clang-10'
CMakeFiles/Makefile2:33814: recipe for target 'tools/clang/tools/driver/CMakeFiles/clang.dir/all' failed
make[1]: *** [tools/clang/tools/driver/CMakeFiles/clang.dir/all] Error 2
Makefile:170: recipe for target 'all' failed
make: *** [all] Error 2
Any inputs on how to fix this error will be helpful.
EDIT:
I did checkout the apple/llvm-project and ran the same commands. Surprisingly I am getting the same error. This means the error is not specific to swift/tensorflow branch. But the apple/llvm-project master itself is failing in my case. Any inputs?