comp.lang.ada
 help / color / mirror / Atom feed
* Current status of Ada development for an Android target ?
@ 2016-06-11 15:51 Simon Clubley
  2016-06-12  7:28 ` Luke A. Guest
                   ` (4 more replies)
  0 siblings, 5 replies; 31+ messages in thread
From: Simon Clubley @ 2016-06-11 15:51 UTC (permalink / raw)


What is the current status of freely available Ada development options
for an Android target ? I would really need a GMGPL type licence and
not a pure GPL licence for the runtime and the preferred development
platform would be Linux.

I've found GNATDroid but that appears to be a purely FreeBSD based
solution.

Thanks,

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-11 15:51 Current status of Ada development for an Android target ? Simon Clubley
@ 2016-06-12  7:28 ` Luke A. Guest
  2016-06-12  8:25 ` Luke A. Guest
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 31+ messages in thread
From: Luke A. Guest @ 2016-06-12  7:28 UTC (permalink / raw)


Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
> What is the current status of freely available Ada development options
> for an Android target ? I would really need a GMGPL type licence and
> not a pure GPL licence for the runtime and the preferred development
> platform would be Linux.
> 
> I've found GNATDroid but that appears to be a purely FreeBSD based
> solution.
> 
> Thanks,
> 
> Simon.
> 

When John ported gnat to android I did compile it on Linux, it required a
few patches, but that was ages ago now. I've been meaning on adding android
to me free-Ada scripts but haven't so far. I will look into it soon as I'm
working on Vulkan and want to get it to compile there too.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-11 15:51 Current status of Ada development for an Android target ? Simon Clubley
  2016-06-12  7:28 ` Luke A. Guest
@ 2016-06-12  8:25 ` Luke A. Guest
  2016-06-12  8:27 ` Luke A. Guest
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 31+ messages in thread
From: Luke A. Guest @ 2016-06-12  8:25 UTC (permalink / raw)


I'll take a look tonight and see what it looks like now.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-11 15:51 Current status of Ada development for an Android target ? Simon Clubley
  2016-06-12  7:28 ` Luke A. Guest
  2016-06-12  8:25 ` Luke A. Guest
@ 2016-06-12  8:27 ` Luke A. Guest
  2016-06-12 23:36   ` Simon Clubley
  2016-06-14 13:22 ` jrmarino
  2016-06-16 19:20 ` Lucretia
  4 siblings, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2016-06-12  8:27 UTC (permalink / raw)


Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
> What is the current status of freely available Ada development options
> for an Android target ? I would really need a GMGPL type licence and
> not a pure GPL licence for the runtime and the preferred development
> platform would be Linux.


Another thing that needs doing are bindings to the native android API and
also Ada->Java compiler with bindings generator which aren't distributed
under the GPL.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-12  8:27 ` Luke A. Guest
@ 2016-06-12 23:36   ` Simon Clubley
  2016-06-13  4:24     ` Shark8
  2016-06-13 13:49     ` Lucretia
  0 siblings, 2 replies; 31+ messages in thread
From: Simon Clubley @ 2016-06-12 23:36 UTC (permalink / raw)


On 2016-06-12, Luke A  Guest <laguest@archeia.com> wrote:
> Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
>> What is the current status of freely available Ada development options
>> for an Android target ? I would really need a GMGPL type licence and
>> not a pure GPL licence for the runtime and the preferred development
>> platform would be Linux.
>
>
> Another thing that needs doing are bindings to the native android API and
> also Ada->Java compiler with bindings generator which aren't distributed
> under the GPL.
>

Thanks Luke.

What's going on here is that I'm working on a personal project which
has a range of libraries and other code associated with it. I can see
myself reusing various parts of it on a range of targets in the future
including Android NDK applications.

For that reason I originally started writing it in pure C, but even
with some libraries I've written (such as a safer string library)
the C code is taking too long to write and there's way too much
boilerplate code and low level handling of things going on.

Given a good range of unknown future targets the next best logical
option for portability is to use C++ but my heart _really_ wants to
use Ada now that I've accepted I need to use a higher level language
for this project.

As such I am having a serious think about the Ada compiler situation
as it relates to the viability of Ada for various targets. BTW, I also
see the DragonEgg project is still dead (the frontend is still stalled
at LLVM 3.3 and gcc 4.6 for Ada; I really wish LLVM had a native Ada
front end so you could use the full range of LLVM targets.)

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-12 23:36   ` Simon Clubley
@ 2016-06-13  4:24     ` Shark8
  2016-06-13 13:49     ` Lucretia
  1 sibling, 0 replies; 31+ messages in thread
From: Shark8 @ 2016-06-13  4:24 UTC (permalink / raw)


On Sunday, June 12, 2016 at 5:36:19 PM UTC-6, Simon Clubley wrote:
> 
> As such I am having a serious think about the Ada compiler situation
> as it relates to the viability of Ada for various targets. BTW, I also
> see the DragonEgg project is still dead (the frontend is still stalled
> at LLVM 3.3 and gcc 4.6 for Ada; I really wish LLVM had a native Ada
> front end so you could use the full range of LLVM targets.)

I'm still working, albeit slowly after the HD-crash and subsequent upgrade to GNAT, on the Byron compiler project.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-12 23:36   ` Simon Clubley
  2016-06-13  4:24     ` Shark8
@ 2016-06-13 13:49     ` Lucretia
  2016-06-13 14:34       ` Lucretia
  1 sibling, 1 reply; 31+ messages in thread
From: Lucretia @ 2016-06-13 13:49 UTC (permalink / raw)


On Monday, 13 June 2016 00:36:19 UTC+1, Simon Clubley  wrote:
 
> What's going on here is that I'm working on a personal project which
> has a range of libraries and other code associated with it. I can see
> myself reusing various parts of it on a range of targets in the future
> including Android NDK applications.

Well, armv7-a/neon builds fine. mipsel doesn't failing because of a missing variable:

/home/laguest/src/mine/free-ada/tmp/android-mips/gcc/./gcc/xgcc -B/home/laguest/src/mine/free-ada/tmp/android-mips/gcc/./gcc/ -B/home/laguest/opt/test-android-gcc/mipsel-linux-androideabi/bin/ -B/home/laguest/opt/test-android-gcc/mipsel-linux-androideabi/lib/ -isystem /home/laguest/opt/test-android-gcc/mipsel-linux-androideabi/include -isystem /home/laguest/opt/test-android-gcc/mipsel-linux-androideabi/sys-include    -c -g -O2   -W -Wall -gnatpg -nostdinc   g-soccon.ads -o g-soccon.o
g-socket.ads:436:55: "MAX_tv_sec" not declared in "OS_Constants"
g-socket.ads:1171:58: "SIZEOF_fd_set" not declared in "OS_Constants"
../gcc-interface/Makefile:310: recipe for target 'g-soccon.o' failed


Looking at the source code, I can't see how it's not being defined:

/**
 ** On Solaris, field tv_sec in struct timeval has an undocumented
 ** hard-wired limit of 100 million.
 ** On IA64 HP-UX the limit is 2**31 - 1.
 **/
#if defined (sun)
# define MAX_tv_sec "100_000_000"

#elif defined (__hpux__)
# define MAX_tv_sec "16#7fffffff#"

#else
# define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1"
#endif
CNS(MAX_tv_sec, "")
}

(from s-oscons-tmplt.c)

 
> For that reason I originally started writing it in pure C, but even
> with some libraries I've written (such as a safer string library)
> the C code is taking too long to write and there's way too much
> boilerplate code and low level handling of things going on.
> 
> Given a good range of unknown future targets the next best logical
> option for portability is to use C++ but my heart _really_ wants to
> use Ada now that I've accepted I need to use a higher level language
> for this project.

I know what you mean.
 
> As such I am having a serious think about the Ada compiler situation
> as it relates to the viability of Ada for various targets. BTW, I also
> see the DragonEgg project is still dead (the frontend is still stalled
> at LLVM 3.3 and gcc 4.6 for Ada; I really wish LLVM had a native Ada
> front end so you could use the full range of LLVM targets.)

This is a major problem atm, both Google and Apple have deprecated GCC, I can see this happening more and more and LLVM doesn't have an Ada compiler. Getting GNAT onto LLVM would automatically open up these targets.

Luke.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-13 13:49     ` Lucretia
@ 2016-06-13 14:34       ` Lucretia
  0 siblings, 0 replies; 31+ messages in thread
From: Lucretia @ 2016-06-13 14:34 UTC (permalink / raw)


On Monday, 13 June 2016 14:49:34 UTC+1, Lucretia  wrote:
> #else
> # define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1"
> #endif
> CNS(MAX_tv_sec, "")
> }

Think I worked it out. Missing mips-android section from makefile, easily added.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-11 15:51 Current status of Ada development for an Android target ? Simon Clubley
                   ` (2 preceding siblings ...)
  2016-06-12  8:27 ` Luke A. Guest
@ 2016-06-14 13:22 ` jrmarino
  2016-06-14 18:39   ` Simon Clubley
  2016-06-16 19:20 ` Lucretia
  4 siblings, 1 reply; 31+ messages in thread
From: jrmarino @ 2016-06-14 13:22 UTC (permalink / raw)


On Saturday, June 11, 2016 at 5:51:43 PM UTC+2, Simon Clubley wrote:
> What is the current status of freely available Ada development options
> for an Android target ? I would really need a GMGPL type licence and
> not a pure GPL licence for the runtime and the preferred development
> platform would be Linux.
> 
> I've found GNATDroid but that appears to be a purely FreeBSD based
> solution.

Why is that a dealbreaker?

The title question is "Current status of Ada development for an Android target".  Since there's no host machine specification, the answer is, "it's been complete and maintained for many years".

What difference does the host machine for a cross-compiler when the executable is the product?  Run GnatDroid in a FreeBSD VM to compile the executable, problem solved.  You just need FreeBSD running long enough to compile the program/library which you then transfer to Android, unless I'm missing something.

Summary: you already have everything you want except your choice of host machines, which shouldn't be a dealbreaker.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-14 13:22 ` jrmarino
@ 2016-06-14 18:39   ` Simon Clubley
  2016-06-15  9:41     ` jrmarino
  2016-06-15 12:12     ` Luke A. Guest
  0 siblings, 2 replies; 31+ messages in thread
From: Simon Clubley @ 2016-06-14 18:39 UTC (permalink / raw)


On 2016-06-14, jrmarino <dragonlace.cla@marino.st> wrote:
> On Saturday, June 11, 2016 at 5:51:43 PM UTC+2, Simon Clubley wrote:
>> What is the current status of freely available Ada development options
>> for an Android target ? I would really need a GMGPL type licence and
>> not a pure GPL licence for the runtime and the preferred development
>> platform would be Linux.
>> 
>> I've found GNATDroid but that appears to be a purely FreeBSD based
>> solution.
>
> Why is that a dealbreaker?
>
> The title question is "Current status of Ada development for an
> Android target".  Since there's no host machine specification, the
> answer is, "it's been complete and maintained for many years".
>

The desired host machine is specified in the first paragraph; there's
only so much you can put in the subject line. :-)

> What difference does the host machine for a cross-compiler when the
> executable is the product?  Run GnatDroid in a FreeBSD VM to compile
> the executable, problem solved.  You just need FreeBSD running long
> enough to compile the program/library which you then transfer to
> Android, unless I'm missing something.
>

It's not just a one-off build of an existing package; I would need to
duplicate my full existing development environment on FreeBSD as I
would have to use FreeBSD to do the actual development as well.

It's certainly possible but not ideal when everything else I do is on
Linux. However, I would like to take this opportunity to thank you for
going to the effort of building the cross compiler in the first place.

Luke's observation about the general move to LLVM is also a good one
and I wonder what that is going to mean in, say, a couple of years time.

I'll think a bit more about my options.

Thanks to everyone,

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-14 18:39   ` Simon Clubley
@ 2016-06-15  9:41     ` jrmarino
  2016-06-15 13:11       ` Simon Clubley
  2016-06-15 12:12     ` Luke A. Guest
  1 sibling, 1 reply; 31+ messages in thread
From: jrmarino @ 2016-06-15  9:41 UTC (permalink / raw)


On Tuesday, June 14, 2016 at 8:39:13 PM UTC+2, Simon Clubley wrote:
> On 2016-06-14, jrmarino wrote: 
> It's not just a one-off build of an existing package; I would need to
> duplicate my full existing development environment on FreeBSD as I
> would have to use FreeBSD to do the actual development as well.

Why?
What's stopping you from developing where you want and using SCP/FTP/rsync/whatever to transfer files to FreeBSD VM and compiling as needed?

I'm guessing it's not "would have" but rather "in order to avoid this transfer step which may have to be performed many times in a try-check-correct dev cycle, it would be easier to move to FreeBSD".

By the way, did you realize FreeBSD and DragonFly has the most current and extensive Ada support of all the FOSS platforms?  Developing Ada on one of those isn't a bad thing.

> Luke's observation about the general move to LLVM is also a good one
> and I wonder what that is going to mean in, say, a couple of years time.

pipe dream.  We've been talking about this for six years already.  I did some work on it but stopped when I realized the payoff vs work imbalance plus the real motivation for it (which was primarily license, not tech, at the time).  Don't want for this; it's not happening.

John


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-14 18:39   ` Simon Clubley
  2016-06-15  9:41     ` jrmarino
@ 2016-06-15 12:12     ` Luke A. Guest
  2016-06-15 13:02       ` Simon Clubley
  1 sibling, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2016-06-15 12:12 UTC (permalink / raw)


Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:

> 
> It's certainly possible but not ideal when everything else I do is on
> Linux. However, I would like to take this opportunity to thank you for
> going to the effort of building the cross compiler in the first place.
> 
> Luke's observation about the general move to LLVM is also a good one
> and I wonder what that is going to mean in, say, a couple of years time.

I managed to build armv7-a, MIPS and x86 tool chains last night. I'll be
attempting the 64 bit versions next.

Then I'll test with the emulator but, I can't run the emulator because it
wants lspci and Gentoo hides this from normal users. Amy idea how I can get
this to work? This is the latest android studio, sdk and ndk, not the
android n preview.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-15 12:12     ` Luke A. Guest
@ 2016-06-15 13:02       ` Simon Clubley
  2016-06-15 13:13         ` Lucretia
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Clubley @ 2016-06-15 13:02 UTC (permalink / raw)


On 2016-06-15, Luke A  Guest <laguest@archeia.com> wrote:
>
> I managed to build armv7-a, MIPS and x86 tool chains last night. I'll be
> attempting the 64 bit versions next.
>
> Then I'll test with the emulator but, I can't run the emulator because it
> wants lspci and Gentoo hides this from normal users. Amy idea how I can get
> this to work? This is the latest android studio, sdk and ndk, not the
> android n preview.
>

I'm afraid not. I abandoned using the emulator shortly after I first
tried it because it was _way_ too slow for me; my Android development
workflow involves using adb to push the debug version directly onto
the device.

I also use one of the RHEL rebuilds for my development systems and
I don't remember ever encountering that problem when I did try the
emulator.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-15  9:41     ` jrmarino
@ 2016-06-15 13:11       ` Simon Clubley
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Clubley @ 2016-06-15 13:11 UTC (permalink / raw)


On 2016-06-15, jrmarino <dragonlace.cla@marino.st> wrote:
>
> I'm guessing it's not "would have" but rather "in order to avoid this
> transfer step which may have to be performed many times in a try-check-correct
> dev cycle, it would be easier to move to FreeBSD".
>

Yes, that's basically it.

> By the way, did you realize FreeBSD and DragonFly has the most current and
> extensive Ada support of all the FOSS platforms?  Developing Ada on one of
> those isn't a bad thing.
>

No I didn't. Looking at FreeBSD is on the list of things to do in the
future in case the Linux developers completely lose the plot, but I have
not got round to it yet.

>> Luke's observation about the general move to LLVM is also a good one
>> and I wonder what that is going to mean in, say, a couple of years time.
>
> pipe dream.  We've been talking about this for six years already.  I did some work on it but stopped when I realized the payoff vs work imbalance plus the real motivation for it (which was primarily license, not tech, at the time).  Don't want for this; it's not happening.
>

That wasn't what I was thinking.

At the moment, efforts like yours and Luke's are possible because someone
has added the basic backend support for the target to the existing gcc
toolchain.

Given the move to LLVM in some areas, what if new and potentially very
interesting targets come online over the next few years but people skip
directly to using LLVM for these targets and they never bother adding
the backend support to gcc ?

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-15 13:02       ` Simon Clubley
@ 2016-06-15 13:13         ` Lucretia
  0 siblings, 0 replies; 31+ messages in thread
From: Lucretia @ 2016-06-15 13:13 UTC (permalink / raw)


On Wednesday, 15 June 2016 14:02:52 UTC+1, Simon Clubley  wrote:

> I'm afraid not. I abandoned using the emulator shortly after I first
> tried it because it was _way_ too slow for me; my Android development
> workflow involves using adb to push the debug version directly onto
> the device.

The current version of the emulator now uses qemu/kvm to speed things up.

Luke.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-11 15:51 Current status of Ada development for an Android target ? Simon Clubley
                   ` (3 preceding siblings ...)
  2016-06-14 13:22 ` jrmarino
@ 2016-06-16 19:20 ` Lucretia
  2016-06-16 19:29   ` Simon Clubley
  4 siblings, 1 reply; 31+ messages in thread
From: Lucretia @ 2016-06-16 19:20 UTC (permalink / raw)


Just to update, the FSF GCC 4.9.2, 5.4.0 and 6.1.0 do not compile any of the 64 bit targets, they all fail. They are missing patches from Google and I don't think they will ever get passed upstream.


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-16 19:20 ` Lucretia
@ 2016-06-16 19:29   ` Simon Clubley
  2016-06-16 19:49     ` Luke A. Guest
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Clubley @ 2016-06-16 19:29 UTC (permalink / raw)


On 2016-06-16, Lucretia <laguest9000@googlemail.com> wrote:
> Just to update, the FSF GCC 4.9.2, 5.4.0 and 6.1.0 do not compile any of the 64 bit targets, they all fail. They are missing patches from Google and I don't think they will ever get passed upstream.

Thanks for the update Luke.

Simon.

PS: And thanks for looking.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Current status of Ada development for an Android target ?
  2016-06-16 19:29   ` Simon Clubley
@ 2016-06-16 19:49     ` Luke A. Guest
  2016-06-18 15:44       ` Ada and C++ in the same binary, was: " Simon Clubley
  0 siblings, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2016-06-16 19:49 UTC (permalink / raw)


Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
> On 2016-06-16, Lucretia <laguest9000@googlemail.com> wrote:
>> Just to update, the FSF GCC 4.9.2, 5.4.0 and 6.1.0 do not compile any of
>> the 64 bit targets, they all fail. They are missing patches from Google
>> and I don't think they will ever get passed upstream.
> 
> Thanks for the update Luke.
> 
> Simon.
> 
> PS: And thanks for looking.
> 

A quick way around this is I could build it based on the Google source
for4.9 and leave extracting the patches to spot to FSF for later. That
would work.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-16 19:49     ` Luke A. Guest
@ 2016-06-18 15:44       ` Simon Clubley
  2016-06-18 16:38         ` Simon Clubley
                           ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Simon Clubley @ 2016-06-18 15:44 UTC (permalink / raw)


On 2016-06-16, Luke A  Guest <laguest@archeia.com> wrote:
> Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
>> On 2016-06-16, Lucretia <laguest9000@googlemail.com> wrote:
>>> Just to update, the FSF GCC 4.9.2, 5.4.0 and 6.1.0 do not compile any of
>>> the 64 bit targets, they all fail. They are missing patches from Google
>>> and I don't think they will ever get passed upstream.
>> 
>> Thanks for the update Luke.
>> 
>> Simon.
>> 
>> PS: And thanks for looking.
>> 
>
> A quick way around this is I could build it based on the Google source
> for4.9 and leave extracting the patches to spot to FSF for later. That
> would work.
>

Thanks Luke, but please don't go to any special effort on my behalf.

Having thought about the situation, I'm getting nervous once again about
the "special" :-( situation around Ada compilers given that I'm not
sure where some of this code might be used in the future.

My current thinking (as of this morning :-)) is to maybe write the low
level stuff in C++ (which is the code more likely to be used elsewhere)
and to do the high level stuff in Ada.

The problem is that I don't have any experience combining C++ and Ada
code in the same binary; in the past, I've only ever called plain C code
from Ada.

Does anyone know of any issues combining C++ and Ada code in the same
binary when using gcc and binutils ? Are there any conflicts with
exceptions for example ?

The primary use of such binaries would be on a Linux x86 (and maybe
ARM) platform.

Thanks,

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-18 15:44       ` Ada and C++ in the same binary, was: " Simon Clubley
@ 2016-06-18 16:38         ` Simon Clubley
  2016-06-18 18:21         ` Luke A. Guest
  2016-06-18 18:24         ` Shark8
  2 siblings, 0 replies; 31+ messages in thread
From: Simon Clubley @ 2016-06-18 16:38 UTC (permalink / raw)


On 2016-06-18, Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
>
> Does anyone know of any issues combining C++ and Ada code in the same
> binary when using gcc and binutils ? Are there any conflicts with
> exceptions for example ?
>

BTW, assume I've read the "Building Mixed Ada and C++ Programs" section
in the GNAT User Guide.

The kind of thing I'm looking for are issues not covered in there or
things the manual says should work but do not actually work.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-18 15:44       ` Ada and C++ in the same binary, was: " Simon Clubley
  2016-06-18 16:38         ` Simon Clubley
@ 2016-06-18 18:21         ` Luke A. Guest
  2016-06-19 14:50           ` Simon Clubley
  2016-06-18 18:24         ` Shark8
  2 siblings, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2016-06-18 18:21 UTC (permalink / raw)


Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:

> Thanks Luke, but please don't go to any special effort on my behalf.

I had a go with google's compiler source on armv7-a, doesn't build. I have
an inkling that they've broken the Ada build machinery stuff on purpose.

> Having thought about the situation, I'm getting nervous once again about
> the "special" :-( situation around Ada compilers given that I'm not
> sure where some of this code might be used in the future.

It is a pain.

> 
> My current thinking (as of this morning :-)) is to maybe write the low
> level stuff in C++ (which is the code more likely to be used elsewhere)
> and to do the high level stuff in Ada.

You'll still require a compiler that can build it.

> The problem is that I don't have any experience combining C++ and Ada
> code in the same binary; in the past, I've only ever called plain C code
> from Ada.

Depends how you do it. It's tricky. You could use g++ as a generator but
you need to massage it by hand to get it to work. You could wrap the
classes by hand and flatten the API out to a bunch of C functions.

You could then wrap that API in Ada tagged types, which has its own issues
of you need to get an Ada tagged type back from the C++ side. As an
example, when I was attempting to wrap wxWidgets you can create a wxFrame
with a menu and status bar without needing to define Ada types for them. So
when you want to grab a status bar from the frame, you have to wrap the C++
pointer to the class you get back from the call in C with an Ada tagged
type that knows not to delete it on finalisation. The handling of these
things is the main issue with using proxy types.

Using the generator will be easier and faster but less portable to any
other future compilers, if any.


> Does anyone know of any issues combining C++ and Ada code in the same
> binary when using gcc and binutils ? Are there any conflicts with
> exceptions for example ?

The original non-working code for wxAda is on Tigris.

> The primary use of such binaries would be on a Linux x86 (and maybe
> ARM) platform.

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-18 15:44       ` Ada and C++ in the same binary, was: " Simon Clubley
  2016-06-18 16:38         ` Simon Clubley
  2016-06-18 18:21         ` Luke A. Guest
@ 2016-06-18 18:24         ` Shark8
  2016-06-19 15:00           ` Simon Clubley
  2 siblings, 1 reply; 31+ messages in thread
From: Shark8 @ 2016-06-18 18:24 UTC (permalink / raw)


On Saturday, June 18, 2016 at 9:44:37 AM UTC-6, Simon Clubley wrote:
> On 2016-06-16, Luke A  Guest wrote:
> > Simon Clubley wrote:
> >> On 2016-06-16, Lucretia wrote:
> >>> Just to update, the FSF GCC 4.9.2, 5.4.0 and 6.1.0 do not compile any of
> >>> the 64 bit targets, they all fail. They are missing patches from Google
> >>> and I don't think they will ever get passed upstream.
> >> 
> >> Thanks for the update Luke.
> >> 
> >> Simon.
> >> 
> >> PS: And thanks for looking.
> >> 
> >
> > A quick way around this is I could build it based on the Google source
> > for4.9 and leave extracting the patches to spot to FSF for later. That
> > would work.
> >
> 
> Thanks Luke, but please don't go to any special effort on my behalf.
> 
> Having thought about the situation, I'm getting nervous once again about
> the "special" :-( situation around Ada compilers given that I'm not
> sure where some of this code might be used in the future.

Well, hopefully Byron will help push the available options up a bit.
 
> My current thinking (as of this morning :-)) is to maybe write the low
> level stuff in C++ (which is the code more likely to be used elsewhere)
> and to do the high level stuff in Ada.

I think I understand what you're saying... but wouldn't that invite errors in the lower levels? I rather like the focus that Ada puts on correctness. (And SPARK is pretty nifty, too.)

> The problem is that I don't have any experience combining C++ and Ada
> code in the same binary; in the past, I've only ever called plain C code
> from Ada.

What about writing it all in Ada and providing an export interface to C++?


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-18 18:21         ` Luke A. Guest
@ 2016-06-19 14:50           ` Simon Clubley
  0 siblings, 0 replies; 31+ messages in thread
From: Simon Clubley @ 2016-06-19 14:50 UTC (permalink / raw)


On 2016-06-18, Luke A  Guest <laguest@archeia.com> wrote:
> Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
>
>> The problem is that I don't have any experience combining C++ and Ada
>> code in the same binary; in the past, I've only ever called plain C code
>> from Ada.
>
> Depends how you do it. It's tricky. You could use g++ as a generator but
> you need to massage it by hand to get it to work. You could wrap the
> classes by hand and flatten the API out to a bunch of C functions.
>

[snip]

Thanks for the ideas Luke; I've now pulled down the svn copy of wxAda.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-18 18:24         ` Shark8
@ 2016-06-19 15:00           ` Simon Clubley
  2016-06-19 15:32             ` Luke A. Guest
  2016-06-20 12:11             ` Jacob Sparre Andersen
  0 siblings, 2 replies; 31+ messages in thread
From: Simon Clubley @ 2016-06-19 15:00 UTC (permalink / raw)


On 2016-06-18, Shark8 <onewingedshark@gmail.com> wrote:
> On Saturday, June 18, 2016 at 9:44:37 AM UTC-6, Simon Clubley wrote:
>> 
>> Having thought about the situation, I'm getting nervous once again about
>> the "special" :-( situation around Ada compilers given that I'm not
>> sure where some of this code might be used in the future.
>
> Well, hopefully Byron will help push the available options up a bit.
>  
>> My current thinking (as of this morning :-)) is to maybe write the low
>> level stuff in C++ (which is the code more likely to be used elsewhere)
>> and to do the high level stuff in Ada.
>
> I think I understand what you're saying... but wouldn't that invite
> errors in the lower levels? I rather like the focus that Ada puts on
> correctness. (And SPARK is pretty nifty, too.)
>

I agree that's a concern but I'm writing some code with the possibility
in mind that some of it's going to be used in other projects on various
unknown targets in the future. That means I have to make language choices
based on what's likely to be available for those targets.

>> The problem is that I don't have any experience combining C++ and Ada
>> code in the same binary; in the past, I've only ever called plain C code
>> from Ada.
>
> What about writing it all in Ada and providing an export interface to C++?

The C++ idea is for the low level code which could be used elsewhere.
If I write that low level code in Ada then how do I port it to a target
which may not have an Ada compiler available for it ?

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-19 15:00           ` Simon Clubley
@ 2016-06-19 15:32             ` Luke A. Guest
  2016-06-19 17:52               ` Simon Clubley
  2016-06-20 12:11             ` Jacob Sparre Andersen
  1 sibling, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2016-06-19 15:32 UTC (permalink / raw)


Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:

>>> The problem is that I don't have any experience combining C++ and Ada
>>> code in the same binary; in the past, I've only ever called plain C code
>>> from Ada.
>> 
>> What about writing it all in Ada and providing an export interface to C++?
> 
> The C++ idea is for the low level code which could be used elsewhere.
> If I write that low level code in Ada then how do I port it to a target
> which may not have an Ada compiler available for it ?

Obviously, if GCC has a backend target done, getting Ada on it is generally
trivial bless it's got weird exception handling, I don't know when they did
it but they finally added arm specific eh.

In this specific case it would help to know which specific targets you
need. 

Luke




^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-19 15:32             ` Luke A. Guest
@ 2016-06-19 17:52               ` Simon Clubley
  2016-06-19 18:40                 ` Luke A. Guest
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Clubley @ 2016-06-19 17:52 UTC (permalink / raw)


On 2016-06-19, Luke A  Guest <laguest@archeia.com> wrote:
> Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
>
>>>> The problem is that I don't have any experience combining C++ and Ada
>>>> code in the same binary; in the past, I've only ever called plain C code
>>>> from Ada.
>>> 
>>> What about writing it all in Ada and providing an export interface to C++?
>> 
>> The C++ idea is for the low level code which could be used elsewhere.
>> If I write that low level code in Ada then how do I port it to a target
>> which may not have an Ada compiler available for it ?
>
> Obviously, if GCC has a backend target done, getting Ada on it is generally
> trivial bless it's got weird exception handling, I don't know when they did
> it but they finally added arm specific eh.
>
> In this specific case it would help to know which specific targets you
> need. 
>

I suppose in some ways that's at the core of the problem; I don't fully
know and I don't know what's going to be along in a couple of years
(both architecture and operating system wise) that I might want to use
some of this code with. My new project is initially Linux desktop based
but some of the lower level stuff is probably going to find it's way
into some embedded and portable applications.

Right now on my desk, I've got stuff with MIPS, AVR and ARM cores (both
Cortex M0/M4 class and A8 class as well as traditional ARM cores). I've
got stuff that's running a mixture of bare metal code, RTEMS and a bit
of Linux. (Because of various reasons, including the historical embedded
compiler situation, most of the above is running C code; Ada is more of
a desktop environment language for me at the moment). I've also got
Android devices that I am wanting to get more into as well.

The requirement to port parts of my new project to unknown future
targets is what originally drove me (reluctantly) initially down the
pure C path before I abandoned that idea as not viable. The next logical
step up is C++ (because it's probably going to be available on most of
the new targets C is) but I do prefer Ada.

However, having said all that, the immediate new target of interest
is Android which I've got a couple of future ideas for. One concern
however is with the potential closing of Android by moving away from
the AOSP (and potential internals changes) along with, as you pointed
out, the move to LLVM. As such I do wonder if gcc is going to be left
out in the cold on new Android versions.

BTW, thanks for asking that question. :-) Writing the above in a form
suitable for someone else to read has helped sort out some ideas in
my head. :-)

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-19 17:52               ` Simon Clubley
@ 2016-06-19 18:40                 ` Luke A. Guest
  2016-06-19 19:16                   ` Simon Clubley
  0 siblings, 1 reply; 31+ messages in thread
From: Luke A. Guest @ 2016-06-19 18:40 UTC (permalink / raw)


Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:

>> In this specific case it would help to know which specific targets you
>> need. 
>> 
> 
> I suppose in some ways that's at the core of the problem; I don't fully
> know and I don't know what's going to be along in a couple of years
> (both architecture and operating system wise) that I might want to use

You can only really target what's here for here, kind of 😏

> some of this code with. My new project is initially Linux desktop based

As in GUI? Another are Ada lacks.

> but some of the lower level stuff is probably going to find it's way
> into some embedded and portable applications.
> 
> Right now on my desk, I've got stuff with MIPS, AVR and ARM cores (both

Anything with Linux support will be one's that'll be the easiest to get
going.

> Cortex M0/M4 class and A8 class as well as traditional ARM cores). I've
> got stuff that's running a mixture of bare metal code, RTEMS and a bit

Also bare metal isn't hard compiler wise, but you'll need to decide what
runtime you want and you'll need to port the bits you need.

> of Linux. (Because of various reasons, including the historical embedded
> compiler situation, most of the above is running C code; Ada is more of
> a desktop environment language for me at the moment). I've also got
> Android devices that I am wanting to get more into as well.

I would like to the portability of Ada with SDLAda and my Vulkan bindings
across oses and devices, iOS will be the hardest -can't build a cross
compiler, binutils wont build ld for some reason picking a Linux ld!

> 
> The requirement to port parts of my new project to unknown future
> targets is what originally drove me (reluctantly) initially down the
> pure C path before I abandoned that idea as not viable. The next logical
> step up is C++ (because it's probably going to be available on most of
> the new targets C is) but I do prefer Ada.

Yeah I get that. But as long as the compiler supports CPU X then adding
gnat is trivialish. One problem is organisations like Leonardo who keep
their own tree and apply tons of patches but don't pass these back to FSF
so knowing what they've added is unknown and they don't tend to keep the
compilers other than the trendy set working there means it's nigh on
impossible to get gnat working.

> 
> However, having said all that, the immediate new target of interest
> is Android which I've got a couple of future ideas for. One concern
> however is with the potential closing of Android by moving away from

They've closed android source? Is this the new N stuff?

> the AOSP (and potential internals changes) along with, as you pointed
> out, the move to LLVM. As such I do wonder if gcc is going to be left
> out in the cold on new Android versions.

Like I mentioned, they've added s bunch of patches and I've only found a
few. The diff between their 4.9 and FSF 4.9.2 is huge. Not knowing what
they've applied to the code gen stuff is the hardest to work out, as in,
I'd it right or is FSF right?

Building a new compiler but tartar getting gnat in the meantime has been
something I've been thinking about for a long time now.

> 
> BTW, thanks for asking that question. :-) Writing the above in a form
> suitable for someone else to read has helped sort out some ideas in
> my head. :-)

 No probs


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-19 18:40                 ` Luke A. Guest
@ 2016-06-19 19:16                   ` Simon Clubley
  2016-06-19 20:32                     ` Luke A. Guest
  0 siblings, 1 reply; 31+ messages in thread
From: Simon Clubley @ 2016-06-19 19:16 UTC (permalink / raw)


On 2016-06-19, Luke A  Guest <laguest@archeia.com> wrote:
> Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
>> some of this code with. My new project is initially Linux desktop based
>
> As in GUI? Another are Ada lacks.
>

There will be a GUI component to the project, but current plans are to
use GTK for now.

>
>> 
>> However, having said all that, the immediate new target of interest
>> is Android which I've got a couple of future ideas for. One concern
>> however is with the potential closing of Android by moving away from
>
> They've closed android source? Is this the new N stuff?
>

This showed up on The Register earlier this month:

http://www.theregister.co.uk/2016/06/08/google_is_taking_android_proprietary_heres_how/

I'll let you decide how much to believe the analyst but it's certainly
got my attention.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-19 19:16                   ` Simon Clubley
@ 2016-06-19 20:32                     ` Luke A. Guest
  0 siblings, 0 replies; 31+ messages in thread
From: Luke A. Guest @ 2016-06-19 20:32 UTC (permalink / raw)


Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:

>> As in GUI? Another are Ada lacks.
>> 
> 
> There will be a GUI component to the project, but current plans are to
> use GTK for now.

GTK+ is unpleasant to use IMO, that's why I like wx, abstracts away the
awfulness, even if it is MFC like.

>> They've closed android source? Is this the new N stuff?
>> 
> 
> This showed up on The Register earlier this month:
> 
> http://www.theregister.co.uk/2016/06/08/google_is_taking_android_proprietary_heres_how/

Read the first bit, I'll finish it after work. 

> I'll let you decide how much to believe the analyst but it's certainly
> got my attention.

Certainly explains Samsung wanting to go with their Tizen OS.

If someone would pay me a fuckton of cash I'd be able to get a start on my
Ada microkernel based os 😎


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-19 15:00           ` Simon Clubley
  2016-06-19 15:32             ` Luke A. Guest
@ 2016-06-20 12:11             ` Jacob Sparre Andersen
  2016-06-20 14:28               ` Luke A. Guest
  1 sibling, 1 reply; 31+ messages in thread
From: Jacob Sparre Andersen @ 2016-06-20 12:11 UTC (permalink / raw)


Simon Clubley wrote:

> The C++ idea is for the low level code which could be used elsewhere.
> If I write that low level code in Ada then how do I port it to a
> target which may not have an Ada compiler available for it?

The expensive solution is to use AdaMagic, which compiles to C
(including run-time support).

But writing in C++ is expensive as well.

The difference is just when you pay the price.  With AdaMagic, you only
pay once you need to.

Greetings,

Jacob
-- 
"simply because no one had discovered a cure for the universe as a
 whole - or rather the only one that did exist had been abolished"


^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: Ada and C++ in the same binary, was: Re: Current status of Ada development for an Android target ?
  2016-06-20 12:11             ` Jacob Sparre Andersen
@ 2016-06-20 14:28               ` Luke A. Guest
  0 siblings, 0 replies; 31+ messages in thread
From: Luke A. Guest @ 2016-06-20 14:28 UTC (permalink / raw)


Jacob Sparre Andersen <jacob@jacob-sparre.dk> wrote:
> Simon Clubley wrote:
> 
>> The C++ idea is for the low level code which could be used elsewhere.
>> If I write that low level code in Ada then how do I port it to a
>> target which may not have an Ada compiler available for it?
> 
> The expensive solution is to use AdaMagic, which compiles to C
> (including run-time support).
> 
> But writing in C++ is expensive as well.
> 
> The difference is just when you pay the price.  With AdaMagic, you only
> pay once you need to.

That's not really an option though is it. There are numerous c and c++
compilers for various targets. Not true for Ada.


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2016-06-20 14:28 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-11 15:51 Current status of Ada development for an Android target ? Simon Clubley
2016-06-12  7:28 ` Luke A. Guest
2016-06-12  8:25 ` Luke A. Guest
2016-06-12  8:27 ` Luke A. Guest
2016-06-12 23:36   ` Simon Clubley
2016-06-13  4:24     ` Shark8
2016-06-13 13:49     ` Lucretia
2016-06-13 14:34       ` Lucretia
2016-06-14 13:22 ` jrmarino
2016-06-14 18:39   ` Simon Clubley
2016-06-15  9:41     ` jrmarino
2016-06-15 13:11       ` Simon Clubley
2016-06-15 12:12     ` Luke A. Guest
2016-06-15 13:02       ` Simon Clubley
2016-06-15 13:13         ` Lucretia
2016-06-16 19:20 ` Lucretia
2016-06-16 19:29   ` Simon Clubley
2016-06-16 19:49     ` Luke A. Guest
2016-06-18 15:44       ` Ada and C++ in the same binary, was: " Simon Clubley
2016-06-18 16:38         ` Simon Clubley
2016-06-18 18:21         ` Luke A. Guest
2016-06-19 14:50           ` Simon Clubley
2016-06-18 18:24         ` Shark8
2016-06-19 15:00           ` Simon Clubley
2016-06-19 15:32             ` Luke A. Guest
2016-06-19 17:52               ` Simon Clubley
2016-06-19 18:40                 ` Luke A. Guest
2016-06-19 19:16                   ` Simon Clubley
2016-06-19 20:32                     ` Luke A. Guest
2016-06-20 12:11             ` Jacob Sparre Andersen
2016-06-20 14:28               ` Luke A. Guest

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox