Dear rooters,
I have made a small program to automatically convert hdf5 files in root ones.
This is placed in a personal (public) git repository:

It works reasonably well in linux. (I didn’t do much testing, but so far it has worked always well for my purposes.).
However I am struggling quite a lot to make it work in my Mac OS X (10.9.2) 64bit.

I have got root and hdf5 compiled using the c++ compiler provided by the Command Line Tools:
osxdaily.com/2014/02/12/install- … -mac-os-x/

Then, the compiler in my mac is the following:

[Behemoth] ~ $> g++ -v Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.1.0 Thread model: posix

In order to setup the specific compilation flags for mac, the user can adapt a configuration script found in hdf2root/config/envMac.sh to point to the proper locations for root and hdf5.
Also in the configuration script for mac, the variable PLATFORM is set to macosx.
One this is set, the hdf2root/config/Makefile.common knows how to define the compilation, linking etc. flags according to the mac os x system.

However I have to be doing something wrong because despite of the program compiles it cannot be run:

[Behemoth] ~/plasma/hdf2root $> hdf2root -bash: /Users/delaossa/plasma/hdf2root/bin/hdf2root: cannot execute binary file

Does anyone has a clue why this is happening?

I have to admit that I do not have very clear what is the proper way to build executables and libraries based on ROOT in the mac os.

To get the code having git installed, just do:



if I understand correctly, the whole issue boils down to compile and run an executable linked against root libraries. You could make sure that ROOT is compiled and works correctly.
Then, a rather standard way in which you can compile your executable is:

g++ -o myExe mySource.cpp -fPIC `root-config --cflags [*]` <other arguments>

where *, can be: "–libs ", “–libs --glibs” and so on (see root-config help) according to the components you actually need in your program.


The compilation problem is fix now in the git repository
You are very welcome to use and test the program.