Skip to content

WallarooLabs/ponyc

 
 

Getting help

Need help? Not to worry, we have you covered.

We have a couple resources designed to help you learn, we suggest starting with the tutorial and from there, moving on to the Pony Patterns book. Additionally, standard library documentation is available online.

If you are looking for an answer "right now", we suggest you give our IRC channel a try. It's #ponylang on Freenode. If you ask a question, be sure to hang around until you get an answer. If you don't get one, or IRC isn't your thing, we have a friendly mailing list you can try. Whatever your question is, it isn't dumb, and we won't get annoyed.

Think you've found a bug? Check your understanding first by writing the mailing list. Once you know it's a bug, open an issue.

Editor support

Installation

Using Docker

Want to use the latest revision of Pony source, but don't want to build from source yourself? You can run the ponylang/ponyc Docker container, which is created from an automated build at each commit to master.

You'll need to install Docker using the instructions here. Then you can pull the latest ponylang/ponyc image using this command:

$ docker pull ponylang/ponyc:latest

Then you'll be able to run ponyc to compile a Pony program in a given directory, running a command like this:

$ docker run -v /path/to/my-code:/src/main ponylang/ponyc

If you're unfamiliar with Docker, remember to ensure that whatever path you provide for /path/to/my-code is a full path name and not a relative path, and also note the lack of a closing slash, /, at the end of the path name.

Note that if your host doesn't match the docker container, you'll probably have to run the resulting program inside the docker container as well, using a command like this:

$ docker run -v /path/to/my-code:/src/main ponylang/ponyc ./main

If you're using docker-machine instead of native docker, make sure you aren't using an incompatible version of Virtualbox.

Linux using an RPM package (via Bintray)

For Red Hat, CentOS, Oracle Linux, or Fedora Linux, the master and release branches are packaged and available on Bintray (pony-language/ponyc-rpm).

To install release builds via Yum:

wget https://bintray.com/pony-language/ponyc-rpm/rpm -O bintray-pony-language-ponyc-rpm.repo
sudo mv bintray-pony-language-ponyc-rpm.repo /etc/yum.repos.d/

sudo yum install ponyc-release

Or, for master builds:

yum install ponyc-master

Linux using a DEB package (via Bintray)

For Ubuntu or Debian Linux, the master and release branches are packaged and available on Bintray (pony-language/ponyc-debian).

To install release builds via Apt:

echo "deb https://dl.bintray.com/pony-language/ponyc-debian pony-language main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install ponyc-release

Or, for master builds:

sudo apt-get install ponyc-master

Windows using ZIP (via Bintray)

For Windows, the master and release branches are packaged and available on Bintray (pony-language/ponyc-win):

Invoke-WebRequest -Uri https://dl.bintray.com/pony-language/ponyc-win/ponyc-VERSION.zip -UseBasicParsing -OutFile ponyc-VERSION.zip
7z x .\ponyc-VERSION.zip
.\ponyc-VERSION\ponyc\bin\ponyc.exe --version

Windows 10 users will need to install the Windows 10 SDK in order to build programs with ponyc. It can be downloaded from Microsoft.

Mac OS X using Homebrew

$ brew update
$ brew install ponyc

Arch Linux

pacman -S ponyc

Gentoo Linux

$ layman -a stefantalpalaru
$ emerge dev-lang/pony

A live ebuild is also available in the overlay (dev-lang/pony-9999) and for Vim users there's app-vim/pony-syntax.

Building ponyc from source

First of all, you need a compiler with decent C11 support. The following compilers are supported, though we recommend to use the most recent versions.

  • GCC >= 4.7
  • Clang >= 3.3
  • MSVC >= 2013
  • XCode Clang >= 6.0

Pony requires one of the following versions of LLVM:

  • 3.6.2
  • 3.7.1
  • 3.8.1
  • 3.9.0

Compiling Pony is only possible on x86 and ARM (either 32 or 64 bits).

Building on Linux

Get Pony-Sources from Github (More Information about Set Up Git https://help.github.com/articles/set-up-git/ ):

$ sudo apt install git
$ git clone git://github.com/ponylang/ponyc

Linux and OS X

Arch

pacman -S llvm make ncurses openssl pcre2 zlib

To build ponyc and compile helloworld:

$ make
$ ./build/release/ponyc examples/helloworld

If you get errors like

/usr/bin/ld.gold: error: ./fb.o: requires dynamic R_X86_64_32 reloc against 'Array_String_val_Trace' which may overflow at runtime; recompile with -fPIC

try running ponyc with the --pic flag.

$ ./build/release/ponyc --pic examples/helloworld

Debian Jessie

Add the following to /etc/apt/sources:

deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main
deb-src http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.8 main

Install the LLVM toolchain public GPG key, update apt and install packages:

$ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install make gcc g++ git zlib1g-dev libncurses5-dev \
                       libssl-dev llvm-3.8-dev

Debian Jessie and some other Linux distributions don't include pcre2 in their package manager. pcre2 is used by the Pony regex package. To download and build pcre2 from source:

$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.bz2
$ tar xvf pcre2-10.21.tar.bz2
$ cd pcre2-10.21
$ ./configure --prefix=/usr
$ make
$ sudo make install

To build ponyc, compile and run helloworld:

$ cd ~/ponyc/
$ make
$ ./build/release/ponyc examples/helloworld
$ ./helloworld

Ubuntu (14.04, 15.10, 16.04)

You should install prebuilt Clang 3.8 from the LLVM download page under Pre-Built Binaries:

$ sudo apt-get update
$ sudo apt-get install -y build-essential git zlib1g-dev libncurses5-dev libssl-dev llvm-dev

Ubuntu and some other Linux distributions don't include pcre2 in their package manager. pcre2 is used by the Pony regex package. To download and build pcre2 from source:

$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.bz2
$ tar xvf pcre2-10.21.tar.bz2
$ cd pcre2-10.21
$ ./configure --prefix=/usr
$ make
$ sudo make install

To build ponyc, compile and run helloworld:

$ cd ~/ponyc/
$ make
$ ./build/release/ponyc examples/helloworld
$ ./helloworld

Other Linux distributions

You need to have the development versions of the following installed:

  • LLVM 3.6.2, 3.7.1, 3.8.1.
  • zlib
  • ncurses
  • pcre2
  • libssl

If your distribution doesn't have a package for prce2, you will need to download and build it from source:

$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.bz2
$ tar xvf pcre2-10.21.tar.bz2
$ cd pcre2-10.21
$ ./configure --prefix=/usr
$ make
$ sudo make install

Finally to build ponyc, compile and run the hello world app:

$ cd ~/ponyc/
$ make
$ ./build/release/ponyc examples/helloworld
$ ./helloworld

Building on FreeBSD

First, install the required dependencies:

$ sudo pkg install gmake
$ sudo pkg install llvm38
$ sudo pkg install pcre2
$ sudo pkg install libunwind

This will build ponyc and compile helloworld:

$ gmake
$ ./build/release/ponyc examples/helloworld

Please note that on 32-bit X86, using LLVM 3.7.1 or 3.8.1 on FreeBSD currently produces executables that don't run. Please use LLVM 3.6.2. 64-bit X86 does not have this problem, and works fine with LLVM 3.7.1 and 3.8.1.

Building on Mac OS X

Linux and OS X

You'll need llvm 3.6.2, 3.7.1, or 3.8.1 and the pcre2 library to build Pony. You can use either homebrew or MacPorts to install these dependencies.

Installation via homebrew:

$ brew update
$ brew install homebrew/versions/llvm38 pcre2 libressl

Installation via MacPorts:

$ sudo port install llvm-3.8 pcre2 libressl
$ sudo port select --set llvm mp-llvm-3.8

Launch the build with make after installing the dependencies:

$ make
$ ./build/release/ponyc examples/helloworld

Building on Windows

Windows

Note: it may also be possible (as tested on build 14372.0 of Windows 10) to build Pony using the Ubuntu 14.04 instructions inside Bash on Ubuntu on Windows.

The LLVM prebuilt binaries for Windows do NOT include the LLVM development tools and libraries. Instead, you will have to build and install LLVM 3.7.1 or 3.8.1 from source. You will need to make sure that the path to LLVM/bin (location of llvm-config) is in your PATH variable.

LLVM recommends using the GnuWin32 unix tools; your mileage may vary using MSYS or Cygwin.

  • Install GnuWin32 using the GetGnuWin32 tool.
  • Install Python (3.5 or 2.7).
  • Install CMake.
  • Get the LLVM source (e.g. 3.7.1 is at 3.7.1).
  • Make sure you have VS2015 with the C++ tools installed.
  • Generate LLVM VS2015 configuration with CMake. You can use the GUI to configure and generate the VS projects; make sure you use the 64-bit generator (Visual Studio 14 2015 Win64), and set the CMAKE_INSTALL_PREFIX to where you want LLVM to live.
  • Open the LLVM.sln in Visual Studio 2015 and build the INSTALL project in the LLVM solution in Release mode.

Building Pony requires Premake 5.

  • Get the PreMake 5 executable.
  • Get the PonyC source.
  • Run premake5.exe --with-tests --to=..\vs vs2015 to generate the PonyC solution.
  • Build ponyc.sln in Release mode.

In order to run the pony compiler, you'll need a few libraries in your environment (pcre2, libssl, libcrypto).

There is a third-party utility that will get the libraries and set up your environment:

  • Install 7-Zip, make sure it's in your PATH.
  • Open a VS2015 x64 Native Tools Command Prompt (things will not work correctly otherwise!) and run:
$ git clone [email protected]:kulibali/ponyc-windows-libs.git
$ cd ponyc-windows-libs
$ .\getlibs.bat
$ .\setenv.bat

Now you can run the pony compiler and tests:

$ cd path_to_pony_source
$ build\release\testc.exe
$ build\release\testrt.exe
$ build\release\ponyc.exe -d -s packages\stdlib
$ .\stdlib

Building with link-time optimisation (LTO)

You can enable LTO when building the compiler in release mode. There are slight differences between platforms so you'll need to do a manual setup. LTO is enabled by setting lto to yes in the build command line:

$ make lto=yes

If the build fails, you have to specify the LTO plugin for your compiler in the LTO_PLUGIN variable. For example:

$ make LTO_PLUGIN=/usr/lib/LLVMgold.so

Refer to your compiler documentation for the plugin to use in your case.

VirtualBox

Pony binaries can trigger illegal instruction errors under VirtualBox 4.x, for at least the x86_64 platform and possibly others.

Use VirtualBox 5.x to avoid possible problems.

AVX2 Support

The Pony prebuilt binaries trigger illegal instruction errors under CPUs without AVX2 support.

Building Pony on Non-x86 platforms

On ARM platforms, the default gcc architecture specification used in the Makefile of native does not work correctly, and can even result in the gcc compiler crashing. You will have to override the compiler architecture specification on the make command line. For example, on a RaspberryPi2 you would say:

$ make arch=armv7

To get a complete list of acceptable architecture names, use the gcc command:

gcc -march=none

This will result in an error message plus a listing off all architecture types acceptable on your platform.

Packages

No packages published

Languages

  • C++ 43.3%
  • C 35.2%
  • Pony 19.3%
  • Makefile 0.6%
  • Python 0.6%
  • CMake 0.4%
  • Other 0.6%