[solved] 1.11.0 missing JS/CSS

I’m trying to build Gitea 1.11.0 on FreeBSD, and that appears to be working just fine; however, /js/index.js and all other similar resources only give a 404. Manually copying web_src to the public directory doesn’t seem to work, as the JS throws errors in the browser console.

Is there a missing build step or parameter?

===>  License MIT accepted by the user
===>   gitea-1.11.0 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by gitea-1.11.0 for building
===>  Extracting for gitea-1.11.0
=> SHA256 Checksum OK for go-gitea-gitea-v1.11.0_GH0.tar.gz.
===>  Patching for gitea-1.11.0
===>   gitea-1.11.0 depends on file: /usr/local/bin/go - found
===>  Configuring for gitea-1.11.0
===>  Building for gitea-1.11.0
(cd /var/ports/work/home/vagrant/gitea/work/gitea-1.11.0;  for t in :/usr/local/sbin/gitea; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/gitea/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^gitea$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env XDG_DATA_HOME=/var/ports/work/home/vagrant/gitea/work  XDG_CONFIG_HOME=/var/ports/work/home/vagrant/gitea/work  HOME=/var/ports/work/home/vagrant/gitea/work PATH=/var/ports/work/home/vagrant/gitea/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/vagrant/bin NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing "  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" CGO_ENABLED=1  CGO_CFLAGS="-I/usr/local/include"  CGO_LDFLAGS="-L/usr/local/lib"  GOARM= GOPATH=""  GOBIN="/var/ports/work/home/vagrant/gitea/work/bin" /usr/local/bin/go build -tags "cert pam sqlite sqlite_unlock_notify" -ldflags '-X "main.Version=1.11.0"' -v -buildmode=exe -mod=vendor  -o /var/ports/work/home/vagrant/gitea/work/bin/${out}  ${pkg};  done)
===>  Building gitea from 
golang.org/x/crypto/internal/subtle
github.com/gobwas/glob/util/runes
runtime/cgo
github.com/mcuadros/go-version
gopkg.in/asn1-ber.v1
code.gitea.io/gitea/modules/process
github.com/emirpasic/gods/utils
golang.org/x/sys/unix
gopkg.in/src-d/go-billy.v4
github.com/emirpasic/gods/containers
gopkg.in/src-d/go-billy.v4/helper/polyfill
github.com/emirpasic/gods/lists

...

github.com/shurcooL/vfsgen
code.gitea.io/gitea/modules/markup/orgmode
code.gitea.io/gitea/routers/api/v1/repo
code.gitea.io/gitea/routers/api/v1/user
code.gitea.io/gitea/routers/api/v1/admin
code.gitea.io/gitea/routers/api/v1/org
code.gitea.io/gitea/routers/api/v1
code.gitea.io/gitea/routers/routes
code.gitea.io/gitea/cmd
code.gitea.io/gitea
# code.gitea.io/gitea
cc: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
===>  Staging for gitea-1.11.0
===>   gitea-1.11.0 depends on executable: git - found
===>   Generating temporary packing list
===> Creating groups.
===> Creating users
for t in :/usr/local/sbin/gitea; do  dst=$(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/gitea/');  src=$(/usr/bin/basename ${dst});  case ${dst} in  /*) dst=/var/ports/work/home/vagrant/gitea/work/stage${dst}; /bin/mkdir -p $(/usr/bin/dirname ${dst}) ;;  *) dst=/var/ports/work/home/vagrant/gitea/work/stage/usr/local/bin/${src} ;;  esac;  echo "===>  Installing ${src} as ${dst}";  install  -s -m 555 /var/ports/work/home/vagrant/gitea/work/bin/${src} ${dst};  done
===>  Installing gitea as /var/ports/work/home/vagrant/gitea/work/stage/usr/local/sbin/gitea
install  -m 0644 /var/ports/work/home/vagrant/gitea/work/app.ini.sample /var/ports/work/home/vagrant/gitea/work/stage/usr/local/etc/gitea/conf/app.ini.sample
install  -m 0644 /var/ports/work/home/vagrant/gitea/work/gitea-1.11.0/custom/conf/app.ini.sample /var/ports/work/home/vagrant/gitea/work/stage/usr/local/etc/gitea/conf/app.ini.defaults
cd /var/ports/work/home/vagrant/gitea/work/gitea-1.11.0 && /bin/sh -c '(/usr/bin/find -Ed $1 $3 | /usr/bin/cpio -dumpl $2 >/dev/null 2>&1) &&  /usr/bin/find -Ed $1 $3 \(   -type d -exec /bin/sh -c '\''cd '\''$2'\'' && chmod 755 "$@"'\'' . {} +  -o -type f -exec /bin/sh -c '\''cd '\''$2'\'' && chmod 0644 "$@"'\'' . {} + \)' COPYTREE_SHARE "options public templates" /var/ports/work/home/vagrant/gitea/work/stage/usr/local/share/gitea
====> Compressing man pages (compress-man)
===> Staging rc.d startup script(s)
====> Running Q/A tests (stage-qa)
===>  Installing for gitea-1.11.0
===>  Checking if gitea is already installed
===>   Registering installation for gitea-1.11.0

How are you building Gitea?

The make command used is make build
If you want SQLite, it would be TAGS="sqlite sqlite_unlock_notify" make build
If you want the assets embedded, TAGS="bindata" make build
Or the combination of the two latter commands

I’ve gotten a bit further. Previously, the build was a mostly pure Go build, now it’s gmake with, among others, an NPM-based toolset.

The Makefile uses a lot of invocations that only work with Linux command line tools, which doesn’t make it easier.

Ah, yes, the tools have increased.
On Windows I’ve had good luck using Git Bash, though on other non-unix systems I’m not sure on the best way to do it.

If you could let us know about what tools you have problems with and how you solve that, we can either update our docs or better still improve our Makefile. :grin:

1 Like

One step further: I can build it (I think), but make install fails:

gmake[2]: Entering directory '/var/ports/work/home/vagrant/gitea/work/gitea-1.11.0'

go install -v -tags 'bindata pam sqlite sqlite_unlock_notify' -ldflags '-s -w '

can't load package: package .: code in directory /var/ports/work/home/vagrant/gitea/work/gitea-1.11.0 expects import "code.gitea.io/gitea"

Any suggestion? Or do I supply my own code to copy the build results to the staging area?

Oh, and at least in FreeBSD, the gmake default for --jobs appears to be larger than one, leading to go and npm running concurrently, and the go build for bindata.go failing. Should a parallel build work?

That directory structure doesn’t look right. I’m not sure, but I think you need:

# I believe it **must** end with /src
export GOPATH=some/path/src

Then, Gitea’s source code should be at:

$GOPATH/code.gitea.io/gitea

And your make command needs to be launched from that directory:

cd $GOPATH/code.gitea.io/gitea
make

Since golang is convention before configuration, I think that paths are important.

I have a rough version of the updated port that builds, installs, and works OK, but I will need a bit more time to clean it up.

1 Like

WIth the current release archive, a FreeBSD package build won’t be possible. See https://github.com/go-gitea/gitea/issues/10253

This is now resolved with the release of 1.11.1