Active Topics

 



Notices


Reply
Thread Tools
Posts: 14 | Thanked: 36 times | Joined on Dec 2009 @ Adelaide, Australia
#1
Further to my previous thread about GCC 4.9, I've now built a GCC 5 toolchain which runs on Debian Jessie x86_64 and builds binaries for Maemo Diablo. The goal is still the same as my GCC 4.9 toolchain - allow a modern C++ toolchain to be used to build binaries which run on the stock Diablo OS.

With this update, I'm providing the rootstrap in a separate package to the compiler. There's also an additional package to make it easy to install additional development packages into the rootstrap.

Here's a quick walkthrough describing how to get started with this toolchain. First we'll install the compiler and make a trivial "Hello world" console program. Then we'll install gtkmm development libraries, and build a minimal gtkmm program. Familiarity with GCC, C++, make and apt-get is assumed.

1. Add the repository and install GCC.

Add a new apt source with the following repository:

Code:
$ cat /etc/apt/sources.list.d/diablo-hacking.list
deb http://www.users.on.net/~toojays/maemo-development/jessie/ /
deb-src http://www.users.on.net/~toojays/maemo-development/jessie/ /
Then install diablo-gcc-5 (sorry, these packages aren't signed):

Code:
$ sudo apt-get install diablo-gcc-5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  diablo-root libgmp10 libmpc3 libmpfr4
Suggested packages:
  diablo-package-tools
The following NEW packages will be installed:
  diablo-gcc-5 diablo-root libgmp10 libmpc3 libmpfr4
0 upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
Need to get 116 MB of archives.
After this operation, 604 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
  diablo-root diablo-gcc-5
Install these packages without verification? [y/N] y
...
2. Quick compiler sanity check.

The compiler installs under /opt/diablo/gcc-5/bin, and the binary names are all prefixed with arm-none-linux-gnueabi-. Let's compile a trivial program just to check that we can make working binaries.

Code:
$ cat hello.cpp 
#include <iostream>

int main ()
{
  std::cout << "Hello World! (built with compiler version " << __VERSION__ << ")\n";
  return 0;
}

$ /opt/diablo/gcc-5/bin/arm-none-linux-gnueabi-g++ hello.cpp -o hello
$ file hello
hello: ELF 32-bit LSB executable, ARM, EABI4 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.8, not stripped
Running this binary on your N800 should result in the following output:
Code:
Nokia-N800-23-14:~# ./hello
Hello World! (built with compiler version 5.1.0)
3. Install Diablo -devel packages in the sysroot.

The diablo-root package (which was installed as a pre-requisite when we installed diablo-gcc-5) contains a development sysroot, installed at /opt/diablo/root. Initially this only contains the very basics - the standard C and C++ libraries. To compile a graphical application, we're going to need more development libraries.

I've made a diablo-package-tools package which helps here. This package contains versions of apt-get and dpkg which can be used to install Diablo packages into our sysroot.

Code:
$ sudo apt-get install diablo-package-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  diablo-package-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 311 kB of archives.
After this operation, 1150 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  diablo-package-tools
Install these packages without verification? [y/N] y
...
This package installs an apt-get wrapper at /opt/diablo/bin. This leverages the host system's copy of apt-get, but with a special configuration file which causes it to use the apt database in the sysroot. A special version of dpkg is used, which a) allows armel packages to be installed, even though our host is x86_64; and b) doesn't run any package maintainer script (e.g. preinst, postrm). The package maintainer scripts tend not to work outside of a scratchbox, but since we just want the shared libraries to link against, we can live without them.

Let's install the gtkmm development packages into our sysroot:

Code:
$ sudo /opt/diablo/bin/apt-get update
...
$ sudo /opt/diablo/bin/apt-get install libgtkmm-2.4-dev                 
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  dbus fontconfig gconf2 gtk20-l10n libatk1.0-0 libatk1.0-dev libcairo2 libcairo2-dev libcairomm-1.0-1 libcairomm-1.0-dev libdbus-1-3
  libdbus-glib-1-2 libexpat1 libexpat1-dev libfontconfig1 libfontconfig1-dev libfreetype6 libfreetype6-dev libgconf2-6 libglib2.0-0
  libglib2.0-data libglib2.0-dev libglibmm-2.4-1c2a libglibmm-2.4-dev libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libgtk2.0-dev
  libgtkmm-2.4-1c2a libice-dev libice6 libjpeg62 libpango1.0-0 libpango1.0-common libpango1.0-dev libpng12-0 libpng12-dev
  libsigc++-2.0-0c2a libsigc++-2.0-dev libsm-dev libsm6 libtiff4 libx11-6 libx11-data libx11-dev libxau-dev libxau6 libxcursor1
  libxdmcp-dev libxdmcp6 libxext-dev libxext6 libxfixes3 libxft-dev libxft2 libxi6 libxml2 libxrandr2 libxrender-dev libxrender1 libxtst6
  pkg-config sgml-base x11-common x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-render-dev x11proto-xext-dev xml-core
  xtrans-dev zlib1g-dev
Suggested packages:
  libcairo2-doc libcairomm-1.0-doc libglib2.0-doc libgtkmm-2.4-doc libgtk2.0-doc ttf-kochi-gothic ttf-kochi-mincho ttf-thryomanes
  ttf-baekmuk ttf-arphic-gbsn00lp ttf-arphic-bsmi00lp ttf-arphic-gkai00mp ttf-arphic-bkai00mp libpango1.0-doc libsigc++-2.0-doc
  libgnome-dev sgml-base-doc
Recommended packages:
  libatk1.0-data x-ttcidfont-conf
The following NEW packages will be installed:
  dbus fontconfig gconf2 gtk20-l10n libatk1.0-0 libatk1.0-dev libcairo2 libcairo2-dev libcairomm-1.0-1 libcairomm-1.0-dev libdbus-1-3
  libdbus-glib-1-2 libexpat1 libexpat1-dev libfontconfig1 libfontconfig1-dev libfreetype6 libfreetype6-dev libgconf2-6 libglib2.0-0
  libglib2.0-data libglib2.0-dev libglibmm-2.4-1c2a libglibmm-2.4-dev libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libgtk2.0-dev
  libgtkmm-2.4-1c2a libgtkmm-2.4-dev libice-dev libice6 libjpeg62 libpango1.0-0 libpango1.0-common libpango1.0-dev libpng12-0
  libpng12-dev libsigc++-2.0-0c2a libsigc++-2.0-dev libsm-dev libsm6 libtiff4 libx11-6 libx11-data libx11-dev libxau-dev libxau6
  libxcursor1 libxdmcp-dev libxdmcp6 libxext-dev libxext6 libxfixes3 libxft-dev libxft2 libxi6 libxml2 libxrandr2 libxrender-dev
  libxrender1 libxtst6 pkg-config sgml-base x11-common x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-render-dev
  x11proto-xext-dev xml-core xtrans-dev zlib1g-dev
0 upgraded, 73 newly installed, 0 to remove and 2 not upgraded.
Need to get 23.0 MB of archives.
After this operation, 73.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
  x11-common libice6 x11proto-core-dev libice-dev libsm6 libsm-dev libxau6 libxdmcp6 libx11-data libx11-6 libxau-dev libxdmcp-dev
  x11proto-input-dev x11proto-kb-dev xtrans-dev libx11-dev libxext6 x11proto-xext-dev libxext-dev libxfixes3 libexpat1 libfreetype6
  libfontconfig1 libxrender1 libxft2 zlib1g-dev libfreetype6-dev libexpat1-dev libfontconfig1-dev x11proto-render-dev libxrender-dev
  libxft-dev libdbus-1-3 dbus libglib2.0-0 libdbus-glib-1-2 libxml2 libgconf2-6 gconf2 fontconfig gtk20-l10n libatk1.0-0 pkg-config
  libglib2.0-dev libatk1.0-dev libpng12-0 libcairo2 libpng12-dev libcairo2-dev libcairomm-1.0-1 libcairomm-1.0-dev libglib2.0-data
  libsigc++-2.0-0c2a libglibmm-2.4-1c2a libsigc++-2.0-dev libglibmm-2.4-dev libgtk2.0-common libpango1.0-common libpango1.0-0 libxcursor1
  libxi6 libxrandr2 libxtst6 libgtk2.0-bin libjpeg62 libtiff4 libgtk2.0-0 libpango1.0-dev libgtk2.0-dev libgtkmm-2.4-1c2a
  libgtkmm-2.4-dev sgml-base xml-core
Install these packages without verification? [y/N] y
...
4. Build a simple gtkmm example.

For the purpose of the next example, you need pkg-config and make installed on your host system. Use apt-get to install those if you don't already have them.

This is about the simplest gtkmm program which does something:

Code:
$ cat simple.cpp 
#include <gtkmm/button.h>
#include <gtkmm/main.h>
#include <gtkmm/window.h>

class Window : public Gtk::Window
{
 private:
  Gtk::Button m_goodbye_button;

 public:
  Window () : m_goodbye_button("Goodbye!")
  {
    set_title("Hello World!");
    add(m_goodbye_button);
    m_goodbye_button.signal_clicked().connect([](){Gtk::Main::quit();});
    show_all_children();
  }

};

int main(int argc, char** argv)
{
  Gtk::Main kit(argc, argv);

  Window helloworld;
  Gtk::Main::run(helloworld);

  return 0;
}
and here's a Makefile which builds it:

Code:
$ cat Makefile 
CXX := /opt/diablo/gcc-5/bin/arm-none-linux-gnueabi-g++
CXXFLAGS := -std=c++11 -Os

# Tell pkg-config to look in our Diablo sysroot.
PKG_CONFIG := PKG_CONFIG_LIBDIR=/opt/diablo/root/usr/lib/pkgconfig \
              PKG_CONFIG_SYSROOT_DIR=/opt/diablo/root pkg-config

CXXFLAGS += $(shell $(PKG_CONFIG) gtkmm-2.4 --cflags)
LDLIBS := $(shell $(PKG_CONFIG) gtkmm-2.4 --libs)

# gtkmm-2.4 uses auto_ptr, which is deprecated in C++11.
# Silence warnings about that.
CXXFLAGS += -Wno-deprecated-declarations

# GCC complains that libsigc++-2.0 keeps changing the meaning of
# slot_list.  The following flag downgrades that error to a warning. An
# alternate solution is to comment out the line about
# SIGC_TYPEDEF_REDEFINE_ALLOWED in
# /opt/diablo/root/usr/include/sigc++-2.0/sigc++/signal.h. That has the
# benefit of eliminating the error/warning altogether.
CXXFLAGS += -fpermissive

simple: simple.o
	$(CXX) -o $@ $^ $(LDLIBS)

clean:
	-rm -f simple simple.o

.PHONY: clean
Running make will compile simple, which you can copy to your N800 and run, provided you have installed the libgtkmm-2.4 package.

A future improvement to this toolchain would be to integrate it with tools for creating deb packages which can be installed on the N800.

For now, I'm happy with being able to compile C++11 binaries and not having to mess around with scratchbox. I'd be interested to know if this toolchain is useful to anyone else.
 

The Following 10 Users Say Thank You to toojays For This Useful Post:
endsormeans's Avatar
Posts: 1,911 | Thanked: 4,395 times | Joined on Feb 2013 @ Supa Natural Vancouver Island
#2
Useful?
Simply put..
This is fabulous...
I can't wait to mess with it.
__________________
Lurker since 2007, Member since 2013, Certifiable since 1972
Owner of : 1-n770 (in retirement),
3-n800's,
3-n810's,
5-n900's
-3 flawless
-1 loose usb (i don't muck with it & stress it , considering selling it, another can fix the loose usb)
-1 no telephony (perfect for permanent set-up as mini-pc with one of my monitors)
half a neo900 pre- "bought"....due for production any day now.


PIMP MY N8X0
Everything you need tightly explained in layman's terms ..in an easy to understand format.. and a video walkthrough to boot.
http://talk.maemo.org/showthread.php?t=94294
THE LOST GRONMAYER CATALOGS
http://talk.maemo.org/showthread.php...ight=gronmayer
N8X0 VIDEO ENCODING THE EASY WAY
http://talk.maemo.org/showthread.php...ght=mediacoder
242gb ON N800
http://talk.maemo.org/showthread.php?t=90634

THE PAIN-FREE MAEMO DEVELOPMENT LIVE DISTRO-ISO FOR THE NOOB TO THE PRO
http://talk.maemo.org/showthread.php?t=95567

AFFORDABLE MASS PRODUCTION FOR MAEMO PARTS
http://talk.maemo.org/showthread.php?t=93325
 

The Following User Says Thank You to endsormeans For This Useful Post:
Posts: 17 | Thanked: 25 times | Joined on Sep 2009 @ offshore UK
#3
Yay! something new to play with Thankyou toojays!
 

The Following 2 Users Say Thank You to vectis For This Useful Post:
endsormeans's Avatar
Posts: 1,911 | Thanked: 4,395 times | Joined on Feb 2013 @ Supa Natural Vancouver Island
#4
Toojays..
I think what you are doing is brilliant.
Anything that doesn't deal with scratch is grand in my books.
My only prob. is ...I'm a carver/ painter/ graphic artist ...so my brain is more geared to a graphical interface than text..
Whatever you can come up with to integrate as many goodies for jessie ...the better. Really truly...
(As an aside; If only there was someone doing development on the 770 ...it would make things easier for me..)

At present I have your fabulous work here installed and running on (one of my) LMDE2Betsy x64 Mate distros I'm using ..
I was going to have simply 1 distro with everything for the 770, 8x0, and 900 ..but it is just too much for a live distributable iso.
So I've got 3 separate Betsy's running with devel. enviros in varying states (so far)
And I am looking into other methods as well of running without scratch...
I'd prefer to have scratchless development if possible for us all...
consequently I have done some digging..because I remembered seeing something very specific..after hunting..found this:
http://rbelem.info/2010/01/14/maemo-...ut-scratchbox/
haven't tried it yet for fremantle..it has been 5 years since this post....hopefully it ends up being snarl-free.
If it is feasible to adapt instructions to diablo and bora (for 770 hacker edition 2007) then this would be a huge headache gone.

Anyway ..tell me what you think..regarding all the muddle I've mentioned above.
If you aren't interested in doing anymore (now or in the future) such work as you've done here ..cause you have had enough..just let me know and I'll make sure not to hold back any live distributable iso's waiting for more goodies from you to pack it with...
__________________
Lurker since 2007, Member since 2013, Certifiable since 1972
Owner of : 1-n770 (in retirement),
3-n800's,
3-n810's,
5-n900's
-3 flawless
-1 loose usb (i don't muck with it & stress it , considering selling it, another can fix the loose usb)
-1 no telephony (perfect for permanent set-up as mini-pc with one of my monitors)
half a neo900 pre- "bought"....due for production any day now.


PIMP MY N8X0
Everything you need tightly explained in layman's terms ..in an easy to understand format.. and a video walkthrough to boot.
http://talk.maemo.org/showthread.php?t=94294
THE LOST GRONMAYER CATALOGS
http://talk.maemo.org/showthread.php...ight=gronmayer
N8X0 VIDEO ENCODING THE EASY WAY
http://talk.maemo.org/showthread.php...ght=mediacoder
242gb ON N800
http://talk.maemo.org/showthread.php?t=90634

THE PAIN-FREE MAEMO DEVELOPMENT LIVE DISTRO-ISO FOR THE NOOB TO THE PRO
http://talk.maemo.org/showthread.php?t=95567

AFFORDABLE MASS PRODUCTION FOR MAEMO PARTS
http://talk.maemo.org/showthread.php?t=93325

Last edited by endsormeans; 2015-05-19 at 18:10.
 

The Following User Says Thank You to endsormeans For This Useful Post:
Posts: 14 | Thanked: 36 times | Joined on Dec 2009 @ Adelaide, Australia
#5
Originally Posted by endsormeans View Post
I'd prefer to have scratchless development if possible for us all...
consequently I have done some digging..because I remembered seeing something very specific..after hunting..found this:
http://rbelem.info/2010/01/14/maemo-...ut-scratchbox/
haven't tried it yet for fremantle..it has been 5 years since this post....hopefully it ends up being snarl-free.
If it is feasible to adapt instructions to diablo and bora (for 770 hacker edition 2007) then this would be a huge headache gone.
What do you want to do with this environment? Actually run graphical applications? Or just build packages?

I tried something similar about a year ago. schroot makes some of this easier. I couldn't get the graphical environment to come up because of dbus problems. However, the blog post you reference bind-mounts /var/lib/dbus into the schroot. I'm pretty sure I didn't do that. So that may make the difference.

However, even if this works, don't we run into the problem where modern Xephyr doesn't work for us? I forget the detail, but last time I tried to run a maemo app on my x86 box I needed to run Xephyr in an ancient Ubuntu VM. Do you have a solution for that problem?
 
endsormeans's Avatar
Posts: 1,911 | Thanked: 4,395 times | Joined on Feb 2013 @ Supa Natural Vancouver Island
#6
yeah ..I have noticed that current xephyr is an issue...
...I've been trying to "think round corners" (so-to-speak) lately ...
on a few things...that being one...

from my pov...
whatever we can do to get past that "ancient" (ubuntu vm) wall as you so aptly put it...
to bring maemo development into the present ..(if at all possible)..in whatever ways we can.
I don't think any ideas or methods should be off the table.
since anything that works, partially works, or doesn't..
may work.. if approached in a different way..applied in a different fashion
your new jessie toolchain is a fabulous improvement .
New approaches, new ideas are welcome
Worst case we just end up with some live distributable rolling-release iso's ..
containing vmbox'd ...
antiquated 'buntu os...
containing scratch...
containing sdk's...
containing everything we need...
which is truly a great amount of bloody luggage to carry around...
like a freakin' Ukrainian doll-within-a-doll-within-a-doll...etc.
It's getting ridiculous.
(qtsdk 1.1.1 is a superb, elegant and sublime piece of work in compare...but that was done by team(s), a company, money, and a decade of work leading up to it...behind them)
So yeah...the more I look at the picture I'm dealing with...(and actually we all are dealing with) ...particularly concerning making thing easier, simpler, more current and updatable...the more I'm looking at obtuse and oblique methods of approach to reach that goal.

In short you could say..
I'm " wingin' " it in a squirrel-suit ..
that the disgruntled -ex I dumped years ago...
sewed for me last night ...
off too-short a building ..
I'm not sure how anything is going to turn out. or if it's going to turn into anything I was aiming at in the first place.
One thing that is a certainty...
I will land on the ground...
well "land" may be a generous word.
__________________
Lurker since 2007, Member since 2013, Certifiable since 1972
Owner of : 1-n770 (in retirement),
3-n800's,
3-n810's,
5-n900's
-3 flawless
-1 loose usb (i don't muck with it & stress it , considering selling it, another can fix the loose usb)
-1 no telephony (perfect for permanent set-up as mini-pc with one of my monitors)
half a neo900 pre- "bought"....due for production any day now.


PIMP MY N8X0
Everything you need tightly explained in layman's terms ..in an easy to understand format.. and a video walkthrough to boot.
http://talk.maemo.org/showthread.php?t=94294
THE LOST GRONMAYER CATALOGS
http://talk.maemo.org/showthread.php...ight=gronmayer
N8X0 VIDEO ENCODING THE EASY WAY
http://talk.maemo.org/showthread.php...ght=mediacoder
242gb ON N800
http://talk.maemo.org/showthread.php?t=90634

THE PAIN-FREE MAEMO DEVELOPMENT LIVE DISTRO-ISO FOR THE NOOB TO THE PRO
http://talk.maemo.org/showthread.php?t=95567

AFFORDABLE MASS PRODUCTION FOR MAEMO PARTS
http://talk.maemo.org/showthread.php?t=93325

Last edited by endsormeans; 2015-05-21 at 15:22.
 
Posts: 17 | Thanked: 25 times | Joined on Sep 2009 @ offshore UK
#7
What do you want to do with this environment? Actually run graphical applications? Or just build packages?
I'd be happy with being able to build packages, using scratchbox is a total pain!
 

The Following User Says Thank You to vectis For This Useful Post:
Posts: 17 | Thanked: 25 times | Joined on Sep 2009 @ offshore UK
#8
Why do you need to use an ancient version of Ubuntu? I'm sure the last time I used scratchbox it was with Debian LXDE, which isn't so ancient. The only problem I had was that it had to run on a 32bit setup.
 

The Following User Says Thank You to vectis For This Useful Post:
endsormeans's Avatar
Posts: 1,911 | Thanked: 4,395 times | Joined on Feb 2013 @ Supa Natural Vancouver Island
#9
lxde works...yup.
I'm working on LMDE2Betsy getting the kinks out and packing it up and turning it into a click and go live distributable rolling release with everything preinstalled...that way it can simply be updated instead of ditched in a few years due to cyclical releases...
__________________
Lurker since 2007, Member since 2013, Certifiable since 1972
Owner of : 1-n770 (in retirement),
3-n800's,
3-n810's,
5-n900's
-3 flawless
-1 loose usb (i don't muck with it & stress it , considering selling it, another can fix the loose usb)
-1 no telephony (perfect for permanent set-up as mini-pc with one of my monitors)
half a neo900 pre- "bought"....due for production any day now.


PIMP MY N8X0
Everything you need tightly explained in layman's terms ..in an easy to understand format.. and a video walkthrough to boot.
http://talk.maemo.org/showthread.php?t=94294
THE LOST GRONMAYER CATALOGS
http://talk.maemo.org/showthread.php...ight=gronmayer
N8X0 VIDEO ENCODING THE EASY WAY
http://talk.maemo.org/showthread.php...ght=mediacoder
242gb ON N800
http://talk.maemo.org/showthread.php?t=90634

THE PAIN-FREE MAEMO DEVELOPMENT LIVE DISTRO-ISO FOR THE NOOB TO THE PRO
http://talk.maemo.org/showthread.php?t=95567

AFFORDABLE MASS PRODUCTION FOR MAEMO PARTS
http://talk.maemo.org/showthread.php?t=93325
 
Reply

Tags
gcc-5, maemo 4

Thread Tools

 
Forum Jump


All times are GMT. The time now is 01:17.