Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Issues
  • #1809
Closed
Open
Issue created Mar 16, 2018 by Administrator@rootContributor

Buck expects import paths in cgo files to be relative to the Buck project root instead of the file's current directory

Created by: monty-uber

I have an example of this here: https://github.com/monty-uber/cgo-buck-example/tree/master/go-calls-c

All of the files are in the same directory, therefore the cgo_source.go file's import should be // #include "call_from_go.h". However, Buck complains that it cannot find the header file in that case. Changing it to be relative to the project root like so: // #include "go-calls-c/call_from_go.h" makes the Buck build succeed.

This makes these cgo files incompatible with the go toolchain as go build expects the import paths to be relative to the file itself.

This is also apparent in the integration tests in Buck: https://github.com/facebook/buck/tree/master/test/com/facebook/buck/go/testdata/cgo/src/cgo_test. It's the same scenario, the go code that references C is in cgosrc.go, which has the include path of "src/cgo_test/lib.h" even though lib.h is in the same directory.

Assignee
Assign to
Time tracking