Install DragonFly BSD on VirtualBox

Today I tried to install DragonFly BSD on VirualBox, and the whole progress was pretty smooth, but some caveats need to be noticed:

(1) Select FreeBSD(64-bit) as the Operating System;

(2) I use the simplest “Legacy BIOS“.

If you want to make your feet wet in DragonFly BSD, you can follow above steps yourself. Have fun!

Be aware of using gmake or make on BSD systems

When working on BSD systems, you should be aware of using gmake or make. E.g., I met a weird error using make on NetBSD today:

# make
.....
/usr/lib/crt0.o: In function `___start':
(.text+0xf7): undefined reference to `main'
collect2: error: ld returned 1 exit status
*** Error code 1
......

But using gmake, the compilation is OK.

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.

Build legacy test files in HElib

In HElib src directory, there are some files which begin with Test_ prefix. Since HElib uses CMake to build it, these Test_* files won’t be compiled by default. To build and use them, ENABLE_LEGACY_TEST option should be turned ON:

$ cmake -DENABLE_LEGACY_TEST=ON ..
$ make

The executable files will be generated in bin folder:

$ cd bin/
$ ls
Test_approxNums     Test_bootstrapping  Test_General    Test_PAlgebra      Test_PtrVector          Test_ThinEvalMap
Test_binaryArith    Test_EaCx           Test_intraSlot  Test_Permutations  Test_Replicate          Test_Timing
Test_binaryCompare  Test_EvalMap        Test_IO         Test_PolyEval      Test_tableLookup
Test_Bin_IO         Test_extractDigits  Test_matmul     Test_Powerful      Test_ThinBootstrapping