Trying to compile postfix from /usr/ports fails, and so does socat :/

Folks,
I am trying to configure a brand-new box (tbh, it is a cloud machine) with FreeBSD to run a mail server on it, but I can’t even configure Postfix:

Code:
===>  Configuring for postfix-3.8.1,1
(cd /usr/ports/mail/postfix/work-default/postfix-3.8.1 && make -f Makefile.init makefiles  DEBUG= pie=yes CC="cc" OPT="-O2 -pipe -march=native -fno-common  -fstack-protector-strong -fno-strict-aliasing " CCARGS="-DDEF_CONFIG_DIR=\\\"/usr/local/etc/postfix\\\"  -DDEF_DAEMON_DIR=\\\"/usr/local/libexec/postfix\\\"  -DDEF_META_DIR=\\\"/usr/local/libexec/postfix\\\"  -DDEF_COMMAND_DIR=\\\"/usr/local/sbin\\\"  -DDEF_SENDMAIL_PATH=\\\"/usr/local/sbin/sendmail\\\"  -DDEF_NEWALIAS_PATH=\\\"/usr/local/bin/newaliases\\\"  -DDEF_MAILQ_PATH=\\\"/usr/local/bin/mailq\\\"  -DDEF_MANPAGE_DIR=\\\"/usr/local/man\\\"  -DDEF_README_DIR=\\\"/usr/local/share/doc/postfix\\\"  -DDEF_HTML_DIR=\\\"/usr/local/share/doc/postfix\\\"  -DDEF_QUEUE_DIR=\\\"/var/spool/postfix\\\"  -DDEF_DATA_DIR=\\\"/var/db/postfix\\\"  -DDEF_MAIL_OWNER=\\\"postfix\\\"  -DDEF_SGID_GROUP=\\\"maildrop\\\"  -Wmissing-prototypes -Wformat -Wno-comment -DUSE_SASL_AUTH -DHAS_EAI -I/usr/local/include -DHAS_PCRE=2 -I/usr/local/include -DUSE_CYRUS_SASL -I/usr/local/include  -I/usr/local/include/sasl -DUSE_TLS -I/usr/include -DHAS_PGSQL -I/usr/local/include"  shared=yes shlib_directory=/usr/local/lib/postfix  dynamicmaps=yes  "AUXLIBS_PCRE=`/usr/local/bin/pcre2-config --libs8`" "AUXLIBS_PGSQL=-L/usr/local/lib -lpq"  AUXLIBS="-L/usr/local/lib -licuuc -L/usr/local/lib -lsasl2 -lpam -lcrypt -L/usr/lib   -L/usr/local/lib -fstack-protector-strong  -lssl -lcrypto -lblacklist" &&  echo "all: default" >> Makefile)
make -f Makefile.in MAKELEVEL= Makefiles
make[4]: cannot open Makefile.in.
make[4]: stopped in /usr/obj/usr/amd64.amd64/ports/mail/postfix/work-default/postfix-3.8.1
It should use gmake, not make.

And for socat, there’s another error:
[…]
Code:
--- socat ---
cc -O2 -pipe -march=native -fno-common  -fstack-protector-strong -fno-strict-aliasing  -D_GNU_SOURCE -Wall -Wno-parentheses  -DHAVE_CONFIG_H -I. -fstack-protector-strong -o socat socat.o libxio.a -lwrap -lutil  -lssl -lcrypto
===>  Staging for socat-1.7.4.4
===>   Generating temporary packing list
install  -s -m 555 /usr/ports/net/socat/work/socat-1.7.4.4/filan /usr/ports/net/socat/work/stage/usr/local/bin
install: /usr/ports/net/socat/work/socat-1.7.4.4/filan: No such file or directory
*** Error code 71
Given those are super-common, I wonder if something is wrong with my system.
Any help would be greaaaaatttttly appreciated :)

Cheers,
Vincent
 
I wonder if something is wrong with my system
Most likely, socat builds here:
Code:
===>  Staging for socat-1.7.4.4
===>   Generating temporary packing list
install  -s -m 555 /usr/ports/net/socat/work/socat-1.7.4.4/filan /usr/ports/net/socat/work/stage/usr/local/bin
install  -s -m 555 /usr/ports/net/socat/work/socat-1.7.4.4/procan /usr/ports/net/socat/work/stage/usr/local/bin
install  -s -m 555 /usr/ports/net/socat/work/socat-1.7.4.4/socat /usr/ports/net/socat/work/stage/usr/local/bin
install  -m 444 /usr/ports/net/socat/work/socat-1.7.4.4/doc/socat.1 /usr/ports/net/socat/work/stage/usr/local/man/man1
cd /usr/ports/net/socat/work/socat-1.7.4.4 && install  -m 0644 EXAMPLES FAQ README SECURITY /usr/ports/net/socat/work/stage/usr/local/share/doc/socat
install  -m 0644 /usr/ports/net/socat/files/socat-instances.conf.sample /usr/ports/net/socat/work/stage/usr/local/etc
====> Compressing man pages (compress-man)
===> Staging rc.d startup script(s)

Anything in /etc/make.conf?
 
Error is probably higher, that's the install of a binary that's failing because it doesn't exist, probably because it failed to build?
 
In both cases, the error is the same: instead of executing gmake, (bsd) make gets executed and the Makefile is misinterpreted.
I’m wondering why the building script won’t switch to gmake for building/installing
 
Error is probably higher, that's the install of a binary that's failing because it doesn't exist, probably because it failed to build?
It would not get to the "staging" part in that case. It really looks like files are disappearing from the work/ directory, Makefile.in should be there for postfix, filan should be there for socat.
It should use gmake, not make.
No.

And I just noticed this:
Code:
/usr/ports/mail/postfix/work-default/postfix-3.8.1
make[4]: stopped in /usr/obj/usr/amd64.amd64/ports/mail/postfix/work-default/postfix-3.8.1

It looks like you have some weird WRKDIRPREFIX override combined with something else somewhere?
 
And I just noticed this:
Code:
/usr/ports/mail/postfix/work-default/postfix-3.8.1
make[4]: stopped in /usr/obj/usr/amd64.amd64/ports/mail/postfix/work-default/postfix-3.8.1

It looks like you have some weird WRKDIRPREFIX override combined with something else somewhere?
Not that I am aware of :(
If I manually change into the WORKDIR and type sudo gmake, socat builds fine, for example. So yeah, either there’s something wrong with the actual ‘make’ that gets used during building, or the WRKDIRPREFIX is clobbered somewhere, but I have no idea where that could happen. Going to dive deeper. Thanks for your keen eyesight!
 
There is nothing in /etc/mk.conf except default version for some languages such as Python and an additional -march=native CFLAG… :/
It’s really knotty.
 
Will do that, but I can’t access the system right now because I’m behind a firewall I do not control. To my knowledge, there’s nothing in there that can affect the build system in whatever way. I agree it’s quite intricate. I will post screenshots and dumps later tonight.
 
You should post the settings because your problem is unique, but you think it shouldn't be (which on the surface, people would agree), so that means it's possible mundane settings have some kind of unique and bad interaction. Or a critical typo due to whitespace.

Or the system is just hosed for some other reason. Best to remove all doubt, though. It's not like disclosing mk.conf is a security or identification risk.
 
Why is everyone talking about some "mk.conf"? The file is called /etc/make.conf. Without attention to detail, it's always hard to really track down a problem....
 
You’re both right.
Here is what's relevant in the file /etc/make.conf. The rest is commented out.
Code:
# Additional compiler flags can be specified that extend or override
# default ones. However, neither the base system nor ports are guaranteed
# to build and function without problems with non-default settings. 
CFLAGS+=        -march=native
CXXFLAGS+=      -march=native
# CFLAGS.armv6+= -mfloat-abi=softfp
[…]
Code:
#.if ${.CURDIR:M*/irc/irssi-devel*}
#WITH_DEBUG=YES
#.endif
#
# Another approach is to use /usr/ports/ports-mgmt/portconf which has
# its own config file for port specific options.
DEFAULT_VERSIONS=python=3.9 python2=2.7 python3=3.9 perl5=5.32 php=7.4
Environment:
Code:
USER=vincent
LOGNAME=vincent
HOME=/home/vincent
MAIL=/mail/vincent
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/vincent/bin
TERM=xterm-256color
BLOCKSIZE=K
MM_CHARSET=UTF-8
LANG=en_GB.UTF-8
SHELL=/bin/tcsh
SSH_TTY=/dev/pts/0
HOSTTYPE=FreeBSD
VENDOR=amd
OSTYPE=FreeBSD
MACHTYPE=x86_64
SHLVL=1
PWD=/home/vincent
GROUP=vincent
EDITOR=vim
PAGER=less
LC_ALL=en_GB.UTF-8
Really nothing to write home about (ok I just noticed BLOCKSIZE is wrong, but who cares?). I redacted the HOST and SSH info for obvious reasons, but those do not interfere anyway.
 
Looks like for some reason the current dir is not in the path that make searches files in.
Code:
Searching for Makefile.in ...
   failed.
Searching for Makefile.in ...
   /usr/share/mk ...
   failed.
bmake[4]: cannot open Makefile.in.
 
mail/postfix and net/socat with the default configuration options (and those CFLAGS/CXXFLAGS in /etc/make.conf) build just fine.

Have you modified the ports configuration options?

If you are using the default configuration options you could use packages instead.

Alternatively build the ports in a clean environment with tools like ports-mgmt/synth (can be used with the default configuration right away) or ports-mgmt/poudriere (needs some configuration).

Code:
DEFAULT_VERSIONS=python=3.9 python2=2.7 python3=3.9 perl5=5.32 php=7.4
python3 is by default at version 3.9:
Code:
# Possible values: 2.7, 3.8, 3.9, 3.10, 3.11
PYTHON_DEFAULT?=    3.9

same perl5:
Code:
PERL5_DEFAULT?=        5.32

php-7.4 is unsupported:
Code:
# Possible values: 8.0, 8.1, 8.2 8.3
PHP_DEFAULT?=        8.1
ports/Mk/bsd.default-versions.mk
 
Yeah, I need the postgresql plug-in for postfix, and it is not build by default, so pkg won’t install it. :(
 
Never mind. I erased the whole /usr/share/mk directory and repopulated it with the files extracted from base.txz. It works. Go figure. :|
Thanks guys for your help, and apologies for the noise.
 
I’m not sure why it works. Does /usr/share/mk in the base.txz tarball differs from what we get in /usr/src/share/mk (from which I copied the files first)?
 
Did you just blow the files onto the filesystem from tarballs instead of using the installer when you first installed this?
 
Back
Top