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

implement a go-generate command for cgoflags #102

Open
sbinet opened this issue Dec 3, 2015 · 1 comment
Open

implement a go-generate command for cgoflags #102

sbinet opened this issue Dec 3, 2015 · 1 comment

Comments

@sbinet
Copy link
Member

sbinet commented Dec 3, 2015

finding the right combination of compilation flags for locating headers and linking against the right libclang is tricky and not user-friendly as (mainly) there is no pkg-config support for neither LLVM nor CLang.

there is a llvm-config program that mimics what pkg-config can do, but only for LLVM libraries, not libclang.
On top of that, llvm-config may not have been installed, or with a slightly different name, depending on the Linux distribution or OS.

to ease the burden on our brave users, we should probably have either a go run ./config-cgo.go program or a go generate step to perform the following drudgery:

  • find llvm-config and extract/infer the correct CFLAGS and LDFLAGS (handling the possible naming variations of libclang.so[.MAJOR[.MINOR]]
  • if no llvm-config could be found, try to look into canonical locations for the given libclang version, depending on the Linux distribution (or OS.)
  • then generate a cgoflags_gen.go file with the correct // #cgo directives embedded and hard-coded.
@zimmski
Copy link
Member

zimmski commented Sep 13, 2016

A general question, do we need repositories that are go-getable? I mean at the moment we say that users should use CGO_LDFLAGS="-Lllvm-config --libdir" go get -u github.com/go-clang/v3.7/... That is go-getable if libclang exists. I am asking because "go generate" (or any other code generation) means that the user has to do additional steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants