Add CC&CXX environment variables in your OpenBSD profile

From OpenBSD 6.2, clang has become the default compiler. So maybe you need to add CC&CXX environment variables in your personal.profile:

export CC=clang
export CXX=clang++

That’s because some software will select gcc as the compiler if you don’t specify these environment variables. The gcc is too old (4.2.1) and not maintained on OpenBSD anymore.

Beware “No such file or directory” error in using ksh

Check following simple script:

#!/usr/bbin/python
print("hello world!")

I misspelled python path intentionally. On Linux Bash, it reported following error:

$ ./hello.py
-bash: ./hello.py: /usr/bbin/python: bad interpreter: No such file or directory

It prompted me that “/usr/bbin/python” couldn’t be found. While on OpenBSD ksh:

$ ./hello.py
ksh: ./hello.py: No such file or directory

It gave an illusion that hello.py didn’t exist. So be careful about this error information if you use ksh.

First installation of OpenBSD-current

I have an old laptop, and tried to install OpenBSD-current on it. Unfortunately, no matter from OpenBSD 6.3 to upgrade, or install it from scratch. the machine couldn’t boot successfully. It displayed:

>>OpenBSD/amd64 BOOT 3.39

Then it flashed one line (I couldn’t see that line clearly, and it should display loading something), and the system would reboot again.

At the end, I gave up, and install OpenBSD-current on a virtual machine.

 

Create only root partition during installing OpenBSD

The default partitions of installing OpenBSD is not appropriate for me:
3I need more space for /, since I want to build source code. So I just create one partition:

1 2

Please notice when creating partitions, there are some useful commands. Such as p, which displays current partition status:

4

? is for help:

5

Use z to delete all partitions:

6

Create the root partition and save it:

7 8

Reference:
Easy OpenBSD Partition Scheme.

Install and configure Automake on OpenBSD

Today, when I tried to compile a project, “make” complained following errors:

# make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /root/project/missing aclocal-1.15
/root/project/missing[81]: aclocal-1.15: not found
WARNING: 'aclocal-1.15' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
*** Error 127 in /root/project(Makefile:330 './aclocal.m4')

To fix it, first install Automake:

# pkg_add automake
quirks-2.414 signed on 2018-03-28T14:24:37Z
Ambiguous: choose package for automake
a       0: <None>
        1: automake-1.10.3p8
        2: automake-1.11.6p2
        3: automake-1.12.6p1
        4: automake-1.13.4p1
        5: automake-1.14.1p0
        6: automake-1.15.1
        7: automake-1.4.6p5
        8: automake-1.8.5p9
        9: automake-1.9.6p12
Your choice: 6
automake-1.15.1:autoconf-2.69p2: ok
automake-1.15.1: ok

Then “make” prompted it needs “AUTOCONF_VERSION“:

# make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /root/project/missing aclocal-1.15
Provide an AUTOCONF_VERSION environment variable, please
aclocal-1.15: error: echo failed with exit status: 127
WARNING: 'aclocal-1.15' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
*** Error 127 in /root/project/ (Makefile:330 './aclocal.m4')

Set AUTOCONF_VERSION environment variable:

# export AUTOCONF_VERSION=2.69

Run “autoreconf -f -i“:

# autoreconf -f -i
Provide an AUTOMAKE_VERSION environment variable, please
autoreconf-2.69: aclocal failed with exit status: 127

Set AUTOMAKE_VERSION:

# export AUTOMAKE_VERSION=1.15

This time, it worked:

# autoreconf -f -i
# make
/bin/sh ./config.status --recheck
......