Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Porting code generator to Android

57 views
Skip to first unread message

woodb...@gmail.com

unread,
Mar 12, 2019, 3:55:59 PM3/12/19
to
Shalom

https://www.reddit.com/r/cpp_questions/comments/b045qp/porting_code_generator_to_android/


I'd like to know what to do with Gradle to package it,
and how do you suggest I integrate the new files into my repo?
Thanks in advance.

Can anyone point me to a C++ repository that has an executable
that runs on Linux, Windows, and Android? I'm wondering
whether I should use ifdefs to merge everything into one file
or use separate files for Android.


Brian
Ebenezer Enterprises
http://webEbenezer.net

cda...@gmail.com

unread,
Mar 12, 2019, 5:54:32 PM3/12/19
to
I was always under the impression that Android was more like middleware. This is because I write and test programs on a 64 bit Windows machine. From there I can upload the app directly, via a USB cable, to my $89.99 32 bit MetroPCS phone that I bought by the liquor store. No additional software nor programming is needed to make this happen.

And as far as I know, this isn't possible with Linux running on Windows.

woodb...@gmail.com

unread,
Mar 12, 2019, 9:06:35 PM3/12/19
to
On Tuesday, March 12, 2019 at 4:54:32 PM UTC-5, cda...@gmail.com wrote:
> I was always under the impression that Android was more like middleware. This is because I write and test programs on a 64 bit Windows machine. From there I can upload the app directly, via a USB cable, to my $89.99 32 bit MetroPCS phone that I bought by the liquor store. No additional software nor programming is needed to make this happen.

Do you use Gradle? Do you have to do anything
to specify it will run on 32 bit system?

I used this to build a shard library:

g++ -shared -fPIC -std=c++17 -o libnative.so -I ../.. -I /home/brian/android-studio/jre/include/ -I /home/brian/android-studio/jre/include/linux/ genzMain.cc

I'm not sure if the -fPIC is needed. I just saw it on a site and used it.


Brian

cda...@gmail.com

unread,
Mar 12, 2019, 9:27:32 PM3/12/19
to
I use gradle. And in order for my app on 64 bit Windows Machine to run on my 32 bit phone, I had to enable virtualization in the CPU on my Windows machine.

David Brown

unread,
Mar 13, 2019, 3:58:09 AM3/13/19
to
On 12/03/2019 20:55, woodb...@gmail.com wrote:
> Shalom
>
> https://www.reddit.com/r/cpp_questions/comments/b045qp/porting_code_generator_to_android/
>

If I understand you correctly, you are trying to make the code generator
itself run on android? /Why/ ? No one would use Android as a host for
developing code. You cannot sanely use a pad or a telephone for C++
programming. People don't do it now, and they will not do it in the future.

I note you had a comment "I'm thinking about removing the cleanup stuff
that calls free() since the operating system should handle that." I'd
be wary about that - don't do it unless it is of significant benefit to
the clarity or maintainability of the code. (i.e., remove it if it gets
out of sync with new code that makes more allocations.) Removing it
will just cause confusion, static analyser warnings, and more errors if
the code is ported again.

Öö Tiib

unread,
Mar 13, 2019, 5:16:46 AM3/13/19
to
On Wednesday, 13 March 2019 09:58:09 UTC+2, David Brown wrote:
> On 12/03/2019 20:55, woodb...@gmail.com wrote:
> > Shalom
> >
> > https://www.reddit.com/r/cpp_questions/comments/b045qp/porting_code_generator_to_android/
> >
>
> If I understand you correctly, you are trying to make the code generator
> itself run on android? /Why/ ? No one would use Android as a host for
> developing code. You cannot sanely use a pad or a telephone for C++
> programming. People don't do it now, and they will not do it in the future.

Exactly. Everybody use Windows, Linux or Mac computers for programming
Android.
Also significant part of debugging is done using emulators on desktop
rather than real Android devices.
Besides, since he seemed to ask for same "executable" running on all those
environments ... then it can perhaps be asm.js or WebAssembly.
Pages related to Unity3D and Qt5 have examples and tutorials of
usage of C++ toolchains for those.

woodb...@gmail.com

unread,
Mar 13, 2019, 9:57:01 PM3/13/19
to
On Wednesday, March 13, 2019 at 2:58:09 AM UTC-5, David Brown wrote:
> On 12/03/2019 20:55, woodb...@gmail.com wrote:
> > Shalom
> >
> > https://www.reddit.com/r/cpp_questions/comments/b045qp/porting_code_generator_to_android/
> >
>
> If I understand you correctly, you are trying to make the code generator
> itself run on android?

My code generator only runs on FreeBSD and I don't
plan to change that at this time. But there's a
front end (that I linked to in the reddit post)
that I'm wanting to port to Android.

> /Why/ ? No one would use Android as a host for
> developing code. You cannot sanely use a pad or a telephone for C++
> programming. People don't do it now, and they will not do it in the future.

Some people are programming on their phones:
http://www.circuitbasics.com/programming-with-your-android-smartphone-the-tools-you-need/

I guess if you only have a small device available it could
be helpful. If it was really difficult to port it, I'd
probably skip it, but I don't think it will be that hard.


Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net


Martijn van Buul

unread,
Mar 14, 2019, 9:17:40 AM3/14/19
to
* David Brown:
> If I understand you correctly, you are trying to make the code generator
> itself run on android? /Why/ ? No one would use Android as a host for
> developing code. You cannot sanely use a pad or a telephone for C++
> programming. People don't do it now, and they will not do it in the future.

Which is a crying shame, and cause for much frustration - along with its
sibling statement "You cannot sanely use a Chromebook for C++ programming",
this has caused me to abandon programming for these platforms.

It may be pointless to develop on a phone - but my tablet had a very decent
keyboard, and a reasonably fast CPU at the time.

For ChromeOS, it is even worse. Google put PNaCl to rest, unfortunately, but
while it was young and hip you had a technology which was *only* available
on ChromeOS, but development could only be done cross-platform - unless
you went through hacky hoops go get a chrooted Linux going, at the cost
of very precious storage space and sub-par user experience.

--
Martijn van Buul - pi...@dohd.org

David Brown

unread,
Mar 14, 2019, 4:14:59 PM3/14/19
to
On 14/03/2019 14:17, Martijn van Buul wrote:
> * David Brown:
>> If I understand you correctly, you are trying to make the code generator
>> itself run on android? /Why/ ? No one would use Android as a host for
>> developing code. You cannot sanely use a pad or a telephone for C++
>> programming. People don't do it now, and they will not do it in the future.
>
> Which is a crying shame, and cause for much frustration - along with its
> sibling statement "You cannot sanely use a Chromebook for C++ programming",
> this has caused me to abandon programming for these platforms.
>
> It may be pointless to develop on a phone - but my tablet had a very decent
> keyboard, and a reasonably fast CPU at the time.

Very few tablets have a decent screen (for programming) or any kind of
keyboard at all. I have difficulty imagining anyone choosing to use
such a platform for serious development. (Occasional use for
emergencies is understandable - I've used my mobile to ssh to my work
computer and fix code a couple of times. But that was not development
on the mobile - it was using the mobile as a terminal to access the
development computer.)

Chromebooks are another matter, and could be used as well (or as badly)
as many other portables. Personally, I hate having to use a portable
for programming - I am spoiled by having two large 2560 x 1600 screens.
If I had a Chromebook and wanted to use it for programming, I'd wipe the
ChromeOS and install Linux.
0 new messages