# \`make build\` raises error

**URL:** <https://forum.gitea.com/t/make-build-raises-error/7914>\
**Category:** General\
**Created:** [September 29, 2023, 2:07pm UTC](https://forum.gitea.com/t/make-build-raises-error/7914 "2023-09-29T14:07:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bb-ben](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/bb-ben/32/4070_2.png) [@bb-ben](https://forum.gitea.com/u/bb-ben)\
**Post date:** [September 29, 2023, 2:07pm UTC](https://forum.gitea.com/t/make-build-raises-error/7914/1 "2023-09-29T14:07:42Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![bb-ben](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/bb-ben/32/4070_2.png) [@bb-ben](https://forum.gitea.com/u/bb-ben)\
**Post date:** [October 1, 2023, 1:24pm UTC](https://forum.gitea.com/t/make-build-raises-error/7914/2 "2023-10-01T13:24:42Z")

</div>

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`)

---

<div class="post-metadata">

**Author:** ![lunny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/lunny/32/4701_2.png) [@lunny](https://forum.gitea.com/u/lunny)\
**Post date:** [October 2, 2023, 2:56am UTC](https://forum.gitea.com/t/make-build-raises-error/7914/3 "2023-10-02T02:56:26Z")

</div>


