Solved Problem with installing gohugo

Hello,

I have encountered a problem during installation of www/gohugo port. The error message is following:

Code:
github.com/gohugoio/hugo/commands imports
                                                  github.com/spf13/cobra/doc imports
                                                 github.com/cpuguy83/go-md2man/v2/md2man imports
                                    github.com/russross/blackfriday/v2: module github.com/russross/blackfriday/v2@latest found (v2.1.0), but does not contain package github.com/russross/blackfriday/v2                                                                             
===> Vendoring github.com/gohugoio/hugo dependencies                               github.com/gohugoio/hugo/commands imports                                                  github.com/spf13/cobra/doc imports                                                 github.com/cpuguy83/go-md2man/v2/md2man imports                                    github.com/russross/blackfriday/v2: no required module provides package github.com/russross/blackfriday/v2; to add it:                                                go get github.com/russross/blackfriday/v2                                  
===>  Patching for gohugo-0.101.0_1                                                
===>  Applying FreeBSD patches for gohugo-0.101.0_1 from /usr/ports/www/gohugo/files                                                                                  
===>   gohugo-0.101.0_1 depends on file: /usr/local/bin/go118 - found              
===>   gohugo-0.101.0_1 depends on shared library: libsass.so - found (/usr/local/lib/libsass.so)                                                                     
===>   gohugo-0.101.0_1 depends on shared library: libwebp.so - found (/usr/local/lib/libwebp.so)
===>  Configuring for gohugo-0.101.0_1                                             
===>  Building for gohugo-0.101.0_1
(cd /var/ports/tmp/usr/ports/www/gohugo/work/github.com/gohugoio/hugo@v0.101.0;  for t in hugo; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/hugo/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^hugo$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env XDG_DATA_HOME=/var/ports/tmp/usr/ports/www/gohugo/work  XDG_CONFIG_HOME=/var/ports/tmp/usr/ports/www/gohugo/work  XDG_CACHE_HOME=/var/ports/tmp/usr/ports/www/gohugo/work/.cache  HOME=/var/ports/tmp/usr/ports/www/gohugo/work TMPDIR="/tmp" PATH=/var/ports/tmp/usr/ports/www/gohugo/work/.bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin PKG_CONFIG_LIBDIR=/var/ports/tmp/usr/ports/www/gohugo/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/libdata/pkgconfig 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="-DLIBWEBP_NO_SRC -DUSE_LIBSASS_SRC -I/usr/local/include"  CGO_LDFLAGS="-lm -lwebp -lsass -L/usr/local/lib"  GOARM= GOPATH="/usr/ports/distfiles//go/www_gohugo"  GOBIN="/var/ports/tmp/usr/ports/www/gohugo/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GOPROXY=off /usr/local/bin/go118 build -ldflags=" -s -w  -X github.com/gohugoio/hugo/common/hugo.vendorInfo=freebsd"  -tags extended -v -buildmode=exe -trimpath -buildvcs=false -mod=vendor  -o /var/ports/tmp/usr/ports/www/gohugo/work/bin/${out}  ${pkg};  done)                                                                   
===>  Building hugo from .
vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go:4:2: cannot find package "." in:
        /var/ports/tmp/usr/ports/www/gohugo/work/github.com/gohugoio/hugo@v0.101.0/vendor/github.com/russross/blackfriday/v2
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/gohugo
*** Error code 1

Stop.
make: stopped in /usr/ports/www/gohugo

===>>> make build failed for www/gohugo
===>>> Aborting update

===>>> Update for www/gohugo failed
===>>> Aborting update

===>>> Update for textproc/docproj failed
===>>> Aborting update

I tried to find solution from Google, but I didn't find anything besides that go version might be old. My go version:

Code:
# go version
go version go1.18.3 freebsd/amd64

Thanks for any possible suggestions.
 
What's in /etc/make.conf?
Hello SirDice.

My make.conf has just this one line:
Code:
$ cat /etc/make.conf
WRKDIRPREFIX=/var/ports/tmp
$ ls /var/ports/tmp/
usr

It points to tmpfs(5) filesystem. Should there actually be more? In my Gentoo system there is lots more.
 

SirDice

Administrator
Staff member
Administrator
Moderator
Should there actually be more?
No. Many weird build issues are caused by people putting CFLAGS or other compiler flags they found on the internet in make.conf. It's a really common mistake, that's why I asked. WRKDIRPREFIX should be fine though.
 
www/gohugo (0.101.0_1) has been built on the official build servers fine (with the ports default configuration options). What's affecting the build error on your system is limited to your system.

Have you changed the default configuration options?
Code:
===> The following configuration options are available for gohugo-0.101.0_1:
     EXTENDED=on: Enable SCSS/SASS support
     MANPAGES=on: Build and/or install manual page

EDIT: It looks like both of the configuration options are enabled:
Code:
===>   gohugo-0.101.0_1 depends on shared library: libsass.so - found (/usr/local/lib/libsass.so)        
...
vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go:4:2: cannot find package "." in:

How big is that tmpfs(5) where the WRKDIRPREFIX is pointing to? Maybe increasing the size might help.

Alternatively, if the configuration options are the same as the ports default options, you could install from pre-build package. Just make sure to enable the "latest" package repository.
 
www/gohugo (0.101.0_1) has been built on the official build servers fine (with the ports default configuration options). What's affecting the build error on your system is limited to your system.

Have you changed the default configuration options?
Code:
===> The following configuration options are available for gohugo-0.101.0_1:
     EXTENDED=on: Enable SCSS/SASS support
     MANPAGES=on: Build and/or install manual page

EDIT: It looks like both of the configuration options are enabled:
Code:
===>   gohugo-0.101.0_1 depends on shared library: libsass.so - found (/usr/local/lib/libsass.so)       
...
vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go:4:2: cannot find package "." in:

How big is that tmpfs(5) where the WRKDIRPREFIX is pointing to? Maybe increasing the size might help.

Alternatively, if the configuration options are the same as the ports default options, you could install from pre-build package. Just make sure to enable the "latest" package repository.
Hello T-Daemon,

I do have ~32 GB ram + ~67 GB swap, so space shouldn't be problem:

Bash:
# neofetch
```                        `       
  ` `.....---.......--.```   -/    ---------------------------
  +o   .--`         /y:`      +.   OS: FreeBSD 13.1-RELEASE amd64
   yo`:.            :o      `+-    Uptime: 7 hours, 31 mins
    y/               -/`   -o/     Packages: 445 (pkg)
   .-                  ::/sy+:.    Shell: csh tcsh 6.22.04
   /                     `--  /    Terminal: /dev/pts/0
  `:                          :`   CPU: AMD A10-9700 RADEON R7 4C+6G (4) @ 3.493GHz
  `:                          :`   GPU: Wani [Radeon R5/R6/R7 Graphics]
   /                          /    Memory: 5637MiB / 31638MiB
   .-                        -.
    --                      -.                             
     `:`                  `:`                             
       .--             `--.
          .---.....----.

# swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ada1p3.eli  67108864        0 67108864     0%
# df -h | grep tmpfs
tmpfs                  88G     84M     88G     0%    /var/ports/tmp

Although in the end, I did notice that I don't actually need the www/gohugo, so in sense this problem is solved now (I uninstalled all unused ports). Although, it's shame, that the root cause for the problem remains mystery for me.
 
Not really directly helpful but I can confirm that www/gohugo is working just fine for me (built using poudriere). In my case I left the options to the default. I've been using this port for quite a while.
 
Not really directly helpful but I can confirm that www/gohugo is working just fine for me (built using poudriere). In my case I left the options to the default. I've been using this port for quite a while.
Thanks. I think that it's helpful to know, that this problem is probably limited to my system. I do believe, that there might be something broken on my system. I did the procedure to reinstall all ports, described on portmaster() manual:

Using portmaster to do a complete reinstallation of all ports:
1. portmaster --list-origins > ~/installed-port-list
2. Update the ports tree
3. portmaster -ty --clean-distfiles
4. portmaster -Faf
5. pkg delete -afy
6. rm -rf /usr/local/lib/compat/pkg
7. Back up any files in /usr/local you wish to save,
such as configuration files in /usr/local/etc
8. Manually check /usr/local and /var/db/pkg
to make sure that they are really empty
9. Install ports-mgmt/pkg and then ports-mgmt/portmaster.
Remove both from ~/installed-port-list.
10. portmaster --no-confirm `cat ~/installed-port-list`
because I did have some other problems (if I remember correctly related to python 3.8 to 3.9 update), when doing portmaster -aD.

I'm not very experienced FreeBSD user and I probably have bad practices in my system administration (like using ports-mgmt/portmaster). Luckily this is just a hobby system, where I host some services for myself, my friends and family, so there is no real harm if I break something.
 
Whenever you're in doubt whether it's a problem on your system, I can recommend using ports-mgmt/poudriere to run poudriere testport. It will create a clean jail and build the port in there. This is a relatively easy way of getting at least a rough idea whether the problem is on your system or in the port.
 
Whenever you're in doubt whether it's a problem on your system, I can recommend using ports-mgmt/poudriere to run poudriere testport. It will create a clean jail and build the port in there. This is a relatively easy way of getting at least a rough idea whether the problem is on your system or in the port.
Thanks for a good suggestion. I didn't know, that you can do that. I'll test that.
 
ports-mgmt/poudriere is a port building tool. It has a lot of nice features including testing ports in a clean environment.

A lot of people like to build their own packages rather than using the official binary distributions as this gives you more control.
For me, the reason to switch to "custom built" packages was simply the fact that I wasn't happy with the default options of some of the ports (and the official packages are built with default options).

If you feel like going down that rabbit hole (which I can highly recommend), I wrote a guide on this: https://blog.insane.engineer/post/freebsd_poudriere_guide/
 
ports-mgmt/poudriere is a port building tool. It has a lot of nice features including testing ports in a clean environment.

A lot of people like to build their own packages rather than using the official binary distributions as this gives you more control.
For me, the reason to switch to "custom built" packages was simply the fact that I wasn't happy with the default options of some of the ports (and the official packages are built with default options).

If you feel like going down that rabbit hole (which I can highly recommend), I wrote a guide on this: https://blog.insane.engineer/post/freebsd_poudriere_guide/
So, I decided to go down the rabbit hole and deleted all the packages and ports I.e. the whole environment created with ports-mgmt/portmaster. Then I installed the ports-mgmt/poudriere, created a Poudriere jail and a Poudriere repository with the bulk command (I had saved the needed ports to a file). Lastly, I reinstalled all the packages with the pkg command after adding the Poudriere repository to the config and disabling the standard FreeBSD repository. There were some minor set backs during the process (had to learn to use a new tool), but I do like that Poudriere separates building and installing ports (and that everything is build in a clean environment).

I also finally tested building the www/gohugo package with Poudriere and guess what, it went successfully. So the solution in my case was to move from Portmaster to Poudriere. I don't know what exactly was wrong in my base environment, but building in a clean environment was the solution. Thanks for your help.
 
  • Like
Reactions: jbo
I don't know what exactly was wrong in my base environment, but building in a clean environment was the solution.
I recently ran into this problem in a different go port. a `make distclean` was able to resolve it for me; it looked like I had some sort of corrupted go-mod cached? I'd make extract, and inspect the workdir, but go.mod would be empty, and not match the tagged go.mod on github. make distclean purged the local caches, one redownload later, and things were happy again.
 
Top