Building MinGW compilers and Detective work on Ada.Calendar bug

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Building MinGW compilers and Detective work on Ada.Calendar bug

David Gressett
I downloaded the compiler source package from Sourceforge -
the current 4.81-4  version and was (after fixing a few minor
glitches in my MinGW and msys configurations) was able to compile
the source - it took about 5 hours on my development computer.

I can see that there is a lot more to this package than there is
in a gcc source download directly from gcc general HQ. The makefile
structure does not only the basic build of the compilers, it also
does a lot of MinGW-specific package work.

My question is, how do I do a rebuild-and-install after doing a tweak
on the Ada libraries? I need to do keep unnecessary compilations to
a minimum - I certainly don't want to construct a local patch file and
then push it into a 5-hour rebuild that builds everything in the
entire source package every time I do a one-line tweak on the Ada
library source. I tried a "make bootstrap" in the bld subdirectory,
but that did not work.

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building MinGW compilers and Detective work on Ada.Calendar bug

Earnie Boyd
On Wed, Oct 30, 2013 at 6:40 PM, David Gressett
<[hidden email]> wrote:

> I downloaded the compiler source package from Sourceforge -
> the current 4.81-4  version and was (after fixing a few minor
> glitches in my MinGW and msys configurations) was able to compile
> the source - it took about 5 hours on my development computer.
>
> I can see that there is a lot more to this package than there is
> in a gcc source download directly from gcc general HQ. The makefile
> structure does not only the basic build of the compilers, it also
> does a lot of MinGW-specific package work.
>
> My question is, how do I do a rebuild-and-install after doing a tweak
> on the Ada libraries? I need to do keep unnecessary compilations to
> a minimum - I certainly don't want to construct a local patch file and
> then push it into a 5-hour rebuild that builds everything in the
> entire source package every time I do a one-line tweak on the Ada
> library source. I tried a "make bootstrap" in the bld subdirectory,
> but that did not work.

rm exec_compile
make compile

cd bld/gcc/ada
make install
cd -

If you need to back that out simply

mingw-get install --reinstall ada

--
Earnie
-- https://sites.google.com/site/earnieboyd

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building MinGW compilers and Detective work on Ada.Calendar bug

David Gressett
... snip ...

> rm exec_compile
> make compile
>
> cd bld/gcc/ada
> make install
> cd -
>
> If you need to back that out simply
>
> mingw-get install --reinstall ada

The compile worked; the install step did not; after I
go to bld/gcc/ada, "make install" produces this:

make: *** No rule to make target `install'.  Stop.

After I execute  "cd -" to get back to the previous directory, I can
do a make install, but that copies files from stg/*.

Everything in stg was built in my first 5-hour build; it
was not updated by the make compile. I'm guessing that I
need to remove at least one more exec_ dummy target file
and do a corresponding make for it in order to update stg.

I see an "exec_stage", so my guess is that I should do at least

rm exec_stage
make stage

Copying stuff from /stg does not take very long, so something
gets me to that point will do the job tha I need to do.


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building MinGW compilers and Detective work on Ada.Calendar bug

Earnie Boyd
On Thu, Oct 31, 2013 at 2:53 PM, David Gressett wrote:
>
> I see an "exec_stage", so my guess is that I should do at least
>
> rm exec_stage
> make stage
>

rm exec_stage exec_post_stage
make post_stage install

The stage target is a prerequisite to post_stage and will be completed
before the post_stage target completes.

--
Earnie
-- https://sites.google.com/site/earnieboyd

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Building MinGW compilers and Detective work on Ada.Calendar bug

David Gressett
>>
>> I see an "exec_stage", so my guess is that I should do at least
>>
>> rm exec_stage
>> make stage
>>

> rm exec_stage exec_post_stage
> make post_stage install

> The stage target is a prerequisite to post_stage and will be completed
> before the post_stage target completes.

I have found that the makefile structure rather aggressively
protects the source code from the diagnostic tinkering that
I am trying to do, but I believe that I have discovered the
problem with the Ada calendar routines. I have stuffed a patch
into the gcc-4.8.1.tar.bz2 source archive in the root level of
the compiler source directory and started the 5-hour build that
I hope will confirm my analysis.

About two hours into the build, I remembered that I had done
nothing about the _USE_32BIT_TIME_T definition that went into
the 4.8.1-4 release of the compilers. A search of the source
code directories turned up no trace of it, but a search of the
4.0.3-1 runtime source did, so I know that my search string is
correct. I'm guessing that _USE_32BIT_TIME_T was fed into the
build as an environment variable and that I'm OK, and I'm building
an Ada run-time library that does not have it defined, which is
what I want.

Here's the analysis that I'm trying to verify:

The Ada calendar routines define the Ada version of the time_t
type as

type time_t is range
         -(2 ** (Standard'Address_Size - Integer'(1))) ..
         +(2 ** (Standard'Address_Size - Integer'(1)) - 1);

The key item here is the Ada expression

Standard'Address_Size

The MinGW Ada compiler is a 32-bit compiler and this expression
evaluates to 32. The result is that the Ada time_t is a 32-bit
signed integer type. A value of this type is passed to the
C procedure __gnat_localtime_tzoff which is in a C file named
sysdep.c in tha Ada runtime source code directory.

In the C code, the receiving argument of this Ada time_t type
is a C time_t type, the first argument of __gnat_localtime_tzoff,
declared as:

const time_t *timer

This is where the trouble starts. When the C time_t is a 64-bit
type, the value passed into __gnat_localtime_tzoff contains the
Ada time_t value as 32bits of a 64-bit value, and the other 32
bits are nonsense.

In short, the Ada runtime library code is assuming that Ada
Standard'Address_Size and C sizeof(time_t) are always the same
value. The V4 release of the MinGW runtime has broken that assumption.






------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe