OPNsense Forum

English Forums => General Discussion => Topic started by: tessus on March 23, 2023, 09:31:17 pm

Title: btop - install pkgs from FreeBSD repo?
Post by: tessus on March 23, 2023, 09:31:17 pm
I've tried to install btop, since I saw that it is available in the FreeBSD repos, but I got the following message:

Code: [Select]
# pkg install btop
Updating OPNsense repository catalogue...
OPNsense repository is up to date.
All repositories are up to date.
pkg: No packages available to install matching 'btop' have been found in the repositories

I noticed that the FreeBSD repo is disabled and enabled it for trying to see what happens:

Here is the important part:

Code: [Select]
New packages to be INSTALLED:
binutils: 2.39,1 [FreeBSD]
btop: 1.2.13 [FreeBSD]
gcc12: 12.2.0_5 [FreeBSD]
graphite2: 1.3.14 [FreeBSD]
icu: 72.1,1 [FreeBSD]
libfontenc: 1.1.4 [FreeBSD]
libssh2: 1.10.0_1,3 [FreeBSD]
libunwind: 20211201_1 [FreeBSD]
mpc: 1.2.1 [FreeBSD]
mpfr: 4.2.0,1 [OPNsense]

This makes me rather nervous and it makes no sense. I am not sure why I would have to install gcc as a dependecy for btop.

What is the best way to get btop on OPNsense? Shall I setup FreeBSD in a VM and create a static btop binary? How does the OPNsense team handle such a situation?
Title: Re: btop - install pkgs from FreeBSD repo?
Post by: varminty on May 14, 2023, 10:43:45 am
I face the same situation.

What did you end up doing? I'm also considering vm build just to make this binary..
Title: Re: btop - install pkgs from FreeBSD repo?
Post by: tessus on May 14, 2023, 05:32:10 pm
Nothing so far, but I will setup a VM and create a static binary of btop - if that's possible that is.

Not sure when I get to it though. I hoe in the next few days.
Title: Re: btop - install pkgs from FreeBSD repo?
Post by: tessus on May 14, 2023, 07:25:24 pm
I found a bit of time. Here is a binary that has the libgcc and libstdc++ statically linked.

https://evermeet.cx/pub/freebsd/amd64/btop/btop.tar.gz

 
Title: Re: btop - install pkgs from FreeBSD repo?
Post by: Koldnitz on May 14, 2023, 08:11:51 pm
You could compile it yourself.

This post explains setting up the ports tree:

https://forum.opnsense.org/index.php?topic=15011.0 (https://forum.opnsense.org/index.php?topic=15011.0)

I keep everything updated with the following command:

Code: [Select]
sudo pkg update &&  sudo opnsense-code ports tools src
I got errors for not having gmake and mpfr, they need to be installed:

Code: [Select]
sudo pkg install gmake
sudo pkg install mpfr

To make btop:

Code: [Select]
cd /usr/ports/sysutils/btop
sudo make install

This is taking a bit to compile, but so far I have experienced no other errors.

Cheers,
Title: Re: btop - install pkgs from FreeBSD repo?
Post by: tessus on May 14, 2023, 08:16:02 pm
If you compile it the way you do, you will have to install gcc on your firewall to meet the dependency requirements.

You actually have to tweak the Makefile and set a few env vars to create a binary that only has the libgcc and libstd++ statically linked. Otherwise you run into linker errors if you only try to set STATIC=true.

But this is why I provided a link to the compiled binary that works as is on the firewall.
Title: Re: btop - install pkgs from FreeBSD repo?
Post by: Koldnitz on May 15, 2023, 12:02:48 am
It built without any changes to the default makefile in the ports tree, but it did take a few hours.

The dependencies weren't that big an issue for me, because I have built other programs.

Obviously, this may not be the case for everyone.

What I like about the OPNSense community is that you are encouraged to figure out how to do things with the tools provided.

Quote
“Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime”

Lao Tzu

Cheers,
Title: Re: btop - install pkgs from FreeBSD repo?
Post by: tessus on May 15, 2023, 10:06:33 pm
I am sorry, but I think you misunderstood what I was doing. I did not install a dev env on my firewall.
I setup a FreeBSD 13.1 VM and installed the dev env there. Btw, this took about 15 minutes.
Then I compiled btop according to the README in the btop git repo. And there I ran into a few issues, because the STATIC=true option did not work, which is why I had to change the Makefile. Compiling btop took less than 30 seconds, so I have no idea why you are talking about hours.

Either way, for people who do not want to install gcc on their firewall, I created a binary that has the 2 libraries that come with gcc statically linkeed into btop.

I hope you understand now what I was doing and why.