# First steps with BinaryBuilder.jl for the Cactus code

**URL:** <https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819>\
**Category:** New to Julia\
**Tags:** binarybuilder\
**Created:** [May 3, 2019, 4:28pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819 "2019-05-03T16:28:42Z")\
**Posts on this page:** 13\
**Page:** 1

<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 3, 2019, 4:28pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/1 "2019-05-03T16:28:42Z")

</div>

Hey gang!  
I am trying to make a binary with [BinaryBuilder.jl](https://www.youtube.com/watch?v=2e0PBGSaQaI) for the [Cactus code](https://bitbucket.org/cactuscode/cactus/src/master/).

I am linux 16.04, Julia 1.1.

As a few first steps, I do

```julia
using BinaryBuilder;
BinaryBuilder.run_wizard()

 > Start from scratch 
 > All supported architectures
 > https://miguelraz@bitbucket.org/cactuscode/cactus.git
 > Cactus_4.6.0
 > Would you like to download additional sources? [y/N]: n
 > Do you require any (binary) dependencies? [y/N]: n

# Now in sandbox
sandbox:$WORKSPACE/srcdir# cd cactus
sandbox:$WORKSPACE/srcdir/cactus# lib/make/configure --prefix=$prefix --host=$target 
# Errors out
# Cactus requires a C99 compiler -- check your C compiler and C compiler flags

sandbox:$WORKSPACE/srcdir/cactus# make 4.6.0
sandbox:$WORKSPACE/srcdir/cactus# make 4.6.0 install
Cactus - version: 4.2.3
Error: Configuration 4.6.0 is incomplete.

sandbox:$WORKSPACE/srcdir/cactus# exit
exit

```

And then [this huge error comes out](https://gist.github.com/miguelraz/9bfe29cd6154201f761c9d97de747c67), with no `config.log` files in the current directory.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [May 3, 2019, 5:11pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/2 "2019-05-03T17:11:11Z")

</div>

This is the content of `config.log`:

```nohighlight
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

configure:910: checking host system type
configure:956: checking whether make sets ${MAKE}
configure:1021: checking whether the C compiler (/opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-gcc ) works
configure:1038: /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-gcc -o conftest conftest.c 1>&5
configure:1067: checking whether the C compiler (/opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-gcc ) is a cross-compiler
configure:1075: checking whether we are using GNU C
configure:1084: /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-gcc -E conftest.c
configure:1132: checking whether the C++ compiler (/opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-g++ ) works
configure:1149: /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-g++ -o conftest conftest.C 1>&5
configure:1175: checking whether the C++ compiler (/opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-g++ ) is a cross-compiler
configure:1183: checking whether we are using GNU C++
configure:1192: /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-g++ -E conftest.C
configure:1208: checking for nvcc
configure:1279: checking for cpp
configure:1369: checking for perl
configure:1406: checking for gtar
configure:1406: checking for tar
configure:1443: checking for xargs
configure:1480: checking for gzip
configure:1517: checking for gpatch
configure:1517: checking for patch
configure:1554: checking for git
configure:1591: checking for f90
configure:1591: checking for pgf90
configure:1591: checking for xlf90
configure:1591: checking for ifort
configure:1591: checking for gfortran-mp-4.4
configure:1591: checking for gfortran-mp-4.3
configure:1591: checking for gfortran-mp-4.2
configure:1591: checking for gfortran
configure:1665: checking for mkdir
configure:1704: checking for bash
configure:1982: checking how to run the C preprocessor
configure:2062: checking for ANSI C header files
configure:2075: /opt/x86_64-linux-gnu/bin/cpp conftest.c >/dev/null 2>conftest.out
configure:2142: /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-gcc -o conftest conftest.c 1>&5
configure: In function 'main':
configure:2137:67: warning: incompatible implicit declaration of built-in function 'exit' [enabled by default]
 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
                                                                   ^
configure:2169: checking for C99 features
configure:2187: /opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-gcc -c conftest.c 1>&5
configure: In function 'main':
configure:2182:1: error: 'for' loop initial declarations are only allowed in C99 mode
 for (int i=0; i<10; ++i) x+=i;
 ^
configure:2182:1: note: use option -std=c99 or -std=gnu99 to compile your code
configure: failed program was:
#line 2175 "configure"
#include "confdefs.h"

int main() {
// Test C99 comments
// Test variable declarations in the middle of blocks
0;
int x = 1;
for (int i=0; i<10; ++i) x+=i;

; return 0; }

```

Note: the compilation is run in a sandbox, you won’t find anything in your current directory ever. Elliot suggested you to look at the `configure.log` _within_ the sandbox. The content of the sandbox is actually in a temporary directory, in GNU/Linux systems under `/tmp/julia ****** `

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [May 3, 2019, 5:27pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/3 "2019-05-03T17:27:53Z")

</div>

Ok, this first issue can be fixed with

```julia
CFLAGS="-std=gnu99" lib/make/configure --prefix=$prefix --host=$target

```

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [May 3, 2019, 5:30pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/4 "2019-05-03T17:30:47Z")

</div>

And the following one about C++ with:

```julia
CXXFLAGS="-std=c++11" CFLAGS="-std=gnu99" lib/make/configure --prefix=$prefix --host=$target

```

---

<div class="post-metadata">

**Author:** ![staticfloat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/staticfloat/32/34_2.png) [@staticfloat](https://discourse.julialang.org/u/staticfloat)\
**Post date:** [May 3, 2019, 5:40pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/5 "2019-05-03T17:40:13Z")

</div>

I’m surprised that the `configure` script isn’t automatically adding the `-std=gnu99` flag by itself. Looking at the source it makes no attempt to, but still that’s kind of odd. Yes, setting the `CFLAGS` and `CXXFLAGS` is a good way of getting around this.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [May 3, 2019, 5:44pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/6 "2019-05-03T17:44:37Z")

</div>

I’m then trying to compile with

```julia
make CXXFLAGS="-std=c++11" CFLAGS="-std=gnu99" PROMPT=no install

```

but I get this error:

```julia
Creating compiled ThornList containing all thorns in the arrangements directory
Can't change directory to /workspace/srcdir/cactuscode-cactus-f9c92f88a59e/arrangements
make[2]: *** [/workspace/srcdir/cactuscode-cactus-f9c92f88a59e/lib/make/make.configuration:222: /workspace/srcdir/cactuscode-cactus-f9c92f88a59e/configs/install/ThornList] Error 2
make[1]: *** [Makefile:259: install] Error 2
make: *** [Makefile:1351: install] Error 2

```

But I’m not sure this is the correct target to be run at this point, I couldn’t find building instructions for this program.

---

<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 3, 2019, 6:04pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/7 "2019-05-03T18:04:03Z")

</div>

Thank you so much for trying this out.

The docs for [Cactus are here](http://cactuscode.org/documentation/UsersGuide.pdf), and its site [is here](http://cactuscode.org/documentation/).

I just created the `arrangements` folder and then hit an error for the CXX flag being unrecognized.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [May 3, 2019, 6:07pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/8 "2019-05-03T18:07:35Z")

</div>

> [@miguelraz](#):
>
> The docs for [Cactus are here](http://cactuscode.org/documentation/UsersGuide.pdf), and its site [is here](http://cactuscode.org/documentation/).

Yeah, I found it, there is already the Doc directory in the source code. However it says to run `make <configuration name>-config`, I have no idea what you need to build.

> [@miguelraz](#):
>
> I just created the `arrangements` folder and then hit an error for the CXX flag being unrecognized.

More context:

```julia
Creating cactus_install in /workspace/srcdir/cactuscode-cactus-f9c92f88a59e/exe from
/opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-ld: unrecognized option '-std=c++11'
/opt/x86_64-linux-gnu/bin/x86_64-linux-gnu-ld: use the --help option for usage information
make[1]: *** [/workspace/srcdir/cactuscode-cactus-f9c92f88a59e/lib/make/make.configuration:152: /workspace/srcdir/cactuscode-cactus-f9c92f88a59e/exe/cactus_install] Error 1
make: *** [Makefile:260: install] Error 2

```

---

<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 5, 2019, 6:09pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/9 "2019-05-05T18:09:26Z")

</div>

OK, I think I’ve found an actually found a way to install Cactus but I can only do it with a working `svn` within the sandbox. Howerver, `apt-get` doesn’t work. I tried providing it as an external dependency, but I wasn’t sure if the step forward was with a `build.jl` that downloads the svn tarball, unpacks, and links to it. Is there a recommended way of installing dependencies within the sandbox environment?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [May 5, 2019, 6:18pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/10 "2019-05-05T18:18:46Z")

</div>

> [@miguelraz](#):
>
> OK, I think I’ve found an actually found a way to install Cactus but I can only do it with a working `svn` within the sandbox.

Why do you need SVN? Isn’t it sufficient a snapshot of the repository?

---

<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 5, 2019, 6:32pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/11 "2019-05-05T18:32:09Z")

</div>

Aha! There’s a [GetComponents](http://cactuscode.org/documentation/tutorials/wavetoydemo/) script used to download the `thornlists` component that uses `svn` / `git` to check out and download said components. I think I just found the workaround by feeding the path for `git` and not `svn`.

---

<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 5, 2019, 7:08pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/12 "2019-05-05T19:08:09Z")

</div>

OK, one of the steps is erroring on the following step:

```julia
sandbox:$WORKSPACE/srcdir/einsteintoolkit/Cactus# ./simfactory/bin/sim setup-silent
Traceback (most recent call last):
  File "./simfactory/bin/../lib/sim.py", line 147, in <module>
    simenv.init(base=BASE_PATH, callingExecutable=os.path.join(BASE_PATH, "bin/sim"), usageString=buildUsageString(), optionGroups=optionGroups)
  File "/workspace/srcdir/einsteintoolkit/Cactus/repos/simfactory2/lib/simenv.py", line 126, in init
    global_dict['LocalMachine'] = simlib.GetMachineName()
  File "/workspace/srcdir/einsteintoolkit/Cactus/repos/simfactory2/lib/simlib.py", line 81, in GetMachineName
    machineName = GetHostNameAlias()
  File "/workspace/srcdir/einsteintoolkit/Cactus/repos/simfactory2/lib/simlib.py", line 23, in GetHostNameAlias
    homedir = os.environ['HOME']
  File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
    raise KeyError(key)
KeyError: 'HOME'

```

I think this is the sort of thing the sandbox should be able to handle - should I file an issue?

---

<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 5, 2019, 8:28pm UTC](https://discourse.julialang.org/t/first-steps-with-binarybuilder-jl-for-the-cactus-code/23819/13 "2019-05-05T20:28:09Z")

</div>

OK, manually setting the `HOME` variable runs against not having `lscpu` installed to pull the number of cores per cpu.

```julia
sandbox:$WORKSPACE/srcdir/einsteintoolkit/Cactus# export HOME=/root
sandbox:$WORKSPACE/srcdir/einsteintoolkit/Cactus# ./simfactory/bin/sim setup-silent
...
    self.performOperation(vdict, 'value')
  File "/workspace/srcdir/einsteintoolkit/Cactus/repos/simfactory2/lib/simdt.py", line 272, in performOperation
    if default.count("@") > 0:
AttributeError: 'NoneType' object has no attribute 'count'
sandbox:$WORKSPACE/srcdir/einsteintoolkit/Cactus# lscpu
bash: lscpu: command not found

```
