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

Not able to build master branch following instructions in documentation #8605

Closed
2 of 7 tasks
hiteshnayak305 opened this issue Oct 21, 2019 · 18 comments
Closed
2 of 7 tasks
Labels
type/question Issue needs no code to be fixed, only a description on how to fix it yourself.

Comments

@hiteshnayak305
Copy link

Description

I am not able to build master branch trying to build after issue #8603 resolved.

steps followed
go get -d -u code.gitea.io/gitea
cd "$GOPATH/src/code.gitea.io/gitea"
TAGS="bindata sqlite sqlite_unlock_notify" make generate build
...

Screenshots

@hiteshnayak305
Copy link
Author

It is found that " around tags is not required. Can it be corrected in documentation. It is confusing.
TAGS="bindata sqlite sqlite_unlock_notify"

@zeripath
Copy link
Contributor

Heya! Sorry you found it confusing. Which document were you looking at and where?

Glad you got it building in the end.

@hiteshnayak305
Copy link
Author

Actually I am still not able to build. Is Dockerfile compatible building on windows system?

Following places flags are wrapped with double quotes which is causing error in cmd
/.bat file

https://docs.gitea.io/en-us/install-from-source/
image

https://docs.gitea.io/en-us/hacking-on-gitea/
image

@hiteshnayak305
Copy link
Author

I am able to build now. Please do the needful to documentation and close the issue.

One thing i want to know my build .exe is only 60 mb but released versions are around 100mb . why?

@zeripath
Copy link
Contributor

Ah you're building on Windows. Sigh.

Ok those docs expect you to be working in a reasonable shell which cmd is not. Powershell might work otherwise you might need a cygwin or other such environment.

I'm gonna defer to @lunny and his expertise here.

You need to set the TAGS as an environment variable before running make - that's what the TAGS="..." is trying to do.

I think trying to build a docker on windows might fail though - I don't know if xgo can cross-compile from Windows.

@hiteshnayak305
Copy link
Author

Successfully build from cmd.

@echo on
go get -d code.gitea.io/gitea
C:
cd "%GOPATH%/src/code.gitea.io/gitea"

set TAGS=bindata sqlite sqlite_unlock_notify
make clean
make generate
make build

@hiteshnayak305
Copy link
Author

One thing i want to know my build .exe is only 60 mb but released versions are around 100mb . why?
Is there any problem in my build?

@zeripath
Copy link
Contributor

zeripath commented Oct 21, 2019

Are you sure you shouldn't have " around those TAGS?

e.g.

set TAGS="bindata sqlite sqlite_unlock_notify"

If you haven't embedded SQLite into the binary that could explain why it is 40Mb smaller.


EDIT: Just when you think cmd couldn't be worse you see something worse.

@hiteshnayak305
Copy link
Author

GO111MODULE=on go build -mod=vendor -v -tags '"bindata sqlite sqlite_unlock_notify"' -ldfl......

is invalid statement giving error as :

code.gitea.io/gitea

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

No proper usage of statement
ref:attached log

@hiteshnayak305
Copy link
Author

If you haven't embedded SQLite into the binary that could explain why it is 40Mb smaller. ?

@guillep2k
Copy link
Member

Are you sure you shouldn't have " around those TAGS?

e.g.

set TAGS="bindata sqlite sqlite_unlock_notify"

If you haven't embedded SQLite into the binary that could explain why it is 40Mb smaller.

In Windows Command Prompt, the quotes become part of the variable:

C:\> set HELLO="HELLO HOW ARE YOU?"
C:\> set | findstr HELLO
HELLO="HELLO HOW ARE YOU?"

C:\> set HELLO=HELLO HOW ARE YOU?
C:\> set | findstr HELLO
HELLO=HELLO HOW ARE YOU?

Yes, it's very frustrating. Writing "proper" batch files in Windows is a dark art full of caveats, workarounds and lots of toads 🐸. I think git-bash should be used to build under Windows (although I didn't tried).

@jolheiser
Copy link
Member

When I develop Gitea on Windows, I use Git Bash, which so far has allowed me to use the same commands as our documentation.

@hiteshnayak305
Copy link
Author

Is embedding SQLite into binary necessary. My 60mb binary working fine till now

@jolheiser
Copy link
Member

Embedding SQLite (library) is only necessary if you plan on using SQLite.
According to your original issue you use it, so it will need to be embedded.

@hiteshnayak305
Copy link
Author

But how come it is working fine with my old installation?

@jolheiser
Copy link
Member

Successfully build from cmd.

@echo on
go get -d code.gitea.io/gitea
C:
cd "%GOPATH%/src/code.gitea.io/gitea"

set TAGS=bindata sqlite sqlite_unlock_notify
make clean
make generate
make build

Looks like you embedded SQLite

@hiteshnayak305
Copy link
Author

But i got 60mb binary from above build process

@techknowlogick techknowlogick added the type/question Issue needs no code to be fixed, only a description on how to fix it yourself. label Oct 21, 2019
@jolheiser
Copy link
Member

When I build Gitea locally on Windows, mine is also ~60mb.
My guess is when it's built with xgo vs natively the size is larger for some reason.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/question Issue needs no code to be fixed, only a description on how to fix it yourself.
Projects
None yet
Development

No branches or pull requests

5 participants