Can’t compile a port software. Error: Unable to determine OS version. Either define OSVERSION, install /usr/include/sys/param.h or define SRC_BASE
-
Hi,
I'm trying to compile a port and I get this error:
make: "/usr/ports/Mk/bsd.port.mk" line 1177: Unable to determine OS version. Either define OSVERSION, install /usr/include/sys/param.h or define SRC_BASE. make: stopped in /usr/ports/devel/gh
This is what I did:
git clone --depth 1 https://github.com/pfsense/FreeBSD-ports /usr/ports
cd /usr/ports/devel/gh
make install clean
How can I fix it?
Regards, Antoine
-
Where are you trying to compile this port? You can't do any development work on the firewall as none of the required supporting libraries and utilities are installed (and they should never be -- it's a firewall not a software development box).
The proper way to build ports is to create a totally separate FreeBSD machine (a virtual machine is great for this), install the required development tools, and then build the port of your choice.
One warning, don't expect a port built this way to seamlessly install on pfSense. It is likely you will see incompatibilities between the customized pfSense kernel and the stock FreeBSD one on your builder.
If you want to build a customized port that will actually install on a pfSense machine without issue, you will need to read through this very long thread and follow the steps outlined there in the various posts: https://forum.netgate.com/topic/169749/pfsense-compile-requirements-for-3rd-party-software. Be prepared to spend quite a bit of time getting it work correctly, but in the end it will work . I do this all the time to build and test new versions of the Snort and Suricata packages for which I am the volunteer maintainer. When you build the "package builder machine" described in the thread, you must select the proper pfSense branch (RELENG or DEVEL) for the target pfSense machine.
-
@bmeeks
I was trying to compile ports on a Virtualbox machine, and yes, then I would copy it on my real router.So, I understand that I must install a corresponding FreeBSD version.
Since I have pfSense 2.7.2, and that
uname -a
gives me14.0-CURRENT
, I should download FreeBSD 14.0-STABLE, according to the post you linked in your reply?But I don’t see it in the FreeBSD download site…
https://download.freebsd.org/releases/amd64/Regards, Antoine
-
@antoine2711 said in Can’t compile a port software. Error: Unable to determine OS version. Either define OSVERSION, install /usr/include/sys/param.h or define SRC_BASE:
@bmeeks
I was trying to compile ports on a Virtualbox machine, and yes, then I would copy it on my real router.So, I understand that I must install a corresponding FreeBSD version.
Since I have pfSense 2.7.2, and that
uname -a
gives me14.0-CURRENT
, I should download FreeBSD 14.0-STABLE, according to the post you linked in your reply?But I don’t see it in the FreeBSD download site…
https://download.freebsd.org/releases/amd64/Regards, Antoine
Well, it gets complicated quickly when trying to compile ports for pfSense. As you found, you can't actually download and install 14.0-STABLE now. What I would do is follow the steps outlined in several of the posts in the thread I linked earlier. You will need to read most (if not all) of the posts in that thread to get the gist of how to proceed. It is very hard to do, and there is lots that is not documented. The folks who contributed to that linked thread all give tidbits of what is required and what eventually worked for them. You will need quite a bit of experience with code development/compiling/linking and with using
pkg
to get things working. It's not a click once or twice and you're done affair. It will take a lot of tinkering.You will first need to install a vanilla FreeBSD virtual machine to act a base platform for the package builder. You can install 14.2-STABLE for that as it is available. It really does not matter much because then you would need to follow the steps to clone and check out the pfsense/pfsense repo and pfsense/FreeBSD-ports repo from GitHub. Then follow the steps described in the posts from that linked thread to properly configure the local
build.conf
file and then set up a Poudriere package builder using the relevant pfSense branch (that is RELENG_2_7_2 if building for the current CE version of pfSense).The ports are best built using a Poudriere jail that is created using the FreeBSD source code directly from the pfSense repos on GitHub. The tools needed to do that are described in the linked thread. It's just going to be an exercise to read them all and understand the flow. It is NOT a trivial thing -- that I can guarantee you . And you very well may get frustrated and throw up your hands before finishing. Many others have done that.
This post in that long thread is a good summary of the "final solution": https://forum.netgate.com/topic/169749/pfsense-compile-requirements-for-3rd-party-software/101. But to fully understand what the post is summarizing, you need to research the material in all of the previous posts.