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

Is building broken? #162

Open
KeyID7 opened this issue Nov 10, 2021 · 9 comments
Open

Is building broken? #162

KeyID7 opened this issue Nov 10, 2021 · 9 comments

Comments

@KeyID7
Copy link

KeyID7 commented Nov 10, 2021

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?

@lyskov
Copy link
Member

lyskov commented Nov 11, 2021

@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.

@KeyID7
Copy link
Author

KeyID7 commented Nov 11, 2021

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.

@lyskov
Copy link
Member

lyskov commented Nov 11, 2021

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

@KeyID7
Copy link
Author

KeyID7 commented Nov 11, 2021

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?

@lyskov
Copy link
Member

lyskov commented Nov 12, 2021

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

@KeyID7
Copy link
Author

KeyID7 commented Nov 13, 2021

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!

@andriish
Copy link
Contributor

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

@KeyID7
Copy link
Author

KeyID7 commented Nov 17, 2021

@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.

@andriish
Copy link
Contributor

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.

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

3 participants