LLVM-gcc for Ada

I am trying to build llvm-gcc-4.2 but cannot figure out how to get past the problem described below.
Any help will be much appreciated.
Regards
Roger

gnatbind -C -I- -I. -Iada -I../../llvm-gcc-4.2/gcc/ada -o ada/b_gnat1.c -n ada/gnat1drv.ali
error: "s-imenne.adb" must be compiled
error: ("/opt/gnat-gpl-2009/lib/gcc/i386-apple-darwin10.2.0/4.3.4/adalib/s-imenne.ali" is obsolete and read-only)
error: "s-imenne.adb" and "gnat1drv.adb" compiled with different exception handling mechanisms
make[2]: *** [ada/b_gnat1.c] Error 5
make[1]: *** [all-gcc] Error 2
make: *** [all] Error 2

Also occurs for /opt/gnat-gpl-2009/bin/gnatbind

System:
Model Name: Mac mini
  Model Identifier: Macmini1,1
  Processor Name: Intel Core Duo
  Processor Speed: 1.66 GHz
  Number Of Processors: 1
  Total Number Of Cores: 2
Mac OS X 10.6.2
XCode 3.2.1

Following is what have had to do to get up to the binding stage:

Based on http://llvm.org/docs/GCCFEBuildInstrs.html#ada
and llvm-gcc-4.2/README.LLVM

Top level directory: llvm
Sub-directories:
llvm (svn)
llvm-gcc-4.2 (svn)
mkdir llvm-objects
mkdir llvm-gcc-4.2-objects
mkdir install
mkdir install/lib

Built and installed llvm without problems.

In install/lib:
ln -sf /usr/lib/libstdc++.6.dylib .
ln -sf /usr/lib/libstdc++.6.dylib libstdc++.dylib

export CC=/opt/gnat-gpl-2009/bin/gcc
export CXX=/usr/bin/g++
EXTRALANGS=,ada,fortran,objc,obj-c++
export TRIPLE=i686-apple-darwin10

In llvm-gcc-4.2/gcc/Makefile.in
change all occurrences of -mdynamic-no-pic
to -dynamic-no-pic

In config/mh-x86-darwin
change BOOT_CFLAGS=-g -O2 -mdynamic-no-pic
to BOOT_CFLAGS=-g -O2 -dynamic-no-pic

in gcc/ada/ali.adb at line 1692
change Add_Char_To_Name_Buffer (nul);
to Add_Char_To_Name_Buffer (NUL);
in gcc/ada/errout.adb at line 1782
change if Name_Buffer (J) = ASCII.Nul then
to if Name_Buffer (J) = ASCII.NUL then
and many other similar "STYLE" problems.
How to stop warnings being treated as errors? --disable-werror seems to work for some things but not these Ada compiles.

../llvm-gcc-4.2/configure --prefix=/usr --enable-languages=ada,c,fortran,objc,obj-c++ --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-bootstrap --disable-multilib --disable-werror --with-gxx-include-dir=/usr/include/c++/4.2.1 --build=$TRIPLE --host=$TRIPLE --target=$TRIPLE --with-gmp=/usr/local --with-mpfr=/usr/local --with-libiconv-prefix=/usr/local

Had to do this to get the right gnatmake:
In llvm-gcc-4.2-objects/gcc/ada/Make-lang.in
declare:
gnatmake = /opt/gnat-gpl-2009/bin/gnatmake
For all targets ada/treeprs.ads through ada/nmake.ads
Change gnatmake -q
to $(gnatmake)

Hi Roger,

I am trying to build llvm-gcc-4.2 but cannot figure out how to get past the problem described below.

you need to build with GNAT GPL 2007 or earlier, as described here:
  http://llvm.org/docs/GCCFEBuildInstrs.html
This is because llvm-gcc-4.2 is based on gcc-4.2, and you have the same problem
with gcc-4.2. I don't know if anyone ever built an Ada-enabled llvm-gcc on
MacOS before, so you may have additional problems.

That said, I'm not working on Ada support in llvm-gcc-4.2 any more: my efforts
are directed at the dragonegg project: http://dragonegg.llvm.org/
This allows you to use LLVM with gcc-4.5. The Ada front-end in gcc-4.5 is much
more capable than in gcc-4.2, so this is a huge improvement as far as Ada is
concerned. Unfortunately, I didn't get round to implementing exception handling
in dragonegg yet, which is rather fatal for Ada code. "Any day now" :slight_smile:

Also, GCC plugins don't work on Mac OS without some (small) patches. This is
because dynamic libraries work a bit differently there as compared to eg
linux. This should really be fixed in GCC. Anton managed to get it all
working, so he would be a good person to ask if you are interested.

Ciao,

Duncan.

Hi Duncan,
   Thanks for your advice.
I'll see how I go with dragonegg.
I have been using gps for my Ada development but thought I should try and use XCode which is how I came across llvm.
Getting llvm working was more out of interest and challenge.
Regards
Roger