Creating, Distributing, and Testing Julia Packages with Binary Dependencies

JuliaCon Workshop, June 21 2016

Tony Kelman (@tkelman)

  • So you wrote or want to use a Julia package that calls into C or Fortran.
  • How do you go from "ccall works on my machine" to making your package easy to install for anyone?
  • You want Pkg.add("MyPackage") to find, build, or download a copy of the library that will work on:
    • Linux (many distributions, Ubuntu, CentOS, etc) on x86_64 architecture
    • Mac OS X
    • Windows (7,8,10, with 64 bit and 32 bit Julia)
    • More exotic OS or architecture combinations (won't cover in much detail)
  • Ideally without requiring the user to have root/admin permissions
In [1]:
# Example library - Rmath, let's fix
# https://github.com/JuliaLang/julia/issues/6131
include("clone_example.jl")
Cloning into 'Rmath-julia'...
INFO: Initializing package repository /home/juser/.julia/v0.4
INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl
INFO: Cloning Rmath from https://github.com/tkelman/Rmath.jl
INFO: Computing changes...
INFO: Cloning cache of BinDeps from git://github.com/JuliaLang/BinDeps.jl.git
INFO: Cloning cache of Compat from git://github.com/JuliaLang/Compat.jl.git
INFO: Cloning cache of SHA from git://github.com/staticfloat/SHA.jl.git
INFO: Cloning cache of URIParser from git://github.com/JuliaWeb/URIParser.jl.git
INFO: Installing BinDeps v0.3.21
INFO: Installing Compat v0.8.1
INFO: Installing SHA v0.1.2
INFO: Installing URIParser v0.1.3
INFO: Package database updated
In [2]:
# If you run this on Windows, it likely won't work -
# See https://github.com/tkelman/JuliaCon2015/blob/master/KelmanJuliaCon2015.pdf
run(`make -C ../Rmath-julia clean`)
run(`make -C ../Rmath-julia -j4`)
make: Entering directory `/home/juser/Rmath-julia'
make -C src clean
make[1]: Entering directory `/home/juser/Rmath-julia/src'
rm -f *.o *.do *.a *.so core* *~ *#
make[1]: Leaving directory `/home/juser/Rmath-julia/src'
make: Leaving directory `/home/juser/Rmath-julia'
make: Entering directory `/home/juser/Rmath-julia'
make -C src
make[1]: Entering directory `/home/juser/Rmath-julia/src'
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c bd0.c -o bd0.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dnbeta.c -o dnbeta.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c i1mach.c -o i1mach.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pnbinom.c -o pnbinom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qlnorm.c -o qlnorm.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rgeom.c -o rgeom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c bessel_i.c -o bessel_i.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dnbinom.c -o dnbinom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c imax2.c -o imax2.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pnchisq.c -o pnchisq.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qlogis.c -o qlogis.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rhyper.c -o rhyper.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c bessel_j.c -o bessel_j.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dnchisq.c -o dnchisq.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c imin2.c -o imin2.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pnf.c -o pnf.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qnbeta.c -o qnbeta.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rlnorm.c -o rlnorm.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c bessel_k.c -o bessel_k.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dnf.c -o dnf.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c lbeta.c -o lbeta.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pnorm.c -o pnorm.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qnbinom.c -o qnbinom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rlogis.c -o rlogis.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c bessel_y.c -o bessel_y.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dnorm.c -o dnorm.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c lgamma.c -o lgamma.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pnt.c -o pnt.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qnchisq.c -o qnchisq.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rmultinom.c -o rmultinom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c beta.c -o beta.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dnt.c -o dnt.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c lgammacor.c -o lgammacor.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c polygamma.c -o polygamma.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qnf.c -o qnf.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rnbinom.c -o rnbinom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c chebyshev.c -o chebyshev.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dpois.c -o dpois.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c log1p.c -o log1p.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c ppois.c -o ppois.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qnorm.c -o qnorm.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rnchisq.c -o rnchisq.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c choose.c -o choose.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dt.c -o dt.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c mlutils.c -o mlutils.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pt.c -o pt.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qnt.c -o qnt.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rnorm.c -o rnorm.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c d1mach.c -o d1mach.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dunif.c -o dunif.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pbeta.c -o pbeta.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c ptukey.c -o ptukey.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qpois.c -o qpois.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rpois.c -o rpois.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dbeta.c -o dbeta.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dweibull.c -o dweibull.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pbinom.c -o pbinom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c punif.c -o punif.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qt.c -o qt.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rt.c -o rt.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dbinom.c -o dbinom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c expm1.c -o expm1.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pcauchy.c -o pcauchy.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pweibull.c -o pweibull.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qtukey.c -o qtukey.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c runif.c -o runif.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dcauchy.c -o dcauchy.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c fmax2.c -o fmax2.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pchisq.c -o pchisq.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qbeta.c -o qbeta.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qunif.c -o qunif.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rweibull.c -o rweibull.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dchisq.c -o dchisq.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c fmin2.c -o fmin2.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pexp.c -o pexp.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qbinom.c -o qbinom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qweibull.c -o qweibull.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dexp.c -o dexp.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c fprec.c -o fprec.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pf.c -o pf.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qcauchy.c -o qcauchy.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rbeta.c -o rbeta.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c sign.c -o sign.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c df.c -o df.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c fround.c -o fround.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pgamma.c -o pgamma.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qchisq.c -o qchisq.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rbinom.c -o rbinom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c signrank.c -o signrank.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dgamma.c -o dgamma.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c fsign.c -o fsign.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pgeom.c -o pgeom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qexp.c -o qexp.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rcauchy.c -o rcauchy.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dgeom.c -o dgeom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c ftrunc.c -o ftrunc.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c phyper.c -o phyper.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qf.c -o qf.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rchisq.c -o rchisq.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c stirlerr.c -o stirlerr.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dhyper.c -o dhyper.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c gamma.c -o gamma.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c plnorm.c -o plnorm.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qgamma.c -o qgamma.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rexp.c -o rexp.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c toms708.c -o toms708.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dlnorm.c -o dlnorm.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c gamma_cody.c -o gamma_cody.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c plogis.c -o plogis.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qgeom.c -o qgeom.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rf.c -o rf.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c wilcox.c -o wilcox.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c dlogis.c -o dlogis.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c gammalims.c -o gammalims.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c pnbeta.c -o pnbeta.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c qhyper.c -o qhyper.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c rgamma.c -o rgamma.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c sunif.c -o sunif.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c sexp.c -o sexp.o
gcc  -Wall -O3 -fPIC -DMATHLIB_STANDALONE   -std=gnu99 -I../include -DNDEBUG -c snorm.c -o snorm.o
rm -rf libRmath-julia.so
gcc   -shared -o libRmath-julia.so bd0.o dnbeta.o i1mach.o pnbinom.o qlnorm.o rgeom.o bessel_i.o dnbinom.o imax2.o pnchisq.o qlogis.o rhyper.o bessel_j.o dnchisq.o imin2.o pnf.o qnbeta.o rlnorm.o bessel_k.o dnf.o lbeta.o pnorm.o qnbinom.o rlogis.o bessel_y.o dnorm.o lgamma.o pnt.o qnchisq.o rmultinom.o beta.o dnt.o lgammacor.o polygamma.o qnf.o rnbinom.o chebyshev.o dpois.o log1p.o ppois.o qnorm.o rnchisq.o choose.o dt.o mlutils.o pt.o qnt.o rnorm.o d1mach.o dunif.o pbeta.o ptukey.o qpois.o rpois.o dbeta.o dweibull.o pbinom.o punif.o qt.o rt.o dbinom.o expm1.o pcauchy.o pweibull.o qtukey.o runif.o dcauchy.o fmax2.o pchisq.o qbeta.o qunif.o rweibull.o dchisq.o fmin2.o pexp.o qbinom.o qweibull.o dexp.o fprec.o pf.o qcauchy.o rbeta.o sign.o df.o fround.o pgamma.o qchisq.o rbinom.o signrank.o dgamma.o fsign.o pgeom.o qexp.o rcauchy.o dgeom.o ftrunc.o phyper.o qf.o rchisq.o stirlerr.o dhyper.o gamma.o plnorm.o qgamma.o rexp.o toms708.o dlnorm.o gamma_cody.o plogis.o qgeom.o rf.o wilcox.o dlogis.o gammalims.o pnbeta.o qhyper.o rgamma.o sunif.o sexp.o snorm.o
make[1]: Leaving directory `/home/juser/Rmath-julia/src'
make: Leaving directory `/home/juser/Rmath-julia'
In [3]:
# Does it work?
if VERSION <= v"0.5"
    # The version that came with Julia
    ccall((:pgamma,"libRmath-julia"), Cdouble,
        (Cdouble,Cdouble,Cdouble,Cint,Cint), 1.0,1.0,1.0,0,0)
end
Out[3]:
0.36787944117144233
In [4]:
# The version we just compiled
# Copy it to a new name just to be sure we aren't using
# the same copy we just called
cp("../Rmath-julia/src/libRmath-julia.$(Libdl.dlext)",
    "../Rmath-julia/src/libRmath-julia2.$(Libdl.dlext)")
ccall((:pgamma,"../Rmath-julia/src/libRmath-julia2"), Cdouble,
    (Cdouble,Cdouble,Cdouble,Cint,Cint), 1.0,1.0,1.0,0,0)
Out[4]:
0.36787944117144233

Now onto the (other) complicated part!

  • Upload the binary somewhere
    • GitHub releases, simplest choice
    • Automation using Travis CI (if we need to change or rebuild often)
  • Repeat for other common platforms
  • OS-specific caveats (there are many)
  • Get the binary downloaded to the user's machine at package install time
  • Add a fallback automatic from-source build for exotic OS/architectures
In [5]:
#Pkg.build("Rmath")
In [6]:
#Pkg.test("Rmath")
In [7]:
#using Rmath
In [ ]: