Skip to content

cmd/go: handle pkg-config output containing spaces #16455

Closed
@ktsakas

Description

@ktsakas

I am using Go v1.6.2 on Windows 10.
I tried to build the git2go package in MinGW-w64 using go build but it fails.
When I run go build -x, I get the following:

CGO_LDFLAGS="-g" "-O2" "-LC:/Program" "Files" "(x86)/libgit2/lib" "-lgit2" 
"C:\\Go\\pkg\\tool\\windows_amd64\\cgo.exe" -objdir 
"C:\\msys64\\tmp\\go-build610654106\\github.com\\libgit2\\git2go\\_obj\\" 
-importpath github.com/libgit2/git2go -- Files (x86)/libgit2/include 
-IC:/Program -I "C:\\msys64\\tmp\\go-build610654106\\github.com\\libgit2\\git2go\\_obj\\" 
blame.go blob.go branch.go checkout.go cherrypick.go clone.go commit.go 
config.go credentials.go describe.go diff.go git.go graph.go 
handles.go ignore.go index.go merge.go note.go object.go odb.go packbuilder.go 
patch.go refdb.go reference.go remote.go repository.go reset.go revparse.go settings.go 
signature.go status.go submodule.go tag.go tree.go walk.go
# github.com/libgit2/git2go
gcc: error: Files: No such file or directory
gcc: error: (x86)/libgit2/include: No such file or directory

Notice how "-LC:/Program" "Files" "(x86)/libgit2/lib" flag is split up on every space and the parts are put in quotes, which seems to cause the issue.
I understand that mingw has problems with spaces in paths, however this should be fixable in build.go.

The issue has been mentioned again in git2go#155.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions