[AWS] AWS on Mac OS X

John B. Matthews trashgod at gmail.com
Fri Oct 26 05:27:43 CEST 2007


On Oct 25, 2007, at 4:27 PM, Pascal Obry wrote:

> John,
>
>> I've made some progress in building shared libraries for AWS on Mac
>> OS X 10.4.10 using GNAT 4.3. As expected, the typical (unstriped)
>> binary went from nearly 4MB to under 70KB. Several problems arose,
>> and the proposed solutions require further refinement. As the matter
>> interests both groups, I have taken the liberty of cross-posting. I
>> would welcome discussion:
>>
>> 0. Set SHARED = true in makefile.conf.
>>
>> 1. Set SOEXT = .dylib for Darwin in makefile. [diff below]
>
> This is not integrated.

SOEXT is used by include/zlib/makefile. Without this, I don't see how  
the install target can work when SHARED is true. Is there a better  
approach?

>> 2. The gcc option -fno-common is required. I put it in the Compiler's
>> Global_Options in shared.gpr. I don't yet understand .gpr well enough
>> to special case Darwin; can anyone offer guidance? [diff below]
>
> Integrated.
>
> I have added a new OS type for Darwin.
>
>    type OS_Type is ("UNIX", "Windows_NT", "Darwin");
>    OS : OS_Type := external ("OS", "UNIX");
>
> Then in package Compiler, I have added the -fno-common option for  
> Darwin.
>
>       case OS is
>          when "Darwin" =>
>             for Default_Switches ("Ada")
>               use Compiler'Default_Switches ("Ada") & ("-fno-common");
>          when others =>
>             null;
>       end case;
>
> It means that to build on Darwin you have to set OS to Darwin:
>
>    $ make OS=Darwin ...

Excellent! Unfortunately, when building zlib, this switch fails to be  
propagated to include/include.gpr, which uses Shared.Global_Options  
explicitly.

>> 3. At several points, I had to manually copy the shared libs from the
>> obj directory (where they had been built) to the corresponding lib
>> directory:
>>
>> cp .build/release/ssl/obj/libaws_ssl.dylib .build/release/ssl/lib/.
>> cp .build/release/include/obj/libaws_include.dylib .build/release/
>> include/lib/.
>> cp .build/release/obj/libaws.dylib .build/release/lib/.
>
> Probably worth a report to AdaCore. Looks like the .dylib are not
> properly copied as it is done for .so and .dll!

I wondered how this was happening for .so & .dll!

[...]

> Thanks for your feedbacks on building AWS on Darwin.

Thanks for your guidance,

John


More information about the AWS mailing list