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

Compilation error opencl-clang/common_clang.cpp #85

Open
unbuilder opened this issue Aug 6, 2019 · 2 comments
Open

Compilation error opencl-clang/common_clang.cpp #85

unbuilder opened this issue Aug 6, 2019 · 2 comments

Comments

@unbuilder
Copy link

Quite new to github, if this isn't the proper way to report, or even worse: the answer is already available elsewhere: please let me know!

I'm following the in-tree 4-in-1-build of llvm, clang, spir-v and open-clang. Branches used are release_80 .

I get this error when compiling opencl-clang/common_clang.cpp :

ws/llvm/projects/opencl-clang/common_clang.cpp: In function ‘int Compile(const char*, const char**, unsigned int, const char**, const char*, size_t, const char*, const char*, const char*, Intel::OpenCL::ClangFE::IOCLFEBinaryResult**)’: ws/llvm/projects/opencl-clang/common_clang.cpp:305:50: **error**: invalid initialization of reference of type ‘std::ostream& {aka std::basic_ostream<char>&}’ from expression of type ‘llvm::raw_svector_ostream’ success = llvm::writeSpirv(M.get(), OS, Err); ^ In file included from ws/llvm/projects/opencl-clang/common_clang.cpp:56:0: ws/llvm/projects/llvm-spirv/include/LLVMSPIRVLib.h:103:6: note: in passing argument 2 of ‘bool llvm::writeSpirv(llvm::Module*, std::ostream&, std::__cxx11::string&)’ bool writeSpirv(Module *M, std::ostream &OS, std::string &ErrMsg);

@AlexeySotkin
Copy link
Contributor

Hi @unbuilder,
Thanks for reporting the issue. We will take a look into it.

@unbuilder
Copy link
Author

It seems this error disappeared in the master -branch so I "borrowed" the solution and hand-patched the source-code of common_clang.cpp:

  1. Added the class-definition SmallVectorBuffer

  2. Removed this line
    // llvm::raw_svector_ostream OS(pResult->getIRBufferRef());

  3. Added these two lines instead of (2.)
    SmallVectorBuffer StreamBuf(pResult->getIRBufferRef());
    std::ostream OS(&StreamBuf);

It compiled beautifully but I dont know if it works in a borader sense...hope so...

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

No branches or pull requests

2 participants