Unable to build Zcashd on FreeBSD 13.1

I’m aware that FreeBSD is not a Tier 1, but a Tier 3 platform for Zcash, so I’m here to ask for help building zcashd on FreeBSD 13.1 as this other forum post shows that FreeBSD 12 support was added but I am unable to get this building on FreeBSD 13.1.

I get the following after I git clone zcash. I think I might be missing a pre-requisite of building zcash but doing a web search, a search of this forum, and looking thru the code on Github does not present any help. Maybe @orion has a list somewhere?

free13@free13:~/zcash $ ./zcutil/build.sh 
+ eval make --version
+ make --version

+ as --version
GNU assembler (GNU Binutils) 2.39
Copyright (C) 2022 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-portbld-freebsd13.1'.
+ DEBUG=''
+ HOST=x86_64-unknown-freebsd13.1 BUILD=x86_64-unknown-freebsd13.1 make -C ./depends/ 'DEBUG='
make: "/usr/home/free13/zcash/depends/Makefile" line 48: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 51: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 53: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 55: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 57: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 72: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 74: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 84: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 86: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 100: Could not find hosts/.mk
make: "/usr/home/free13/zcash/depends/hosts/default.mk" line 21: Invalid line type
make: "/usr/home/free13/zcash/depends/hosts/default.mk" line 22: Invalid line type
make: "/usr/home/free13/zcash/depends/hosts/default.mk" line 29: Invalid line type
make: "/usr/home/free13/zcash/depends/hosts/default.mk" line 33: Invalid line type
make: "/usr/home/free13/zcash/depends/hosts/default.mk" line 35: Invalid line type
make: "/usr/home/free13/zcash/depends/hosts/default.mk" line 37: Invalid line type
make: "/usr/home/free13/zcash/depends/hosts/default.mk" line 42: Invalid line type
make: "/usr/home/free13/zcash/depends/hosts/default.mk" line 44: Invalid line type
make: "/usr/home/free13/zcash/depends/hosts/default.mk" line 45: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 102: Could not find builders/.mk
make: "/usr/home/free13/zcash/depends/builders/default.mk" line 10: Invalid line type
make: "/usr/home/free13/zcash/depends/builders/default.mk" line 14: Invalid line type
make: "/usr/home/free13/zcash/depends/builders/default.mk" line 15: Invalid line type
make: "/usr/home/free13/zcash/depends/builders/default.mk" line 16: Invalid line type
make: "/usr/home/free13/zcash/depends/builders/default.mk" line 19: Invalid line type
make: "/usr/home/free13/zcash/depends/builders/default.mk" line 20: Invalid line type
make: "/usr/home/free13/zcash/depends/packages/packages.mk" line 5: Invalid line type
make: "/usr/home/free13/zcash/depends/packages/packages.mk" line 7: Invalid line type
make: "/usr/home/free13/zcash/depends/packages/packages.mk" line 13: Invalid line type
make: "/usr/home/free13/zcash/depends/packages/packages.mk" line 15: Invalid line type
make: "/usr/home/free13/zcash/depends/packages/packages.mk" line 18: Invalid line type
make: "/usr/home/free13/zcash/depends/packages/packages.mk" line 20: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 1: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 16: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 18: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 19: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 20: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 22: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 23: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 24: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 26: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 27: Error in archive specification: ""
make: "/usr/home/free13/zcash/depends/funcs.mk" line 33: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 35: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 36: Error in archive specification: ""
make: "/usr/home/free13/zcash/depends/funcs.mk" line 46: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 48: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 49: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 50: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 51: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 53: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 54: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 55: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 56: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 57: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 58: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 62: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 63: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 64: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 65: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 106: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 110: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 111: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 154: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 156: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 157: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 159: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 160: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 162: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 163: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 165: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 166: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 168: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 169: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 171: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 172: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 174: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 182: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 184: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 185: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 189: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 190: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 191: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 193: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 247: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 256: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 257: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 260:
 Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 263: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 266: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 269: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 272: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 275: Invalid line type
make: "/usr/home/free13/zcash/depends/funcs.mk" line 278: Unknown modifier " |$($($(host_arch"
make: "/usr/home/free13/zcash/depends/funcs.mk" line 278: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 159: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 160: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 164: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 166: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 167: Invalid line type
make: "/usr/home/free13/zcash/depends/Makefile" line 167: warning: duplicate script for target "mkdir" ignored
make: "Makefile" line 160: warning: using previous script for "mkdir" defined here
make: "/usr/home/free13/zcash/depends/Makefile" line 167: warning: duplicate script for target "-p" ignored
make: "Makefile" line 160: warning: using previous script for "-p" defined here
make: "/usr/home/free13/zcash/depends/Makefile" line 171: Invalid line type
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/free13/zcash/depends

Anyone know what the next step is or what I need to install to try this again?

1 Like

@nuttycom I’m not familiar w/ this OS,

In Zcash Issue #4030, I find this which helped it get further but it still fails to build

Usage on FreeBSD:

> $ pkg install autoconf automake bash cmake gcc gmake libtool pkgconf
> $ MAKE=gmake ./zcutil/build.sh

This is my output now:

free13@free13:~/zcash $ MAKE=gmake ./zcutil/build.sh
+ eval gmake --version
+ gmake --version
GNU Make 4.3
Built for amd64-portbld-freebsd13.1
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
+ as --version
GNU assembler (GNU Binutils) 2.39
Copyright (C) 2022 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-portbld-freebsd13.1'.
+ DEBUG=''
+ HOST=x86_64-unknown-freebsd13.1 BUILD=x86_64-unknown-freebsd13.1 gmake -C ./depends/ 'DEBUG='
gmake: Entering directory '/usr/home/free13/zcash/depends'
Fetching native_clang...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
100  561M  100  561M    0     0  24.7M      0  0:00:22  0:00:22 --:--:-- 50.4M
/usr/home/free13/zcash/depends/work/download/native_clang-15.0.6/clang-llvm-14.0.6-amd64-unknown-freebsd12.tar.xz.temp: OK
Extracting native_clang...
/usr/home/free13/zcash/depends/sources/clang-llvm-14.0.6-amd64-unknown-freebsd12.tar.xz: OK
Preprocessing native_clang...
Configuring native_clang...
Building native_clang...
Staging native_clang...
cp: bin/clang-15: No such file or directory
gmake: *** [funcs.mk:277: /usr/home/free13/zcash/depends/work/staging/x86_64-unknown-freebsd13.1/native_clang/15.0.6-2913eee07f3/.stamp_staged] Error 1
gmake: Leaving directory '/usr/home/free13/zcash/depends'

Anyone have any ideas? Is this an Issue I should file a bug on Github?

1 Like

You might be the first person to try building on freebsd since we switched from gcc to clang for the build, so I’m not surprised that you’re running into issues here. I don’t have any particular suggestions, unfortunately; some googling led me to Solved - how can i install clangd on freebsd? | The FreeBSD Forums which might help find the right direction.

Maybe pkg install llvm15 might help?

1 Like

Oh, this is a bug in our build system. When I made the PR to migrate us to LLVM 15, there was no LLVM 15 release for FreeBSD, so I left it on LLVM 14:

However, the build script isn’t aware of this, and so anywhere else that references $(package)_major_version will fail. And there is a single place we depend on it:

I’ve opened an issue for this: `native_clang`: Make `$(package)_major_version` overridable per host · Issue #6534 · zcash/zcash · GitHub

1 Like

@zaddr could you test this PR and see if it fixes your problem?

1 Like

I’ve tested this PR and it works, thank you @str4d!

However, there is one more thing to have in mind on FreeBSD: cargo vendor fails for non-root user when package source/patch is github checkout (i.e. equihash). I’ve discovered that it’s related to known issue described here. On FreeBSD /home is actually a symlink to /usr/home.

Workaround would be to either build as root (or to sudo), or to use CARGO_HOME=$(readlink -f ~/.cargo) MAKE=gmake zcutil/build.sh as normal user.

2 Likes

@zaddr

In case you need instructions how to apply PR which hasn’t been merged yet:
cd to folder where your local zcash repo is cloned (probably zcash) and then

curl https://patch-diff.githubusercontent.com/raw/zcash/zcash/pull/6535.diff --output 6535.diff
git apply 6535.diff
CARGO_HOME=$(readlink -f ~/.cargo) MAKE=gmake zcutil/build.sh -j$(sysctl -n hw.ncpu)
1 Like

i’m grateful to everyone who replied to post’s author! thank you, guys!

2 Likes

Mmk. Given this is specific to FreeBSD and user-customized setups, and has an external fix, I’m not going to try including any mitigations for this in our build system, because us depending on a github checkout is a temporary thing (once we have finished cutting releases of the relevant crates, we will switch back to depending on published crate releases).

3 Likes