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

Build failure: git-lfs #1013

Open
dmacks opened this issue Mar 20, 2023 · 5 comments
Open

Build failure: git-lfs #1013

dmacks opened this issue Mar 20, 2023 · 5 comments

Comments

@dmacks
Copy link
Member

dmacks commented Mar 20, 2023

OS X 10.13, with git-2.34.0-1 and go-1.16.6-1, git-lfs-2.9.0-1 fails to build:

        export GOPATH=/sw/build.build/git-lfs-2.9.0-1/git-lfs-2.9.0

        rm $GOPATH/go.mod
        mkdir -p src/github.com/git-lfs
        ln -s /sw/build.build/git-lfs-2.9.0-1/git-lfs-2.9.0 src/github.com/git-lfs/git-lfs

        pushd  src/github.com/git-lfs/git-lfs
/sw/build.build/git-lfs-2.9.0-1/git-lfs-2.9.0/src/github.com/git-lfs/git-lfs /sw/build.build/git-lfs-2.9.0-1/git-lfs-2.9.0
        make
go list -f '{{ join .Deps "\n" }}' . \
        | xargs go list -f \
                '{{ if and (not .Standard) (not .Module) }} \
                        {{ .ImportPath }} \
                {{ end }}' \
        | grep -v "github.com/git-lfs/git-lfs" \
        | grep "."
go generate github.com/git-lfs/git-lfs/commands
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
make: *** [lint] Error 1

I have a .deb for this same package from December 2020, so something has bit-rotted since @leighsmith's fix in #511. I tried with apple's make and gnumake and fink's make. I get the same result when I tried to bump it to 3.3.0 (current upstream). But there's some patching I don't understand already, so I don't know how to pursue this.

@nieder
Copy link
Member

nieder commented Sep 3, 2023

Downgrading go from 1.16.6 to 1.14.6 let git-lfs work. So that's the source of the failure. go was updated in 5e63b5c. No idea on how to fix this, however.

@nieder
Copy link
Member

nieder commented Sep 3, 2023

Also, current git-lfs.info removes %b/go.mod

export GOPATH=%b
rm $GOPATH/go.mod

which the failure complains about. But keeping go.mod, gives this error:

go generate github.com/git-lfs/git-lfs/commands
$GOPATH/go.mod exists but should not

The intertubes say that go mod init github.com/git-lfs/git-lfs can be used to create go.mod followed by go mod tidy and maybe make go.sum, but that's all I can handle.

@cooljeanius
Copy link

I'm on Big Sur with Xcode 13, and for me the error is:

git-lfs: skipping fmt, no goimports found at `goimports` ...
GOOS= GOARCH= go build -ldflags=" -X github.com/git-lfs/git-lfs/config.GitCommit=4085a56d -s -w -extldflags -L/opt/sw/lib/0 -L/opt/sw/lib -Wl,-headerpad_max_install_names" -gcflags="all=-trimpath="$HOME" " -asmflags="all=-trimpath="$HOME"" -trimpath -o ./bin/git-lfs ./git-lfs.go
# command-line-arguments
flag provided but not defined: -L/opt/sw/lib
usage: link [options] main.o
  -B note
    	add an ELF NT_GNU_BUILD_ID note when using ELF
  -E entry
    	set entry symbol name
  -H type
    	set header type
  -I linker
    	use linker as ELF dynamic linker
  -L directory
    	add specified directory to library path
  -R quantum
    	set address rounding quantum (default -1)
  -T address
    	set text segment address (default -1)
  -V	print version and exit
  -X definition
    	add string value definition of the form importpath.name=value
  -a	disassemble output
  -buildid id
    	record id as Go toolchain build id
  -buildmode mode
    	set build mode
  -c	dump call graph
  -compressdwarf
    	compress DWARF if possible (default true)
  -cpuprofile file
    	write cpu profile to file
  -d	disable dynamic executable
  -debugtramp int
    	debug trampolines
  -dumpdep
    	dump symbol dependency graph
  -extar string
    	archive program for buildmode=c-archive
  -extld linker
    	use linker when linking in external mode
  -extldflags flags
    	pass flags to external linker
  -f	ignore version mismatch
  -g	disable go package data checks
  -h	halt on error
  -importcfg file
    	read import configuration from file
  -installsuffix suffix
    	set package directory suffix
  -k symbol
    	set field tracking symbol
  -libgcc string
    	compiler support lib for internal linking; use "none" to disable
  -linkmode mode
    	set link mode
  -linkshared
    	link against installed Go shared libraries
  -memprofile file
    	write memory profile to file
  -memprofilerate rate
    	set runtime.MemProfileRate to rate
  -msan
    	enable MSan interface
  -n	dump symbol table
  -newobj
    	use new object file format
  -o file
    	write output to file
  -pluginpath string
    	full path name for plugin
  -r path
    	set the ELF dynamic linker search path to dir1:dir2:...
  -race
    	enable race detector
  -s	disable symbol table
  -strictdups int
    	sanity check duplicate symbol contents during object file reading (1=warn 2=err).
  -tmpdir directory
    	use directory for temporary files
  -u	reject unsafe packages
  -v	print link trace
  -w	disable DWARF generation
make: *** [Makefile:230: bin/git-lfs] Error 2
### execution of /tmp/fink.qwI44 failed, exit code 2
### execution of /tmp/fink.cA3d0 failed, exit code 2
Removing runtime build-lock...
Removing build-lock package...
/opt/sw/bin/dpkg-lockwait -r fink-buildlock-git-lfs-2.9.0-1
(Reading database ... 
dpkg: serious warning: files list file for package `fink-buildlock-ccp4-6.5-1' missing, assuming package has no files currently installed.
989967 files and directories currently installed.)
Removing fink-buildlock-git-lfs-2.9.0-1 ...

@nieder
Copy link
Member

nieder commented Sep 24, 2023

@cooljeanius that sounds like go is reading LDFLAGS and somehow turning it into a new flag, even though the blurb you show has it inside the -ldflags=" ... " flag for the go command. go does a bunch of things differently than many other build systems (I have no idea how it works). It's interesting that it's failing on something as common as LDFLAGS.

@cooljeanius
Copy link

getting a different error now:

go generate github.com/git-lfs/git-lfs/commands
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
make: *** [Makefile:438: lint] Error 1
### execution of /tmp/fink.8P8OO failed, exit code 2
### execution of /tmp/fink.Us_uR failed, exit code 2
Removing runtime build-lock...
Removing build-lock package...
/opt/sw/bin/dpkg-lockwait -r fink-buildlock-git-lfs-2.9.0-1

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

3 participants