binder icon indicating copy to clipboard operation
binder copied to clipboard

Is building broken?

Open KeyID7 opened this issue 3 years ago • 9 comments

I used Ubuntu 18.04 and tried to build with pre-installed LLVM.

First I tried to use llvm6 but got a lot of errors like this:

/usr/lib/llvm-6.0/lib/libclangAST.a(Expr.cpp.o):function clang::StringLiteral::getLocationOfByte(unsigned int, clang::SourceManager const&, clang::LangOptions const&, clang::TargetInfo const&, unsigned int*, unsigned int*) const: error: undefined reference to 'clang::Lexer::Lexer(clang::SourceLocation, clang::LangOptions const&, char const*, char const*, char const*)'

when linking source/binder.

Then I tried to use llvm 10. This time it succeeded in linking source/binder but reported this error:

error: no such file or directory: '/root/binder_master/test/T50.namespace_binder.hpp.include' error: no input files error: unable to handle compilation, expected exactly one compiler job in ''

So is there anything wrong with this project's cmake configuration?

KeyID7 avatar Nov 10 '21 13:11 KeyID7

@KeyID7 linking against system-wide install of LLVM might get tricky. I am brining @andriish who might know whats going on. As immediate solution i would recommend to use our build.py script which will side-install LLVM.

lyskov avatar Nov 11 '21 02:11 lyskov

I found the first error is CMakeLists.txt lacks some clang library when linking, at least for my system-wide installed LLVM.

The second error is because we must make in the root directory of the project.

KeyID7 avatar Nov 11 '21 03:11 KeyID7

Great, - so this is solved then? Should i close the issue? Thanks,

lyskov avatar Nov 11 '21 03:11 lyskov

The second error is solved. But for the first problem, I think the current source/CMakeLists.txt needs to be modified if the system-wide installed LLVM is in the supported list.

By the way, is there any potential problem if I use different versions of LLVM for compiling binder and the codes generated by binder?

KeyID7 avatar Nov 11 '21 03:11 KeyID7

Please note that source/CMakeLists.txt is not intended for direct use when compiling with system-wide install of LLVM, instead https://github.com/RosettaCommons/binder/blob/master/CMakeLists.txt should be used.

By the way, is there any potential problem if I use different versions of LLVM for compiling binder and the codes generated by binder? -- no, that should not be an issue. Thats why our default building script is doing local LLVM install

lyskov avatar Nov 12 '21 19:11 lyskov

I did use the CMakeLists.txt under the root directory. Maybe there is something special in the package of Ubuntu 18.04, I'm not sure.

I think you can close the issue if the broken building is acceptable with some system-wide installed LLVM, since the local LLVM will cause no compatible problem.

Thanks for your reply!

KeyID7 avatar Nov 13 '21 05:11 KeyID7

Hi @KeyID7 ,

lacks some clang library when linking, at least for my system-wide installed LLVM

LLVM is large and each project (e.g. Fedora/Ubuntu) builds it in a slightly different way, so this might be the case. That actually makes sense to have Ubuntu18 in the CI, but how do you install llvm6 there? Is that 6.0.0 or 6.0.1? Also, in the CI LLVM 6.0.1 is used in Fedora28.

Best regards, Andrii

andriish avatar Nov 16 '21 18:11 andriish

@andriish I used apt install clang llvm libclang-dev llvm-dev to install LLVM and clang. I didn't specify the version of llvm in the apt command and the version I got by default is 6.0.0.

KeyID7 avatar Nov 17 '21 03:11 KeyID7

Hi @KeyID7 ,

apt install clang llvm libclang-dev llvm-dev

great. I am able to reproduce the setup and see similar errors.

From what I see the main difference between Fedora and Ubuntu is that Fedora provides dynamic libraries libclangAST libclangBasic libclangFrontend libclangTooling for clang6 but Ubuntu provides only static libraries.

For version 10, I assume,^1 Ubuntu provides libclang and libclang-cpp as dynamic libraries, same as Fedora. That is why it works with version 10.

One could also enable builds of binder with static libraries, but it is a bit more complex and as far as I remember quite senseless -- binder would need a lot of files in addition to the executable itself, so a huge executable + a lot of files has no benefits in comparison to small executable+ couple shared libraries + a lot of files. Practically, builds with static libraries would be needed only in the cases similar to the case of Ubuntu18: non-optimal installation of clang libraries. I can have a look if that is possible, but not immediately.

Best regards, Andrii ^1 I'm not Ubuntu user.

andriish avatar Nov 17 '21 09:11 andriish