Compiling Sysbench on OS X Yosemite or Later

These instructions are applicable after cloning the git repository and generating the autoconfigure scripts.

git clone 'https://github.com/akopytov/sysbench.git' sysbench
cd sysbench
./autogen.sh

In order to build Sysbench1 with PostgreSQL and MariaDB support, you need to make sure both mysql_config and pg_config are in your path.

I use Zsh, so this is my way of doing it, when both Postgres and MariaDB have been installed with MacPorts.

path=( /opt/local/lib/mariadb-10.1/bin /opt/local/lib/postgresql96/bin $path )

Then run

./configure --with-pgsql --with-mysql --prefix=/path/of/your/choice

You are likely to get an error like

ld: library not found for -lgcc_s.10.4

if you do not also

export MACOSX_DEPLOYMENT_TARGET=10.10

before running make, while building the bundled LuaJit. This is documented in their installation instructions.

Of course, this isn’t taken care of by the wrapper Autotools, nor is there a configure flag to set this.

An alternative might be --with-system-luajit but that depends on your situation.

Then you finish it off with make install. Happy benchmarking.


1 I hope I’m linking to the right git repository.

2 thoughts on “Compiling Sysbench on OS X Yosemite or Later

  1. sysbench author here. Thanks for putting up this summary! I have a few questions to understand the mentioned issues.

    – do you build with GCC, rather than Clang/LLVM that are used on macOS by default? The reason I’m asking is that I have never had any issues like that on macOS with Clang. In fact, most sysbench development happens on my macOS laptop, and I’ve not even been aware of MACOSX_DEPLOYMENT_TARGET, which looks specific GCC/macOS. I’m happy to take care of that in configure/automake, I just want to understand it better.

    – what was the reason for building sysbench from source? doesn’t macports provide a sysbench build? I don’t use macports myself, but I know there are reasonably up-to-date builds in Homebrew. They also have an option to build with PostgreSQL support (brew install sysbench –with-postgresql)

    Anyway, you are welcome to report any sysbench-related issues in the Github tracker (yes, https://github.com/akopytov/sysbench is the right project home URL). I usually respond quickly.

    1. I didn’t find sysbench in MacPorts.

      $ port search sysbench
      No match for sysbench found
      

      And I wanted to be sure I had both mysql and postgres support in my build. I don’t use homebrew.

      I use Clang to compile and build it — something in luajit seems to be expecting GCC. I’ve seen a similar error before.

Leave a Reply

%d bloggers like this: