Clean up disk space for Void Linux

With continuous upgrade, the disk space become less on Void Linux:

# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        470M     0  470M   0% /dev
tmpfs           495M     0  495M   0% /dev/shm
tmpfs           495M  464K  494M   1% /run
/dev/sda1       7.9G  6.0G  1.5G  81% /
cgroup          495M     0  495M   0% /sys/fs/cgroup
tmpfs           495M  125M  370M  26% /tmp

Only 1.5G left. After referring this document, I do following cleaning-up:

// Cleaning package cache
# xbps-remove -yO

// Removing orphaned packages
# xbps-remove -yo

// Purging old kernels...
# vkpurge rm all

Now the free space is doubled:

# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        470M     0  470M   0% /dev
tmpfs           495M     0  495M   0% /dev/shm
tmpfs           495M  460K  494M   1% /run
/dev/sda1       7.9G  4.3G  3.2G  58% /
cgroup          495M     0  495M   0% /sys/fs/cgroup
tmpfs           495M     0  495M   0% /tmp

 

Use clang-tindy on VoidLinux

To use clang-tidy on VoidLinux, you should install clang-tools-extra first:

# xbps-install -Suv clang-tools-extra

Take following code as an example:

# cat main.cpp
struct Base
{
        virtual void do_thing() = 0;
        int data;
};

struct Derived : Base
{
        virtual void do_thing(int i) {}
};

int main()
{
}

Use clang-tidy to check it:

# clang-tidy -checks=* *.cpp --
387 warnings generated.
/root/main.cpp:1:8: warning: constructor does not initialize these fields: data [cppcoreguidelines-pro-type-member-init]
struct Base
       ^
/root/main.cpp:4:6: warning: member variable 'data' has public visibility [misc-non-private-member-variables-in-classes]
        int data;
            ^
Suppressed 384 warnings (384 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

 

Pcap develop package is needed in compiling tcpdump

On a fresh VoidLinux, I compiled tcpdump source code and met following errors during configuration:

# ../configure CFLAGS='-g -O0'
......
checking for local pcap library... not found
checking for pkg-config... no
checking for pcap-config... no
checking for main in -lpcap... no
configure: error: see the INSTALL doc for more info

I was sure libpcap was already installed. After some investigating, I found the root cause was libpcap-devel was needed:

# xbps-install -Suv libpcap-devel
......

Then the issue was fixed.