"cannot find package" when building from sources sources #2491

Closed
opened 2025-11-02 04:38:22 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @Equidamoid on GitHub (Nov 4, 2018).

Description

While trying to build gitea from sources (https://docs.gitea.io/en-us/install-from-source/, the "no downloads" way, of course) build fails with following error:

can't load package: package _/home/git/gitea/gitea/cmd: cannot find package "_/home/git/gitea/gitea/cmd" in any of:
	/usr/lib/go/src/_/home/git/gitea/gitea/cmd (from $GOROOT)
	/home/user/go/src/_/home/git/gitea/gitea/cmd (from $GOPATH)
Originally created by @Equidamoid on GitHub (Nov 4, 2018). - Gitea version (or commit ref): master or tag v.1.5.3 - Git version: irrelevant - Operating system: linux - Log gist: https://gist.github.com/Equidamoid/2bfde6cf3d3ec7245312b7528d657fd0 `go version go1.10.3 linux/amd64` ## Description While trying to build gitea from sources (https://docs.gitea.io/en-us/install-from-source/, the "no downloads" way, of course) build fails with following error: ``` can't load package: package _/home/git/gitea/gitea/cmd: cannot find package "_/home/git/gitea/gitea/cmd" in any of: /usr/lib/go/src/_/home/git/gitea/gitea/cmd (from $GOROOT) /home/user/go/src/_/home/git/gitea/gitea/cmd (from $GOPATH) ```
GiteaMirror added the type/question label 2025-11-02 04:38:22 -06:00
Author
Owner

@Equidamoid commented on GitHub (Nov 4, 2018):

After doing

ln -s src/github.com/ .
ln -s gitea ../src

Where "gitea" is the name of current directory, make generate succeeded, but build still fails with something like

main.go:13:2: cannot find package "code.gitea.io/gitea/cmd" in any of:
	/usr/lib/go/src/code.gitea.io/gitea/cmd (from $GOROOT)
	/home/git/gitea/src/code.gitea.io/gitea/cmd (from $GOPATH)
main.go:14:2: cannot find package "code.gitea.io/gitea/modules/log" in any of:
	/usr/lib/go/src/code.gitea.io/gitea/modules/log (from $GOROOT)
	/home/git/gitea/src/code.gitea.io/gitea/modules/log (from $GOPATH)
@Equidamoid commented on GitHub (Nov 4, 2018): After doing ``` ln -s src/github.com/ . ln -s gitea ../src ``` Where "gitea" is the name of current directory, `make generate` succeeded, but build still fails with something like ``` main.go:13:2: cannot find package "code.gitea.io/gitea/cmd" in any of: /usr/lib/go/src/code.gitea.io/gitea/cmd (from $GOROOT) /home/git/gitea/src/code.gitea.io/gitea/cmd (from $GOPATH) main.go:14:2: cannot find package "code.gitea.io/gitea/modules/log" in any of: /usr/lib/go/src/code.gitea.io/gitea/modules/log (from $GOROOT) /home/git/gitea/src/code.gitea.io/gitea/modules/log (from $GOPATH) ```
Author
Owner

@Equidamoid commented on GitHub (Nov 4, 2018):

After doing go get and adding ../../../bin to PATH it worked.
IMO it would be useful to add the following to the install doc:

  • Build from git cloned sources requires additional setup (and some hints how to do it)
  • ../../../bin must be in PATH while building
@Equidamoid commented on GitHub (Nov 4, 2018): After doing `go get` and adding `../../../bin` to PATH it worked. IMO it would be useful to add the following to the install doc: - Build from `git clone`d sources requires additional setup (and some hints how to do it) - `../../../bin` must be in PATH while building
Author
Owner

@sapk commented on GitHub (Nov 4, 2018):

Hello
What command did you use to download the sources ?

@sapk commented on GitHub (Nov 4, 2018): Hello What command did you use to download the sources ?
Author
Owner

@Equidamoid commented on GitHub (Nov 4, 2018):

git clone&& git checkout
Yeah, that's probably where it went wrong.

I guess git clone ... ; cd ...; make way is not supported and I have to use magical go get, right?

@Equidamoid commented on GitHub (Nov 4, 2018): `git clone&& git checkout` Yeah, that's probably where it went wrong. I guess `git clone ... ; cd ...; make` way is not supported and I have to use magical `go get`, right?
Author
Owner

@sapk commented on GitHub (Nov 4, 2018):

We don't use go modules (yet) so you need to have a working GOPATH and use go get -u -v code.gitea.io/gitea. This command will git clone in the correct folder ($GOPATH/src/code.gitea.io/gitea) and build gitea.

@sapk commented on GitHub (Nov 4, 2018): We don't use go modules (yet) so you need to have a working GOPATH and use `go get -u -v code.gitea.io/gitea`. This command will git clone in the correct folder ($GOPATH/src/code.gitea.io/gitea) and build gitea.
Author
Owner

@sapk commented on GitHub (Nov 4, 2018):

For the insigth code.gitea.io/gitea will redirect to github repo. This will ease the process of migrating to a futur hosted gitea by changing the redirection.

@sapk commented on GitHub (Nov 4, 2018): For the insigth code.gitea.io/gitea will redirect to github repo. This will ease the process of migrating to a futur hosted gitea by changing the redirection.
Author
Owner

@techknowlogick commented on GitHub (Nov 4, 2018):

Here are more instructions on how to work with the source: https://docs.gitea.io/en-us/hacking-on-gitea/

@techknowlogick commented on GitHub (Nov 4, 2018): Here are more instructions on how to work with the source: https://docs.gitea.io/en-us/hacking-on-gitea/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2491