Menu

OpenBSD

Philipp Klaus Krause

Installing SDCC on OpenBSD 6.7

As of OpenBSD OpenBSD 6.7 (released 2020) to OpenBSD 7.0 (released 2021) SDCC 3.8.0 (released 2018) is included in the OpenBSD packages.

To use a more current SDCC on OpenBSD it can be built from source. The following instruction assume SDCC 3.7.1 #10386 or newer, and will not work with older versions of SDCC.

  • Get the source of the desired SDCC version, e.g. download and unpack a release tarball or checkout from svn.
  • If the default compilers support C++11 (e.g. amd64 port), configure via
CXX="c++ -I/usr/local/include" CC=cc ./configure --disable-pic14-port --disable-pic16-port

This will complain about any missing dependencies. If that happens, install the dependency, and try configure again.
The CXXFLAGS is necessary to find the boost headers, since /usr/local/include is not in the default include path for OpenBSD. The dependencies of the pic ports are hard to satisfy on OpenBSD; the easiest way aroaund is to just disable building of those ports.
* If the default compilers do not support C++11 (e.g. macppc port), install the gcc and g++ packages to get GCC 4.9, and configure via

CXX="/usr/local/bin/eg++ -ftrack-macro-expansion=0 I/usr/local/include" CC=/usr/local/bin/egcc ./configure --disable-pic14-port --disable-pic16-port
  • Build via
MAKE=gmake gmake

gmake is not part of the default install and might have to be installed first. We need it since SDCC won't build with the OpenBSD make.

Installing SDCC on OpenBSD 6.3

As of OpenBSD 6.3 (released 2018) to OpenBSD 6.7 (released 2020) SDCC 3.7.0 (released 2018) is included in the OpenBSD packages.

To use a more current SDCC on OpenBSD it can be built from source. The following instruction assume SDCC 3.7.1 #10386 or newer, and will not work with older versions of SDCC.

  • Get the source of the desired SDCC version, e.g. download and unpack a release tarball or checkout from svn.
  • If the default compilers support C++11 (e.g. amd64 port), configure via
CXX="c++ -I/usr/local/include" CC=cc ./configure --disable-pic14-port --disable-pic16-port

This will complain about any missing dependencies. If that happens, install the dependency, and try configure again.
The CXXFLAGS is necessary to find the boost headers, since /usr/local/include is not in the default include path for OpenBSD. The dependencies of the pic ports are hard to satisfy on OpenBSD; the easiest way aroaund is to just disable building of those ports.
* If the default compilers do not support C++11 (e.g. macppc port), install the gcc and g++ packages to get GCC 4.9, and configure via

CXX="/usr/local/bin/eg++ -ftrack-macro-expansion=0 I/usr/local/include" CC=/usr/local/bin/egcc ./configure --disable-pic14-port --disable-pic16-port
  • Build via
MAKE=gmake gmake

gmake is not part of the default install and might have to be installed first. We need it since SDCC won't build with the OpenBSD make.

Installing SDCC on OpenBSD 6.2

As of OpenBSD 6.2 (released 2017), SDCC 3.6.0 (released 2016) is included in the OpenBSD packages.

Installing SDCC on OpenBSD 6.0

As of OpenBSD 6.0 (released 2016), SDCC 2.8.0 (released 2008) is included in the OpenBSD packages.

To use a more current SDCC, such as 3.6.0 on OpenBSD it will have to be built from source:

  • Get the source of the desired SDCC version, e.g. download and unpack a release tarball or checkout from svn.
  • Configure via
CXXFLAGS=-I/usr/local/include ./configure --disable-pic14-port --disable-pic16-port

This will complain about any missing dependencies. If that happens, install the dependency, and try configure again.
The CXXFLAGS is necessary to find the boost headers, since /usr/local/include is not in the default include path for OpenBSD. The dependencies of the pic ports are hard to satisfy on OpenBSD; the easiest way aroaund is to just disable building of those ports.

  • Build via
MAKE=gmake gmake

gmake is not part of the default install and might have to be installed first. We need it since SDCC won't build with the OpenBSD make.

Using SDCC

SDCC uses more stack space than typical applications, and OpenBSD has a lower stack size limit than typical operating systems. The limit can be increased e.g. via

ulimit -s 32768

Related

Wiki: Home