Bug 254293

Summary: net/cloudflared: could not determine kind of name for C.BrotliDecoderSetCustomDictionary
Product: Ports & Packages Reporter: orzodk
Component: Individual Port(s)Assignee: Vinícius Zavam <egypcio>
Status: Closed FIXED    
Severity: Affects Some People CC: boris
Priority: --- Flags: egypcio: maintainer-feedback+
Version: Latest   
Hardware: amd64   
OS: Any   

Description orzodk 2021-03-15 01:24:15 UTC
I am unable to build the net/cloudflared port.

This may be an upstream bug but nobody has reported it as an issue.

```
# uname -a
FreeBSD ox 12.2-RELEASE-p3 FreeBSD 12.2-RELEASE-p3 7851f4a452d(HEAD) TRUENAS  amd64

# go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="freebsd"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/freebsd_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build408488873=/tmp/go-build -gno-record-gcc-switches"

# make install
===>  Building for cloudflared-2020.11.11
(cd /usr/ports/net/cloudflared/work/cloudflared-2020.11.11;  for t in github.com/cloudflare/cloudflared/cmd/cloudflared; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/cloudflared/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^cloudflared$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env XDG_DATA_HOME=/usr/ports/net/cloudflared/work  XDG_CONFIG_HOME=/usr/ports/net/cloudflared/work  HOME=/usr/ports/net/cloudflared/work PATH=/usr/ports/net/cloudflared/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/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="/usr/ports/distfiles/go/net_cloudflared"  GOBIN="/usr/ports/net/cloudflared/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GO_NO_VENDOR_CHECKS=1 GOPROXY=off /usr/local/bin/go build -ldflags '-s -w -X main.Version=2020.11.11' -v -buildmode=exe -mod=vendor  -o /usr/ports/net/cloudflared/work/bin/${out}  ${pkg};  done)
===>  Building cloudflared from github.com/cloudflare/cloudflared/cmd/cloudflared
github.com/cloudflare/brotli-go
# github.com/cloudflare/brotli-go
vendor/github.com/cloudflare/brotli-go/reader.go:79:2: could not determine kind of name for C.BrotliDecoderSetCustomDictionary
*** Error code 2

Stop.
make: stopped in /usr/ports/net/cloudflared
```
Comment 1 commit-hook freebsd_committer 2021-03-26 20:47:26 UTC
A commit references this bug:

Author: egypcio
Date: Fri Mar 26 20:47:22 UTC 2021
New revision: 569269
URL: https://svnweb.freebsd.org/changeset/ports/569269

Log:
  net/cloudflared: update 2020.11.11 to 2021.3.2

    - github.com/cloudflare/cloudflared/blob/2021.3.2/RELEASE_NOTES

  PR:		254293
  Reported by:	orzodk % neomailbox.net

Changes:
  head/net/cloudflared/Makefile
  head/net/cloudflared/distinfo
Comment 2 Boris Polujin 2021-04-18 21:04:37 UTC
I got the same issue, with FreeBSD 13


13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 04:24:09 UTC 2021     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64



GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="freebsd"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/freebsd_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build540740794=/tmp/go-build -gno-record-gcc-switches"



===>  Building for cloudflared-2021.4.0
(cd /usr/ports/net/cloudflared/work/cloudflared-2021.4.0;  for t in github.com/cloudflare/cloudflared/cmd/cloudflared; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/cloudflared/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^cloudflared$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env XDG_DATA_HOME=/usr/ports/net/cloudflared/work  XDG_CONFIG_HOME=/usr/ports/net/cloudflared/work  HOME=/usr/ports/net/cloudflared/work PATH=/usr/ports/net/cloudflared/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/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="/usr/ports/distfiles/go/net_cloudflared"  GOBIN="/usr/ports/net/cloudflared/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GO_NO_VENDOR_CHECKS=1 GOPROXY=off /usr/local/bin/go build -ldflags '-s -w -X main.Version=2021.4.0' -v -buildmode=exe -mod=vendor  -o /usr/ports/net/cloudflared/work/bin/${out}  ${pkg};  done)
===>  Building cloudflared from github.com/cloudflare/cloudflared/cmd/cloudflared
github.com/cloudflare/brotli-go
# github.com/cloudflare/brotli-go
vendor/github.com/cloudflare/brotli-go/reader.go:79:2: could not determine kind of name for C.BrotliDecoderSetCustomDictionary
*** Error code 2
Comment 3 Boris Polujin 2021-04-19 05:33:12 UTC
So, comparing this:
https://github.com/cloudflare/brotli-go/blob/master/reader.go

and THIS:
https://github.com/google/brotli/blob/master/go/cbrotli/reader.go

it is clear that this C.BrotliDecoderSetCustomDictionary function does not exist anymore in the newer version.

So, I don't understand how others are getting this to build, maybe i'm missing something...

Does cloudflared even require this SetDictionary ( C.BrotliDecoderSetCustomDictionary ) function?
Comment 4 Boris Polujin 2021-04-22 19:35:37 UTC
Anyways, this seems to me like an issue upstream so I opened a bug report there:

https://github.com/cloudflare/cloudflared/issues/361
Comment 5 orzodk 2021-06-24 21:19:49 UTC
Finally got my hardware back to test again. I'm still getting the error and it doesn't seem related to just FreeBSD 13.0. This is a fresh 12.2 jail on TrueNAS 12.0-U4


$ uname -a
FreeBSD ox 12.2-RELEASE-p6 FreeBSD 12.2-RELEASE-p6 df578562304(HEAD) TRUENAS  amd64



$ sudo make install
Password:
===>  Building for cloudflared-2021.4.0
(cd /usr/ports/net/cloudflared/work/cloudflared-2021.4.0;  for t in github.com/cloudflare/cloudflared/cmd/cloudflared; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/cloudflared/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^cloudflared$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env XDG_DATA_HOME=/usr/ports/net/cloudflared/work  XDG_CONFIG_HOME=/usr/ports/net/cloudflared/work  HOME=/usr/ports/net/cloudflared/work PATH=/usr/ports/net/cloudflared/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/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="/usr/ports/distfiles/go/net_cloudflared"  GOBIN="/usr/ports/net/cloudflared/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GO_NO_VENDOR_CHECKS=1 GOPROXY=off /usr/local/bin/go build -ldflags '-s -w -X main.Version=2021.4.0' -v -buildmode=exe -trimpath -mod=vendor  -o /usr/ports/net/cloudflared/work/bin/${out}  ${pkg};  done)
===>  Building cloudflared from github.com/cloudflare/cloudflared/cmd/cloudflared
github.com/cloudflare/brotli-go
# github.com/cloudflare/brotli-go
vendor/github.com/cloudflare/brotli-go/reader.go:79:2: could not determine kind of name for C.BrotliDecoderSetCustomDictionary
*** Error code 2

Stop.
make: stopped in /usr/ports/net/cloudflared
Comment 6 orzodk 2021-06-24 21:27:01 UTC
And for the record, upgrading to the latest version doesn't solve the issue:

$ sudo make install
===>  Building for cloudflared-2021.6.0
(cd /usr/ports/net/cloudflared/work/cloudflared-2021.6.0;  for t in github.com/cloudflare/cloudflared/cmd/cloudflared; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/cloudflared/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^cloudflared$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env XDG_DATA_HOME=/usr/ports/net/cloudflared/work  XDG_CONFIG_HOME=/usr/ports/net/cloudflared/work  HOME=/usr/ports/net/cloudflared/work PATH=/usr/ports/net/cloudflared/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/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="/usr/ports/distfiles/go/net_cloudflared"  GOBIN="/usr/ports/net/cloudflared/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GO_NO_VENDOR_CHECKS=1 GOPROXY=off /usr/local/bin/go build -ldflags '-s -w -X main.Version=2021.6.0' -v -buildmode=exe -trimpath -mod=vendor  -o /usr/ports/net/cloudflared/work/bin/${out}  ${pkg};  done)
===>  Building cloudflared from github.com/cloudflare/cloudflared/cmd/cloudflared
github.com/cloudflare/brotli-go
# github.com/cloudflare/brotli-go
vendor/github.com/cloudflare/brotli-go/reader.go:79:2: could not determine kind of name for C.BrotliDecoderSetCustomDictionary
*** Error code 2

Stop.
make: stopped in /usr/ports/net/cloudflared
Comment 7 orzodk 2021-11-26 16:16:10 UTC
This is still an issue:

cloudflare-cloudflared-2021.10.3_GH0.tar.gz

===>  Building for cloudflared-2021.10.3
(cd /usr/ports/net/cloudflared/work/cloudflared-2021.10.3;  for t in github.com/cloudflare/cloudflared/cmd/cloudflared; do  out=$(/usr/bin/basename $(echo ${t} |  /usr/bin/sed -Ee 's/^[^:]*:([^:]+).*$/\1/' -e 's/^\.$/cloudflared/'));  pkg=$(echo ${t} |  /usr/bin/sed -Ee 's/^([^:]*).*$/\1/' -e 's/^cloudflared$/./');  echo "===>  Building ${out} from ${pkg}";  /usr/bin/env XDG_DATA_HOME=/usr/ports/net/cloudflared/work  XDG_CONFIG_HOME=/usr/ports/net/cloudflared/work  XDG_CACHE_HOME=/usr/ports/net/cloudflared/work/.cache  HOME=/usr/ports/net/cloudflared/work PATH=/usr/ports/net/cloudflared/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/user/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="/usr/ports/distfiles/go/net_cloudflared"  GOBIN="/usr/ports/net/cloudflared/work/bin"  GO111MODULE=on  GOFLAGS=-modcacherw  GOSUMDB=sum.golang.org GO_NO_VENDOR_CHECKS=1 GOPROXY=off /usr/local/bin/go build -ldflags '-s -w -X main.Version=2021.10.3' -v -buildmode=exe -trimpath -mod=vendor  -o /usr/ports/net/cloudflared/work/bin/${out}  ${pkg};  done)
===>  Building cloudflared from github.com/cloudflare/cloudflared/cmd/cloudflared
github.com/cloudflare/brotli-go
# github.com/cloudflare/brotli-go
vendor/github.com/cloudflare/brotli-go/reader.go:79:2: could not determine kind of name for C.BrotliDecoderSetCustomDictionary
*** Error code 2

Stop.
make: stopped in /usr/ports/net/cloudflared
Comment 8 Vinícius Zavam freebsd_committer 2021-12-11 09:34:14 UTC
(In reply to Boris Polujin from comment #4)

thanks for taking that with you and pushing it into upstream. appreciated!

btw, since day 1 from this port was added to the tree I reached out to cloudflare (in a video-call, the first time) asking if we are fine to create a package for this port and till now I have no official feedback - that's the main reason we only have the port available, but no package.

PS: I also contacted them by e-mail, and over IRC.
Comment 9 Vinícius Zavam freebsd_committer 2021-12-11 09:36:31 UTC
(In reply to orzodk from comment #7)

ACK.

hello there! thank you for reopening the ticket. I will take a look into it again; the plan here will be try getting a recent 12.3-RELEASE and newer releases to build it -- right after I update the source we fetch to build the port.

again, thank you for reopening it! appreciated :)
Comment 10 commit-hook freebsd_committer 2021-12-11 11:33:47 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0c53db742c31cbb1040562c1b833f137c5b41f25

commit 0c53db742c31cbb1040562c1b833f137c5b41f25
Author:     Vinícius Zavam <egypcio@FreeBSD.org>
AuthorDate: 2021-12-11 11:26:44 +0000
Commit:     Vinícius Zavam <egypcio@FreeBSD.org>
CommitDate: 2021-12-11 11:33:14 +0000

    net/cloudflared: update from 2021.10.3 to 2021.11.0

      * github.com/cloudflare/cloudflared/blob/2021.11.0/RELEASE_NOTES
      * github.com/cloudflare/cloudflared/compare/2021.10.3...2021.11.0

      * 2021.11.0
      Fallback to HTTP2 immediately if connection times out with no network activity
      Add flag to 'tunnel create' subcommand to specify a base64-encoded secret

      * 2021.10.5
      Update change log for release 2021.10.4
      Revert "TUN-5184"

      * 2021.10.4
      Fix misuse of wait group in TestQUICServer that caused the test to exit immediately
      Upgrade crypto/ssh package to fix CVE-2020-29652
      Allow to configure max fetch size for listing queries
      Improvements to `max-fetch-size` that allow to deal with large number of tunnels in account
      Collect QUIC metrics about RTT, packets and bytes transfered and log events at tracing level
      Make sure outstanding websocket write is finished, and no more writes after shutdown

    PR:             254293
    Reported by:    orzodk % neomailbox.net

 net/cloudflared/Makefile | 2 +-
 net/cloudflared/distinfo | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
Comment 11 Vinícius Zavam freebsd_committer 2021-12-11 11:40:34 UTC
so, we landed an updated version of this port into the tree. would you mind to test it again on your side?

tbh: the very same behavior could not be reproduced over here -- using clean jails and poudriere. is there any log output you mid you share?

the host system where it all got tested is a vanilla FreeBSD, not TrueNAS:

  FreeBSD 14.0-CURRENT #0 main-n250511-5f73b3338ee1 (GENERIC) 1400040 1400040

jails were created via `poudriere bulk` using the -I parameter for each test.

are you using git to checkout the tree? you should. here is how you can try to get a clear shot of it all, if you are already following the 'main' branch in our git repository:

  # cd /usr/ports
  # git remote update
  # git pull
  # make -s -C net/cloudflared clean
  # make -s -DFORCE_PKG_REGISTER -C net/cloudflared all stage-qa check-plist install deinstall reinstall clean && file `which cloudflared` && cloudflared --version
Comment 12 orzodk 2021-12-13 05:44:16 UTC
(In reply to Vinícius Zavam from comment #11)

thanks for looking into this. i had been using portsnap but I just tried with the main branch for the latest version. I'm still getting the same error.

As for logs, there isn't a whole lot that I've got. Basically runs through a screen of compiling modules (after accepting the license) and ends with:

```
*** Error code 2

Stop.
make: stopped in /usr/ports/net/cloudflared
```

The only interesting thing that shows up is the following:

```
<snip>
go/parser
github.com/lucas-clemente/quic-go/quicvarint
# github.com/cloudflare/brotli-go
vendor/github.com/cloudflare/brotli-go/reader.go:79:2: could not determine kind of name for C.BrotliDecoderSetCustomDictionary
database/sql
google.golang.org/protobuf/runtime/protoimpl
github.com/modern-go/concurrent
github.com/modern-go/reflect2
<snip>
```

To get the output I've been sharing in the ticket I simply re-run the command make command:

```
==>  Building for cloudflared-2021.11.0
===>  Building cloudflared from github.com/cloudflare/cloudflared/cmd/cloudflared
github.com/cloudflare/brotli-go
# github.com/cloudflare/brotli-go
vendor/github.com/cloudflare/brotli-go/reader.go:79:2: could not determine kind of name for C.BrotliDecoderSetCustomDictionary
*** Error code 2

Stop.
make: stopped in /usr/ports/net/cloudflared
```

So what I've run today is the following:

```
sudo su -
git clone https://git.FreeBSD.org/ports.git /usr/ports  # pulled from the handbook
cd /usr/ports
# omitted the git remote update / git pull since it is a fresh checkout
make -s -C net/cloudflared clean
make -s -DFORCE_PKG_REGISTER -C net/cloudflared all stage-qa check-plist install deinstall reinstall clean && file `which cloudflared` && cloudflared --version

# (then make once more to get the error without all the extra output)

make -s -DFORCE_PKG_REGISTER -C net/cloudflared all stage-qa check-plist install deinstall reinstall clean
```
Comment 13 Vinícius Zavam freebsd_committer 2021-12-17 13:46:43 UTC
(In reply to orzodk from comment #12)

well, as this seems to be pretty much related to any particular setting or nuance in your current setup... that would bring you to different steps, like trying to report to the 'brotli-go' upstream project.

so, why am I suggesting or assuming it this way? as mentioned before, by running vanilla FreeBSD (host and jail) I could not reproduce that. it can indeed be related to how your jails are running below the TrueNAS.

an easier way to try solving it would be trying to update host's OS and also jail's. it would bot be a guarantee to fix it all but a nice call.

I'll let the issue here opened, as I am curious to follow tru your updates but soon we might close the PR as is. again: tyvm for reporting and testing it! appreciated

here is the output of my jail (FreeBSD 12.3-RELEASE amd64 GENERIC-NODEBUG 1203000 1203000):

root@poudriere:/usr/ports # make -s -DFORCE_PKG_REGISTER -C net/cloudflared all stage-qa check-plist install deinstall reinstall clean && file `which cloudflared` && cloudflared --version
===>  License cloudflare needs confirmation, will ask later
===>   cloudflared-2021.11.0 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by cloudflared-2021.11.0 for building
===>  Extracting for cloudflared-2021.11.0
=> SHA256 Checksum OK for cloudflare-cloudflared-2021.11.0_GH0.tar.gz.
===>  Patching for cloudflared-2021.11.0
===>   cloudflared-2021.11.0 depends on file: /usr/local/bin/go - not found
===>   Installing existing package /packages/All/go-1.17.5,1.pkg
[poudriere.tak.localhost.localdomain] Installing go-1.17.5,1...
[poudriere.tak.localhost.localdomain] Extracting go-1.17.5,1: 100%
===>   cloudflared-2021.11.0 depends on file: /usr/local/bin/go - found
===>   Returning to build of cloudflared-2021.11.0
===>  Configuring for cloudflared-2021.11.0
===>  Building for cloudflared-2021.11.0
===>  Building cloudflared from github.com/cloudflare/cloudflared/cmd/cloudflared

   ...

===>  Staging for cloudflared-2021.11.0
===>   cloudflared-2021.11.0 depends on package: ca_root_nss>=0 - found
===>   Generating temporary packing list
===>  Installing cloudflared as /wrkdirs/usr/ports/net/cloudflared/work/stage/usr/local/bin/cloudflared
====> Compressing man pages (compress-man)
===> Staging rc.d startup script(s)
====> Running Q/A tests (stage-qa)
Warning: License is not auto-accepted, packages will not be built, ports depending on this one will be ignored.
Warning: License does not allow package to be distributed, ports depending on this one will be ignored
/!\ To run stage-qa automatically add DEVELOPER=yes to your environment /!\
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
===> Checking for items in pkg-plist which are not in STAGEDIR
===> No pkg-plist issues found (check-plist)
===>  Installing for cloudflared-2021.11.0
===>   Registering installation for cloudflared-2021.11.0
[poudriere.tak.localhost.localdomain] Installing cloudflared-2021.11.0...
===>  Deinstalling for cloudflared
===>   Deinstalling cloudflared-2021.11.0
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
        cloudflared: 2021.11.0

Number of packages to be removed: 1

The operation will free 23 MiB.
[poudriere.tak.localhost.localdomain] [1/1] Deinstalling cloudflared-2021.11.0...
[poudriere.tak.localhost.localdomain] [1/1] Deleting files for cloudflared-2021.11.0: 100%
===>  Deinstalling for cloudflared
===>   cloudflared not installed, skipping
===>  Installing for cloudflared-2021.11.0
===>   Registering installation for cloudflared-2021.11.0
[poudriere.tak.localhost.localdomain] Installing cloudflared-2021.11.0...
===>  Cleaning for cloudflared-2021.11.0
/usr/local/bin/cloudflared: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.3, FreeBSD-style, Go BuildID=8yVM1ZxbNpA0NLAIbcrE/_hKyTt9YutEvaHNrjzxh/kx-TH8WqRgkzyaKHHtPh/2C4QXjtvhQqsyt-TLviH, stripped
cloudflared version 2021.11.0 (built unknown)

root@poudriere:/usr/ports # pkg info
ca_root_nss-3.71               Root certificate bundle from the Mozilla Project
cloudflared-2021.11.0          Cloudflare's Argo Tunnel client
go-1.17.5,1                    Go programming language
pkg-1.17.5                     Package manager
Comment 14 orzodk 2021-12-20 18:28:59 UTC
(In reply to Vinícius Zavam from comment #13)
Interesting that it works for you.

I will play around with it some more and see if I can get it to build or try to get some more information.
Comment 15 Vinícius Zavam freebsd_committer 2021-12-27 19:23:05 UTC
appreciated the ping back!

so, should anything new pops up just open a new bug ticket and we can take a look here. I would just ask you to sync all these information on the GitHub issue related to this PR -- based on the fact you ran into a corner case yourself, w/o any interference from the ports framework or any vanilla FreeBSD setup itself.

have a great one, and stay safe ]=)