`make build` raises error

Hi, all!

I am trying to build Gitea from source. Followed the instruction, I clone the repo to my local machine and run TAGS="bindata" make build. Then I got this error

Running go generate...
CGO_CFLAGS="-O2 -g -DSQLITE_MAX_VARIABLE_NUMBER=32766" go build -v  -tags '' -ldflags '-s -w -L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib -X "main.MakeVersion=GNU Make 3.81" -X "main.Version=1.22.0+dev-59-g15a504cb9" -X "main.Tags="' -o gitea
# code.gitea.io/gitea
flag provided but not defined: -L/usr/local/opt/zlib/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

Things I’ve chekced:

  • I checked the directory /usr/local/opt/zlib/lib it is not empty.
  • which go gives /Users/someusername/.gvm/gos/go1.21/bin/go
  • I am using MacOS 13.4
  • I did run go get ./... in the directory to get all the dependencies ready

Is there anything I’ve missed?

Hi, I just resolve this issue.

Turns out the LDFLAGS is set in my .zshrc, the build was successful after I unset the environmnt variable. (I don’t remember when I set this variable, but if you happen to use pyenv, it comes with this setting in the .zshrc)