First steps with BinaryBuilder.jl for the Cactus code

Hey gang!
I am trying to make a binary with BinaryBuilder.jl for the Cactus code.

I am linux 16.04, Julia 1.1.

As a few first steps, I do

using BinaryBuilder;

 > Start from scratch 
 > All supported architectures
 > 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

And then this huge error comes out, with no config.log files in the current directory.

This is the content of config.log:

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
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******

1 Like

Ok, this first issue can be fixed with

CFLAGS="-std=gnu99" lib/make/configure --prefix=$prefix --host=$target
1 Like

And the following one about C++ with:

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

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.

1 Like

I’m then trying to compile with

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

but I get this error:

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.

1 Like

Thank you so much for trying this out.

The docs for Cactus are here, and its site is here.

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

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.

More context:

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
1 Like

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?

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

Aha! There’s a GetComponents 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.

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

sandbox:$WORKSPACE/srcdir/einsteintoolkit/Cactus# ./simfactory/bin/sim setup-silent
Traceback (most recent call last):
  File "./simfactory/bin/../lib/", 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/", line 126, in init
    global_dict['LocalMachine'] = simlib.GetMachineName()
  File "/workspace/srcdir/einsteintoolkit/Cactus/repos/simfactory2/lib/", line 81, in GetMachineName
    machineName = GetHostNameAlias()
  File "/workspace/srcdir/einsteintoolkit/Cactus/repos/simfactory2/lib/", line 23, in GetHostNameAlias
    homedir = os.environ['HOME']
  File "/usr/lib/python2.7/", 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?

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

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/", 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