Skip to content

Errors when building for Mac #47

Closed
@prasanthcaibmcom

Description

@prasanthcaibmcom

Can we cross compile a Mac build of our binary which uses go_ibm_db on a Linux machine?

When running with CGO_ENABLED=1:

+ CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o agent-linux .
+ CGO_ENABLED=1 GOOS=windows go build -a -installsuffix cgo -o agent-windows .
+ CGO_ENABLED=1 GOOS=darwin go build -a -installsuffix cgo -o agent-darwin .
# net
../../tools/org.jenkinsci.plugins.golang.GolangInstallation/1.13/src/net/cgo_bsd.go:15:72: could not determine kind of name for C.AI_MASK
# os/user
../../tools/org.jenkinsci.plugins.golang.GolangInstallation/1.13/src/os/user/getgrouplist_darwin.go: In function ‘mygetgrouplist’:
../../tools/org.jenkinsci.plugins.golang.GolangInstallation/1.13/src/os/user/getgrouplist_darwin.go:16:11: warning: implicit declaration of function ‘getgrouplist’ [-Wimplicit-function-declaration]
  int rv = getgrouplist(user, (int) group, buf, ngroups);

Is it possible to cross-compile the package without building the driver into the binary? And allow the appropriate driver to be present at runtime ?

We are importing and using the driver like this:

import (
	"database/sql"

	_ "github.com/ibmdb/go_ibm_db"
)
	db, err := sql.Open("go_ibm_db", con)

We would like to use a single Linux environment to build all binaries for Windows, Mac, and Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions