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
  • Merge requests
  • !1012

WIP: Add cgo support.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/daedric/cgo into master Nov 13, 2016
  • Overview 10
  • Commits 4
  • Pipelines 0
  • Changes 13

Created by: daedric

This is a work in progress to add CGo support in Buck based on @mikekap work.

There are still a couple of issue to fix:

  • On Mac OS X this does not totally works:
  • -fno-pie does not exist and I did not yet find a standard way to check C/CXX compiler flags availability -> I've a switch-case on the platform;
  • The scrub on Mac OS X does not like, at all, the generated binary
  • Unit tests

But before going further I'd like a feedback on how I've been doing. First, about cgo

  • cgo sources need to be handled specifically by the cgo tool, the cgo tool acts a bit like a preprocessor
  • Thus upon cgo tool execution a couple of file are generated:
  • some C files from which at first we generate 1 binary and from it, we generate a go file
  • Then again, we regenerate a binary that will be linked by go during the last stage
  • All the generated Go sources and "regular" Go sources are to be compiled together and then linked.

First I've implemented a simple Cgo support with only Go sources. It allows one to have C source in Go source. The second step was to allow Cgo extension to be linked against a native library and let all the transitivity rules kicking in (esp. w.r.t the include paths). The main caevat of using buck for Cgo sources is that we can't depends on the {c/l}flags in the sources because we don't use go build

The approach taken minimally changed the existing code.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/daedric/cgo