[gtkada] patch for mac

Chris Douty Chris_Douty at ampex.com
Sat Jul 24 02:47:54 CEST 2004


On Wednesday, July 7, 2004, at 02:51 PM, Arnaud Charlet wrote:

>> My patch works with configure, but you wanted it moved backwards a 
>> bit.
>
> Right, configure is automatically generated, so you can't modify it.
>
>>   i don't know how to do that, however one of the folks on gnat mac
>> mailing list is working on it.
>>
>> perhaps the patch file could be put in the distribution so that mac
>> folks could apply it themselves if they wanted to for now?
>
> Assuming that it still applies to current sources, we could put it in 
> the
> contrib directory, yes.

I'm working on it, but I'm not sure that all is well.

Starting with Jim's patch I have made fairly minor modifications to 
configure.in, Makefile.in, aclocal.m4, etc. from the current CVS head.  
Just use autoconf to regenerate configure.

First question:  Do you require a particular autoconf version?  If not, 
then I will not include the diffs to configure since they are 
redundant.  Whoever applies the patch can run autoconf.

As I said I am not sure that all is well.  My development machine has 
Mac OS X 10.3.4 (darwin 7.4.0) loaded with the XCode 1.2 tools.  I 
applied the macada.org patch on top of that.  To get GTK+ I used 
darwinports which installed 2.4.1 and all of the dependent libraries.  
It is my understanding the Jim uses darwinports too.  I do not have 
GNOME or Glade installed, so I can't test those portions of the kit.

Everything in GtkAda compiles without warning.  It's the linking that's 
problematic.  My first attempt just built static libraries and testgtk 
worked except for OpenGL.  The program just crashed on clicking the 
OpenGL pane.  Heartened, I set out to build dylibs (the darwin version 
of shared libraries).  Here is where it gets nasty, and I am proceeding 
slowly.

Darwin uses Mach-O as the binary format while Linux, Solaris, et al. 
use ELF.  The treatment of shared libraries is radically different.  I 
think at lot of the difference is really in the tools, but that's kinda 
academic.

Darwin has a single pass linker, so libraries must be listed in a 
particular order.  The linker hates multiple symbols.  The linker also 
hates undefined symbols, even in a dynamic library.  To really do 
things right, you must list all dependent libraries to the linker, even 
if it can walk the dependency tree itself.  Darwin does not have the 
concept of LD_LIBRARY_PATH in quite the same way that Linux does; 
rather you must give both the final installation path and temporary 
development path for each library when linking the lib.  The naming 
convention for libraries is different in Darwin such that the last 
string must be ".dylib".  Darwin also implements a "current version" 
and "compatible version" scheme in libraries so that programs will get 
link failures rather than erroneous execution.  I have no idea how to 
set this for GtkAda.  Maybe I shouldn't and let the library name do the 
trick.  Oh yeah, the reason that Apple's gcc does not like "-shared" is 
that flag is mostly for the linker.  Darwin has two different kinds of 
shared objects (bundles and dylibs).

I am further limited by the fact that while I mostly *use* Macs, my 
development targets are usually Solaris, Linux, and now Windows.  Any 
Mac development I do is for my own amusement (and to further my work at 
home desires).

IAC, I can now build dylibs against the darwinports version of 
everything and run testgtk.  However OpenGL and the GtkAda Canvas tests 
both fail causing the app to crash.  The glxgears test that comes with 
XFree86 runs great, so OpenGL works for some X11 programs.  The Canvas 
test just causes testgtk to end with "Bus Error", so I need to enable 
the debug build style.  Before I post the patch I will test on a linux 
system to make sure that it doesn't muck up everyone else.  I think 
that all Darwin specific changes are protected with makefile 
conditionals.

I hope to get some of these issues sorted out soon.  I get the sense 
that there is now a desire to spin a release that builds against GTK+ 
2.4.x, and since most Mac users are going to get that version I'd like 
to see GtkAda build out of the box as it were.  If necessary I could 
probably do a patchfile against a release tarball for a darwinports.

Cheers,
	Chris

-- 
Christopher Douty <Chris_Douty at ampexdata.com> +1-650-367-3129
Senior Engineer, Software & Systems  - AMPEX Data Systems Corp.




More information about the gtkada mailing list