-
Notifications
You must be signed in to change notification settings - Fork 951
main: use internal libclang to build C and assembly files #184
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
Conversation
With this change, the release tarball grows from 44MB to 50MB compressed, the extracted files combined (according to |
Also, this is a building block for supporting standard header includes in CGo preambles: // #include <stdint.h>
import "C" |
Related to the discussion we had in Slack, I wonder whether the inclusion of LLVM code is allowed? It's licensed under a BSD-like license, but not the BSD 3-clause license. |
Please provide link to specific code and we can try to ensure that we are including any required notices. |
This is the source: I would like to refactor this upstream so we can use it more easily (without copyright issues), but that's not the case at the moment of course. |
I think we should add
to the file https://github.com/tinygo-org/tinygo/blob/dev/LICENSE as well as updating year and the authorship of as we had previously discussed to "The TinyGo Authors". However, perhaps all that is best done in a separate PR? |
Is this PR otherwise ready to be merged? |
There are a few things which I'd like to fix before merging. |
OK sounds good. Just post to this PR when ready for review. |
I found a rather inconvenient issue: libclang.so does not export So I see 3 possible ways around this:
I'm slightly in favor of 2. @deadprogram what do you think? |
Oh, there is a 4th option: invoke |
If we go with option 2, what do we then need to do to install TinyGo with the CGo support? |
Pinging this PR to re-ask same question, as above. |
Build it statically with LLVM, like is done now for release builds. Maybe we can automate this somehow, with (for example) |
Also, I want to build it statically in CircleCI to make sure CGo support gets proper test coverage. This depends on local changes I have here (almost finished!) which in turn depend on #211. |
Now that #211 is merged, this PR can proceed, correct? |
No, there are a few more changes needed. In particular, #256. |
This avoids a dependency on the clang-7 tool for release builds.
Now that we have a viable way to build static executable, especially on macOS, we need this more than ever! :) |
Just wondering if this PR is now possible on all supported platforms? |
Probably. I have started work on rebasing it, but it turned out to be a bit more difficult. |
Any idea if that's on purpose, or if it could be fixed upstream so that it does? |
All exported functions in libclang are related to traversing the C AST, I think that's their goal and they don't want to expose the compiler itself. |
Just noticed the last comment. That is not entirely encouraging. Is this going to be a viable long-term approach? |
I had misunderstood something. Libclang on its own is good enough: it already uses the Clang driver internally. |
If accepted, this would make the PR much simpler: https://reviews.llvm.org/D63852 |
This PR is a bit dormant. Also I see that the LLVM PR never has seemed to go anywhere. That said, the LLVM installation is the biggest inconvenience when using TinyGo. Perhaps once TinyGo is using LLVM 9 we can revisit this? |
This PR was grossly out of date, so I replaced it with a new one: #769. |
This avoids a dependency on the clang-7 tool for release builds.
Note: this may need some more testing.