Infohub‎ > ‎Articles‎ > ‎

Building Pathscale Ekopath4 on FreeBSD


There’s a lot of buzz on the net about Pathscale open sourcing its speed-daemon compiler (http://www.pathscale.com/ekopath4-open-source-announcement). Linux users found out easy ways to get it and try to build their favorites tools, but for FreeBSD there is no “one click setup” to test it.

I’m not a compiler geek, but after some experiments I nearly found out how to compile and run ekopath compiler on FreeBSD (8.2 x64, but it should work on other FreeBSD x64 too). For the lazy ones, here is the step-by-step howto:

1)  relax

2)  Install cmake, git and libdwarf: pkg_add –r cmake git

3)  cd /tmp

5)  git clone git://github.com/path64/compiler.git (this will download the source creating the compiler subdir)
5.1) cd compiler
5.2) git checkout 4.0.10 (this is the only version I was able to build. Thanks Yamagi!)

6)  cd .. && mkdir build && cd build

7)  MYLIBPATH=/usr/lib

8) cmake ../compiler \
-DCMAKE_INSTALL_PREFIX=/usr/opt/pathscale \
-DPATH64_ENABLE_TARGETS=x86_64 \
-DPATH64_ENABLE_MATHLIBS=ON \
-DPATH64_ENABLE_HUGEPAGES=OFF \
-DPATH64_ENABLE_FORTRAN=OFF \
-DPSC_CRT_PATH_x86_64=$MYLIBPATH \
-DPSC_DYNAMIC_LINKER_x86_64=/libexec/ld-elf.so.1 \
-DPSC_LIBSUPCPP_PATH_x86_64=$MYLIBPATH \
-DPSC_LIBSTDCPP_PATH_x86_64=$MYLIBPATH \
-DPSC_LIBGCC_PATH_x86_64=$MYLIBPATH \
-DPSC_LIBGCC_EH_PATH_x86_64=$MYLIBPATH \
-DPSC_LIBGCC_S_PATH_x86_64=$MYLIBPATH \
-DPATH64_ENABLE_HUGEPAGES=OFF \
-DCMAKE_BUILD_TYPE=Debug

9)  make

10)  The preceding command will start the build process. This is a long process so relax (again).

11) When done, just put it to the right place: make install


Now you have a working pathcc/pathCC executable set. PathCC is able to build itself in the Release configuration. Add /usr/opt/pathscale to your existing path.
To do it, just restart the process from step 6). Just to be clean, create a relbuild directory instead of build, and use this cmake string:

cmake ../compiler \
-DCMAKE_INSTALL_PREFIX=/usr/opt/pathscale \
-DPATH64_ENABLE_TARGETS=x86_64 \
-DPATH64_ENABLE_MATHLIBS=ON \
-DPATH64_ENABLE_HUGEPAGES=OFF \
-DPATH64_ENABLE_FORTRAN=OFF \
-DPSC_CRT_PATH_x86_64=$MYLIBPATH \
-DPSC_DYNAMIC_LINKER_x86_64=/libexec/ld-elf.so.1 \
-DPSC_LIBSUPCPP_PATH_x86_64=$MYLIBPATH \
-DPSC_LIBSTDCPP_PATH_x86_64=$MYLIBPATH \
-DPSC_LIBGCC_PATH_x86_64=$MYLIBPATH \
-DPSC_LIBGCC_EH_PATH_x86_64=$MYLIBPATH \
-DPSC_LIBGCC_S_PATH_x86_64=$MYLIBPATH \
-DPATH64_ENABLE_HUGEPAGES=OFF \
-DCMAKE_BUILD_TYPE=Release


This is the same as step 8), with last line changed.
Before starting the make process you should change the compilers used to build things. You can put
CC=pathcc
CXX=pathCC
in your make.conf file, or just set them end then export.

If you want to use -ipa (and you probably will), you need to patch the code to point pathcc to the right linker path scripts.
Here is a post from Yamagi describing the changes to src/ipa_link/ld/eelf_x86_64_fbsd.c.
Basically you need to replace the verious return "ldscripts/elf_x86_64_fbsd.xu"; with return "/usr/libdata/ldscripts/elf_x86_64_fbsd.xu";

Now you should be ready to start the final make, to build the Release version of Ekopath 4.0.10.

Several benchmarks found on the net show anything between going slower than GCC to going twice as fast (performance for the executable, build time is under investigation), strongly depending on the options given to the compiler.


I’m not able to judge, but I think that chances are that some programs will benefit being built with ekopath, even not the system itself (if it is possible at all). In any case, having another compiler option can be only a very good thing.

Infos and readme are found here: https://github.com/path64/compiler

I would like to thank Chris, Yamagi and people at FreeBSD forums who helped me to get this compiled.
Bye