Using clang for compiling

Hi,

I was trying to use clang when compiling OpenKIM v2.
As described in “./configure --help” I tried to set the CC and CXX environment variables.
Unfortunately that did not work. After some digging I found that these are not read at all
and $(KIM_COMPILERSUITE) is used instead. But this only supports GCC and INTEL.
I can manually change the executables in Makefile.GCC to point to clang but this is not really nice.
Do you plan to support the CC/CXX environment variables? As far as I remember they worked
in v1.

Cheers,
Daniel

Hi Daniel,

I am not aware of a fortran compiler with necessary features that works with clang (I know if flang, but have not tested it).

So for now, the clang compilers cannot be used.

The gcc suite is known to work reasonably well. Here are commands for building and installing that works on a mac with brew’s gcc-8 installed…

$ wget https://s3.openkim.org/kim-api/kim-api-v2.0.0-beta.1.txz

$ tar Jxvf kim-api-v2.0.0-beta.1.txz

$ cd kim-api-v2.0.0-beta.1

./configure "--prefix={PWD}/installed" “–system-arch=32bit” “–log-maximum-level=KIM_LOG_VERBOSITY_DEBUG_” “LDFLAGS+=-read_only_relocs suppress” “CXX=g+±8” “CC=gcc-8” “FC=gfortran-8”

$ make

$ make install

Ryan

Hi Ryan,

maybe there is a misunderstanding. I don't want to replace gfortran,
just gcc and g++. This has always worked fine for me with v1.
Since I currently don't have a working simulator I cannot test if the
binaries actually work but at least I can compile them when
modifying the Makefile.GCC.

I tested some more and found some really strange behavior of the
KIM Makefile. These commands produce the expected error:
./configure "CXX=foo-bar" && make
However, this works and does not produce any error at all:
CXX=foo-bar ./configure && make
Also this does work as well:
export CXX=foo-bar && ./configure && make
Both of them just use the regular C++ compiler and don't respect
the CXX environment variable.

So at least from my point of view the configure script looks a little bit
strange. It definitely does not use environment variables as described
in the "--help" page. And that's what confused me in the first place.

Daniel

Hi Daniel,

Yeah, the configure script is not one generated by auto-tools, so is does not always (unfortunately) behave as one would expect such a script to.

We will very soon be moving to a cmake build system, so all of this should be much more standard....

Ryan