# Using Binarybuilder binary

**URL:** https://discourse.julialang.org/t/using-binarybuilder-binary/61952
**Category:** New to Julia
**Created:** [May 27, 2021, 5:57pm UTC](https://discourse.julialang.org/t/using-binarybuilder-binary/61952 "2021-05-27T17:57:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![HexSpin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hexspin/32/19319_2.png) [@HexSpin](https://discourse.julialang.org/u/HexSpin)
#### Post date: [May 27, 2021, 5:57pm UTC](https://discourse.julialang.org/t/using-binarybuilder-binary/61952/1 "2021-05-27T17:57:15Z")

</div>

A few weeks ago, @miguelraz , kindly unleashed binary builder magic to create primecount.jll, which reveals the number of primes below a given number very quickly.

> [@Number of primes below a given number](https://discourse.julialang.org/t/number-of-primes-below-a-given-number/58709/35):
>
> Thanks to @giordano , we have AVX2 speedups from the most recent build muscle julia\> using primecount\_jll julia\> @time run(`$(primecount()) 1e8`); 5761455 0.011614 seconds (467 allocations: 33.562 KiB) julia\> @time run(`$(primecount()) 1e14`); 3204941750802 0.181341 seconds (467 allocations: 33.562 KiB) julia\> versioninfo() Julia Version 1.6.0 Commit f9720dc2eb (2021-03-24 12:55 UTC) Platform Info: OS: Linux (x86\_64-pc-linux-gnu) CPU: Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz WOR…

It’s been useful, but I’m still stumped by something…this works great …

using primecount\_jll  
@time run(`$(primecount()) 4999933`);

But I want to do something like …

using primecount\_jll  
x = 4999933  
@time run(`$(primecount()) x`);

I thought whatever the trick needed would become clear as I used it, but it has not.

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [May 27, 2021, 6:21pm UTC](https://discourse.julialang.org/t/using-binarybuilder-binary/61952/2 "2021-05-27T18:21:08Z")

</div>

```julia
julia> x=4999933
4999933

julia> run(`$(primecount()) $x`);
348508

```

But I found an issue. The following doesnt work:

```julia
julia> x=1e14
1.0e14

julia> run(`$(primecount()) $x`);

```

Because the implicit formating into `1.0e14` from `1e14` makes the `primecount` executable to fail.  
But this would work:

```julia
julia> x="1e14"
"1e14"

julia> run(`$(primecount()) $x`);
3204941750802

```

---

<div class="post-metadata">

### Author: ![HexSpin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hexspin/32/19319_2.png) [@HexSpin](https://discourse.julialang.org/u/HexSpin)
#### Post date: [May 27, 2021, 7:37pm UTC](https://discourse.julialang.org/t/using-binarybuilder-binary/61952/3 "2021-05-27T19:37:26Z")

</div>

Thank you!

---

<div class="post-metadata">

### Author: ![miguelraz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miguelraz/32/631_2.png) [@miguelraz](https://discourse.julialang.org/u/miguelraz)
#### Post date: [May 27, 2021, 7:51pm UTC](https://discourse.julialang.org/t/using-binarybuilder-binary/61952/4 "2021-05-27T19:51:03Z")

</div>

Do note that it is much more efficient to just use `@ccall`, and not spawn an external process with `run` every time you call the function:

> [@Number of primes below a given number](https://discourse.julialang.org/t/number-of-primes-below-a-given-number/58709/37):
>
> Yup - that would add a dependency to primecount, but I think that’s accessible. If any newcomers want to PR that, feel free to DM and I’ll mentor through the process. Concretely, we wouldn’t want to spawn an external process with run(...) every time we want to count primes - we want to call to the C ABI with @ccall so that this is just a direct function call: julia\> myprimecount(x) = @ccall libprimecount.primecount\_pi(x::Clonglong)::Clonglong myprimecount (generic function with 1 method) juli…
