[cfe-dev] Using clang in older operating systems

ardi via cfe-dev cfe-dev at lists.llvm.org
Wed Jan 18 01:52:01 PST 2017


Hi,

I'm wondering if there's any layer, project, approach, etc, that would
allow using clang in older operating systems. By older, I mean a
not-current UNIX system, for example.

Last year, I succeeded at building clang 3.8.0 on OS X 10.6.8. It
wasn't easy, I first needed to build 3.4.2, and from there, 3.8.0, but
patching was required (I took some patches from macports, and others
from other net contributions I found). It was certainly nontrivial,
and at some point I really felt I wasn't going to succeed. I almost
gave up.

I understand the preference (and perhaps the practical need, from a
compiler engineer point of view) to only support current operating
systems. However, my programming projects have a focus in "strong"
backwards compatibility ("strong" here means that even OS X 10.6.8
could be considered a very modern OS... my source code even builds in
NeXTSTEP 3.3 and IRIX 6.x).

However, wishing to start using modern libraries in my code, C++11 or
C++14 support is a de-facto requirement nowadays. I searched, but
there are no "universally compatible" open source compilers for C++11
or C++14 that would work on a POSIX system from the 90s, for example.

I really love clang. I use it daily on OS X. If I had to choose only a
compiler for all my work, it would be this.

So I'm wondering if there's any approach or project that would allow
me to use clang in older operating systems.

For example: Is there any backend that would generate older C/C++ code
that could then be compiled on an older system? This would require a
two step build process (first step on a current system that can run
clang, and second step compiling the intermediate older C/C++ code on
the deploy system), but at least it would provide a valid path for me.

Is there any path I could take? (note that I'm not interested in
discussing backwards compatibility philosophy questions, if the
suggestion is "don't code for old operating systems", that's not an
option).

Thanks!



More information about the cfe-dev mailing list