Hi,
I am Marc-Andre from the FreeRDP project, an open source RDP client. I want to work on optimizing FreeRDP for ARM using the NEON processor extensions.
The main computer is running Ubuntu 11.04 64-bit, while the target system is a pandaboard running Ubuntu 11.04 for ARM. I started looking into linaro because it aims at improving the current set of development tools for ARM, and I like where the project is going. Once I will have figured out how to get started, I will document the procedure specific to cross-compiling FreeRDP and redirect developers to it. It is my first time cross-compiling, so thank you for your understanding.
I have asked some questions on IRC, and read various pages from the wiki, but I haven't managed to successfully cross-compile FreeRDP yet. Compiling directly on the pandaboard works, but it is atrociously slow. I have made a chroot environment following and adapting the instructions from the following wiki page: https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/UsingXdeb
I took notes while setting up my chroot environment, such that I could use those notes later on for a wiki article:
# bootstrap ubuntu natty sudo debootstrap natty natty-armel
# chroot to new environment sudo chroot natty-armel
# mount partitions mount -t proc proc /proc mount -t devpts none /dev/pts
# export environment variables export LC_ALL=C
# append "universe" after "main" in sources.list sed -i 's/main/main universe/' /etc/apt/sources.list
# add source repository sudo echo "deb [arch=armel] http://ports.ubuntu.com/ natty main universe" >> /etc/apt/sources.list
# update and install packages apt-get update apt-get install gcc-arm-linux-gnueabi xdeb
I have tried both xdeb and xapt, both causing problems. You can find the regular compilation procedure here: http://www.freerdp.com/wiki/doku.php?id=compilation
Following the regular procedure, one can compile directly on the pandaboard, but it's very slow.
xapt:
I managed to fetch and convert packages with xapt, using the following command: sudo xapt -a armel -k -b --suite natty --mirror http://ports.ubuntu.com/libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev libasound2-dev libxcb1 libxcb1-dev libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev
The problem is then that xapt will fail to install the converted packages, saying the package architecture is different from the current architecture, as well as missing dependencies. I worked around the problem with this ugly hack:
cd /var/lib/xapt/output/ sudo dpkg -i --force-all *.deb
Following this, I could get the FreeRDP configure script to work, even though it would fail to detect X11 properly:
PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig ./configure --host=arm-linux-gnueabi --with-neon
When trying to build after that, it will still fail to link in the end, complaining about missing libraries such as zlib, X11, crypto, etc. I tried installing various packages more with xapt, but I couldn't get it to work.
xdeb:
I tried the following: root@workstation:/# xdeb -a armel --prefer-apt libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev libasound2-dev Building source package cache ... Using file ports.ubuntu.com_dists_natty_main_source_Sources for apt cache Using file ports.ubuntu.com_dists_natty_universe_source_Sources for apt cache Using file archive.ubuntu.com_ubuntu_dists_natty_main_source_Sources for apt cache Using file archive.ubuntu.com_ubuntu_dists_natty_universe_source_Sources for apt cache Building working tree cache ... No source package found: libssl-dev
Or, alternatively, the following: root@workstation:/# xdeb -a armel --convert libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev libasound2-dev Traceback (most recent call last): File "/usr/bin/xdeb", line 849, in <module> main() File "/usr/bin/xdeb", line 767, in main crossed_debs = cross_convert(options, args) File "/usr/bin/xdeb", line 409, in cross_convert deb)).debcontrol() File "/usr/lib/pymodules/python2.7/debian/debfile.py", line 208, in __init__ ArFile.__init__(self, filename, mode, fileobj) File "/usr/lib/pymodules/python2.7/debian/arfile.py", line 47, in __init__ self.__index_archive() File "/usr/lib/pymodules/python2.7/debian/arfile.py", line 52, in __index_archive fp = open(self.__fname, "rb") IOError: [Errno 2] No such file or directory: './libssl-dev'
Here is my sources.list file: root@workstation:/# cat /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu natty main universe deb-src http://archive.ubuntu.com/ubuntu natty main universe deb [arch=armel] http://ports.ubuntu.com/ natty main universe deb-src [arch=armel] http://ports.ubuntu.com/ natty main universe
I'm stuck at this point. Can anybody point me towards possible solution paths on how to cross-compile FreeRDP for ARM, given the above information?
Best regards, - Marc-Andre
+++ Marc-André Moreau [2011-06-23 17:40 -0400]:
[I wrote a response to this for 4hrs last night then my mail server crashed and lost it all - <mutter>. trying agin...]
Hi,
I am Marc-Andre from the FreeRDP project, an open source RDP client. I want to work on optimizing FreeRDP for ARM using the NEON processor extensions.
Welome
It is my first time cross-compiling, so thank you for your understanding.
Welcome to the joyful world of cross-building :-)
I have asked some questions on IRC, and read various pages from the wiki, but I haven't managed to successfully cross-compile FreeRDP yet. Compiling directly on the pandaboard works, but it is atrociously slow. I have made a chroot environment following and adapting the instructions from the following wiki page: https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/UsingXdeb
Nothing wrong with this method, and it is reliable, but I find it quicker and easier to use multistrap and do: multistrap -f
I have tried both xdeb and xapt, both causing problems.
xapt:
I managed to fetch and convert packages with xapt, using the following command: sudo xapt -a armel -k -b --suite natty --mirror http://ports.ubuntu.com/ libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev libasound2-dev libxcb1 libxcb1-dev libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev
The problem is then that xapt will fail to install the converted packages, saying the package architecture is different from the current architecture, as well as missing dependencies. I worked around the problem with this ugly hack:
cd /var/lib/xapt/output/ sudo dpkg -i --force-all *.deb
You are suffering from this problem: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629595 which is because we are in the middle of a transition to multiarch packages. When xapt/dpkg-cross were written it was assumed that thay would simply ignore multiarched packages. However in practice it turns out that that's not the case and currently they need to be converted back to old-style locations. that needs the -m option supplying to xapt. The version in natty is too old to have option.
So if you do sudo xapt -a armel -b libssl-dev libx11-dev libxv-dev \ libxkbfile-dev libxcursor-dev libasound2-dev libxcb1 libxcb1-dev \ libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev libcups2-dev
on a wheezy box/chroot then all that stuff get downloaded, converted and installed correctly.
Following this, I could get the FreeRDP configure script to work, even though it would fail to detect X11 properly:
PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig ./configure --host= arm-linux-gnueabi --with-neon
X11 is detected OK for me: FreeRDP configure result:
Cryptography : openssl TLS : enabled Sound : yes Printer : no CUnit : no X11 : yes DirectFB : no
When trying to build after that, it will still fail to link in the end, complaining about missing libraries such as zlib, X11, crypto, etc. I tried installing various packages more with xapt, but I couldn't get it to work.
If I do PKG_CONFIG_LIBDIR=/usr/arm-linux-gnueabi/lib/pkgconfig dpkg-buildpackage -aarmel
then it all builds OK (on wheezy), except that the printer support is not found. The confiure script needs checking to find out why that's failing. That path-setting shouldn't be neeed either but it's not working without it, even with the cross-version of pkg-config installed. Again, needs further investigation.
You can work round the cups non-identificatin with HAVE_CUPS=1 PKG_CONFIG_LIBDIR=/usr/arm-linux-gnueabi/lib/pkgconfig dpkg-buildpackage -aarmel
To get this working on natty you would need to get the current xapt, an ubuntu port of which is available here:
http://wookware.org/software/repo/ natty main or just here: http://wookware.org/software/repo/pool/main/e/emdebian-crush/xapt_2.2.16ubun...
however there is then a link failure, when it tries to link the wrong arch of libpthread.so: /usr/lib/gcc/arm-linux-gnueabi/4.5.2/../../../../arm-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so when searching for -lpthread /usr/lib/x86_64-linux-gnu/libpthread.a: could not read symbols: File format not recognized collect2: ld returned 1 exit status
Again - needs looking into.
xdeb:
I tried the following: root@workstation:/# xdeb -a armel --prefer-apt libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev libasound2-dev ... No source package found: libssl-dev
Or, alternatively, the following: root@workstation:/# xdeb -a armel --convert libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev libasound2-dev .. IOError: [Errno 2] No such file or directory: './libssl-dev'
Here is my sources.list file: root@workstation:/# cat /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu natty main universe deb-src http://archive.ubuntu.com/ubuntu natty main universe deb [arch=armel] http://ports.ubuntu.com/ natty main universe deb-src [arch=armel] http://ports.ubuntu.com/ natty main universe
That looks OK (except the last line should be: deb-src http://ports.ubuntu.com/ natty main universe (It doesn't actually break anything - just makes no sense - Have I left that in a doc somewhere?)
So for xdeb you want this command:
xdeb -a armel --prefer-apt --only-explicit freerdp
On wheezy that dies quickly with a package conflict: he following packages have unmet dependencies: heimdal-dev : Conflicts: libkrb5-dev but 1.9.1+dfsg-1+b1 is to be installed libdb-dev : Depends: libdb5.1-dev but it is not going to be installed Conflicts: libdb4.8-dev but 4.8.30-8 is to be installed libdb4.8-dev : Conflicts: libdb-dev but 5.1.4 is to be installed libkrb5-dev : Conflicts: heimdal-dev but 1.4.0-6 is to be installed unixodbc-dev : Conflicts: libiodbc2-dev but 3.52.7-2 is to be installed E: Broken packages
Not sure what's going on there, but it's not much use.
On natty things go much better and it downloads, crosses and builds a load of stuff until falling over with :
pkg-deb: building package libosmesa6-armel-cross' in ./libosmesa6-armel-cross_7.10.2-0ubuntu2_all.deb'. dpkg-cross: package libegl1-mesa-drivers doesn't provide any useful files. Skipping.
Which is due to this bug: https://bugs.launchpad.net/ubuntu/+source/xdeb/+bug/731079 (xdeb stops if it comes across a package it thought it should cross which is in fact dpkg-cross 'NULL'). This is rather annoying and I think I have a fix mostly-done but it's not merged yet - need to check where that got to. You can fix it by adding the offending package to the xdeb blacklist )that's how it currently expects to work): so add libosmesa6 to /etc/xdeb/xdeb.conf in the 'blacklist' section.
However after doing that it doesn't get much further before: .:terminate called after throwing an instance of 'std::out_of_range'
I'm stuck at this point. Can anybody point me towards possible solution paths on how to cross-compile FreeRDP for ARM, given the above information?
So, the easiest way to get cross-building is to do it on a debian wheezy machine/chroot where the tools and build work OK. As you want to do neon dev then you may need to install a new-enough cross-toolchain, which probably means a linaro one.
I'll look into the natty build failures and see if we can get that going for you. This is clearly a package that ought to cross OK.
So, now you know why people native-build :-) there are an awful lot fewer things to go wrong and the tools are much more mature. There is plenty of work going on at the moment to improve the situation, and at least your source package is farily well-behaved (many aren't). It does look like it needs a couple of fixes though so a plain dpkg-buildpackage -aarmel would work as expected.
So, is a wheezy-based build sufficient for you for the time being? Or do you have to have it building on natty to do useful dev?
Wookey
On Fri, Jun 24, 2011 at 5:49 AM, Wookey wookey@wookware.org wrote:
+++ Marc-André Moreau [2011-06-23 17:40 -0400]:
[I wrote a response to this for 4hrs last night then my mail server crashed and lost it all - <mutter>. trying agin...]
Hi,
I am Marc-Andre from the FreeRDP project, an open source RDP client. I
want to
work on optimizing FreeRDP for ARM using the NEON processor extensions.
Welome
It is my first time cross-compiling, so thank you for your understanding.
Welcome to the joyful world of cross-building :-)
Hehe, thank you for the long detailed answer, it is really appreciated :)
I have asked some questions on IRC, and read various pages from the wiki,
but I
haven't managed to successfully cross-compile FreeRDP yet. Compiling
directly
on the pandaboard works, but it is atrociously slow. I have made a chroot environment following and adapting the instructions from the following
wiki
page:
https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/UsingXdeb
Nothing wrong with this method, and it is reliable, but I find it quicker and easier to use multistrap and do: multistrap -f
Will look into that, it could save me time
I have tried both xdeb and xapt, both causing problems.
xapt:
I managed to fetch and convert packages with xapt, using the following
command:
sudo xapt -a armel -k -b --suite natty --mirror http://ports.ubuntu.com/ libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev
libasound2-dev
libxcb1 libxcb1-dev libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev
The problem is then that xapt will fail to install the converted
packages,
saying the package architecture is different from the current
architecture, as
well as missing dependencies. I worked around the problem with this ugly
hack:
cd /var/lib/xapt/output/ sudo dpkg -i --force-all *.deb
You are suffering from this problem: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629595 which is because we are in the middle of a transition to multiarch packages. When xapt/dpkg-cross were written it was assumed that thay would simply ignore multiarched packages. However in practice it turns out that that's not the case and currently they need to be converted back to old-style locations. that needs the -m option supplying to xapt. The version in natty is too old to have option.
So if you do sudo xapt -a armel -b libssl-dev libx11-dev libxv-dev \ libxkbfile-dev libxcursor-dev libasound2-dev libxcb1 libxcb1-dev \ libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev libcups2-dev
on a wheezy box/chroot then all that stuff get downloaded, converted and installed correctly.
Ok, so I should assume that this stuff is broken for pretty much anyone using natty?
Following this, I could get the FreeRDP configure script to work, even
though
it would fail to detect X11 properly:
PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig ./configure --host= arm-linux-gnueabi --with-neon
X11 is detected OK for me: FreeRDP configure result:
Cryptography : openssl TLS : enabled Sound : yes Printer : no CUnit : no X11 : yes DirectFB : no
When trying to build after that, it will still fail to link in the end, complaining about missing libraries such as zlib, X11, crypto, etc. I
tried
installing various packages more with xapt, but I couldn't get it to
work.
If I do PKG_CONFIG_LIBDIR=/usr/arm-linux-gnueabi/lib/pkgconfig dpkg-buildpackage -aarmel
then it all builds OK (on wheezy), except that the printer support is not found. The confiure script needs checking to find out why that's failing. That path-setting shouldn't be neeed either but it's not working without it, even with the cross-version of pkg-config installed. Again, needs further investigation.
You can work round the cups non-identificatin with HAVE_CUPS=1 PKG_CONFIG_LIBDIR=/usr/arm-linux-gnueabi/lib/pkgconfig dpkg-buildpackage -aarmel
I can deal with the fact that CUPS support is broken, I mainly need to get the basic stuff working so that I can optimize graphical rendering, but that's good to know :P
To get this working on natty you would need to get the current xapt, an ubuntu port of which is available here:
http://wookware.org/software/repo/ natty main or just here:
http://wookware.org/software/repo/pool/main/e/emdebian-crush/xapt_2.2.16ubun...
however there is then a link failure, when it tries to link the wrong arch of libpthread.so: /usr/lib/gcc/arm-linux-gnueabi/4.5.2/../../../../arm-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so when searching for -lpthread /usr/lib/x86_64-linux-gnu/libpthread.a: could not read symbols: File format not recognized collect2: ld returned 1 exit status
If I understand correctly, xapt is broken on natty, so I could give this build of xapt a try, but then when trying to build FreeRDP I'll still have the problem described above?
Again - needs looking into.
xdeb:
I tried the following: root@workstation:/# xdeb -a armel --prefer-apt libssl-dev libx11-dev
libxv-dev
libxkbfile-dev libxcursor-dev libasound2-dev ... No source package found: libssl-dev
Or, alternatively, the following: root@workstation:/# xdeb -a armel --convert libssl-dev libx11-dev
libxv-dev
libxkbfile-dev libxcursor-dev libasound2-dev .. IOError: [Errno 2] No such file or directory: './libssl-dev'
Here is my sources.list file: root@workstation:/# cat /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu natty main universe deb-src http://archive.ubuntu.com/ubuntu natty main universe deb [arch=armel] http://ports.ubuntu.com/ natty main universe deb-src [arch=armel] http://ports.ubuntu.com/ natty main universe
That looks OK (except the last line should be: deb-src http://ports.ubuntu.com/ natty main universe (It doesn't actually break anything - just makes no sense - Have I left that in a doc somewhere?)
Hum... not sure where I read that, are you referring to the [arch=armel] part? I read in certain places that it was something new that should be there, but it didn't change anything.
So for xdeb you want this command:
xdeb -a armel --prefer-apt --only-explicit freerdp
On wheezy that dies quickly with a package conflict: he following packages have unmet dependencies: heimdal-dev : Conflicts: libkrb5-dev but 1.9.1+dfsg-1+b1 is to be installed libdb-dev : Depends: libdb5.1-dev but it is not going to be installed Conflicts: libdb4.8-dev but 4.8.30-8 is to be installed libdb4.8-dev : Conflicts: libdb-dev but 5.1.4 is to be installed libkrb5-dev : Conflicts: heimdal-dev but 1.4.0-6 is to be installed unixodbc-dev : Conflicts: libiodbc2-dev but 3.52.7-2 is to be installed E: Broken packages
Not sure what's going on there, but it's not much use.
On natty things go much better and it downloads, crosses and builds a load of stuff until falling over with :
pkg-deb: building package libosmesa6-armel-cross' in ./libosmesa6-armel-cross_7.10.2-0ubuntu2_all.deb'. dpkg-cross: package libegl1-mesa-drivers doesn't provide any useful files. Skipping.
Which is due to this bug: https://bugs.launchpad.net/ubuntu/+source/xdeb/+bug/731079 (xdeb stops if it comes across a package it thought it should cross which is in fact dpkg-cross 'NULL'). This is rather annoying and I think I have a fix mostly-done but it's not merged yet - need to check where that got to. You can fix it by adding the offending package to the xdeb blacklist )that's how it currently expects to work): so add libosmesa6 to /etc/xdeb/xdeb.conf in the 'blacklist' section.
However after doing that it doesn't get much further before: .:terminate called after throwing an instance of 'std::out_of_range'
I'm stuck at this point. Can anybody point me towards possible solution
paths
on how to cross-compile FreeRDP for ARM, given the above information?
So, the easiest way to get cross-building is to do it on a debian wheezy machine/chroot where the tools and build work OK. As you want to do neon dev then you may need to install a new-enough cross-toolchain, which probably means a linaro one.
I see the linaro wiki and website refer to ubuntu a lot, and not necessarily debian. There is also much more support and documentation for ubuntu rather than debian for the pandaboard. I understand it would be much easier to get it to compile in the first place with debian wheezy, but I would prefer staying with ubuntu, if it is possible. I tried just tried xapt in oneiric, it doesn't seem to be fixed :( Besides xapt, what would be seriously broken in ubuntu natty? Maybe I could just compile the latest version of xapt myself on natty?
I'll look into the natty build failures and see if we can get that going for you. This is clearly a package that ought to cross OK.
So, now you know why people native-build :-) there are an awful lot fewer things to go wrong and the tools are much more mature. There is plenty of work going on at the moment to improve the situation, and at least your source package is farily well-behaved (many aren't). It does look like it needs a couple of fixes though so a plain dpkg-buildpackage -aarmel would work as expected.
So, is a wheezy-based build sufficient for you for the time being? Or do you have to have it building on natty to do useful dev?
My main problem would be debian support on the pandaboard which is much less documented than ubuntu. I'd prefer working around the various issues found in natty and work with natty instead, if we can work around all the current problems. If it's just too much of a pain, I'll have to give wheezy a try, but I don't think it'll be as easy to get wheezy up and running on the pandaboard.
Wookey
Principal hats: Linaro, Emdebian, Wookware, Balloonboard, ARM http://wookware.org/
+++ Marc-André Moreau [2011-06-26 10:41 -0400]:
Nothing wrong with this method, and it is reliable, but I find it quicker and easier to use multistrap and do: multistrap -f
Will look into that, it could save me time
sorry that should read multistrap -f /usr/share/multistrap/ubuntu/armel.conf
but then I realised that it's not been updated for natty. I'll do an upload forthwith.
> xapt: > > The problem is then that xapt will fail to install the converted packages, > saying the package architecture is different from the current architecture, as > well as missing dependencies.
You are suffering from this problem: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629595 which is because we are in the middle of a transition to multiarch packages.
Ok, so I should assume that this stuff is broken for pretty much anyone using natty?
Essentially yes. I'll see if I can get an xapt (or dpkg-cross) update pushed in.
however there is then a link failure, when it tries to link the wrong arch of libpthread.so: /usr/lib/gcc/arm-linux-gnueabi/4.5.2/../../../../arm-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so when searching for -lpthread /usr/lib/x86_64-linux-gnu/libpthread.a: could not read symbols: File format not recognized collect2: ld returned 1 exit status
If I understand correctly, xapt is broken on natty, so I could give this build of xapt a try, but then when trying to build FreeRDP I'll still have the problem described above?
Correct. I'll have a look at that to see what's going on there and what options we have to fix it. Something is pointing at the wrong-arch version.
> deb [arch=armel] http://ports.ubuntu.com/ natty main universe > deb-src [arch=armel] http://ports.ubuntu.com/ natty main universe That looks OK (except the last line should be: deb-src http://ports.ubuntu.com/ natty main universe (It doesn't actually break anything - just makes no sense - Have I left that in a doc somewhere?)
Hum... not sure where I read that, are you referring to the [arch=armel] part? I read in certain places that it was something new that should be there, but it didn't change anything.
You need [arch=armel] for the binary line, but not the source line (where it is meaningless). Change it if you see it in docs.
So, the easiest way to get cross-building is to do it on a debian wheezy machine/chroot where the tools and build work OK. As you want to do neon dev then you may need to install a new-enough cross-toolchain, which probably means a linaro one.
I see the linaro wiki and website refer to ubuntu a lot, and not necessarily debian. There is also much more support and documentation for ubuntu rather than debian for the pandaboard. I understand it would be much easier to get it to compile in the first place with debian wheezy, but I would prefer staying with ubuntu, if it is possible. I tried just tried xapt in oneiric, it doesn't seem to be fixed :( Besides xapt, what would be seriously broken in ubuntu natty? Maybe I could just compile the latest version of xapt myself on natty?
linaro does currently do much of its work in Ubuntu so you are likely to find latest stuff there. On the other hand Debian on panadaboard works fine too SFAIK, so they are probably both reasonable choices.
In general the cross-tools should work the same in both, but it's one area where some stuff happens first in Debian. I don't expect anything else to be seriously broken in natty, but then I don't expect different link behaviour for a given build on the two systems either, so you never know until you try.
So, is a wheezy-based build sufficient for you for the time being? Or do you have to have it building on natty to do useful dev?
My main problem would be debian support on the pandaboard which is much less documented than ubuntu. I'd prefer working around the various issues found in natty and work with natty instead, if we can work around all the current problems. If it's just too much of a pain, I'll have to give wheezy a try, but I don't think it'll be as easy to get wheezy up and running on the pandaboard.
This thread suggests it's perfectly do-able: http://groups.google.com/group/pandaboard/browse_thread/thread/94773021fbe2a...
but natty/onieric needs fixing anyway, so I'll do that, which will, as you say probably give you an easier life overall.
Wookey
Hi Wookey,
I just managed to get it to compile on oneiric. I think I figured out the problem related to pthreads: I had to install libpthread-stubs0 libpthread-stubs0-dev for the current architecture, not the target architecture, which is a bit weird, but it works. The configure script would complain about missing pthreads stubs, which is why I installed it first with xapt, without success, but when I installed it for the current architecture, the configure script worked and FreeRDP built without linker errors.
I used your updated xapt package in oneiric to correctly fetch the stuff. Here are my updated notes:
# bootstrap ubuntu oneiric sudo debootstrap oneiric oneiric-armel
# chroot to new environment sudo chroot oneiric-armel
# mount partitions mount -t proc proc /proc mount -t devpts none /dev/pts
# export environment variables export LC_ALL=C
# append "universe" after "main" in sources.list sed -i 's/main/main universe/' /etc/apt/sources.list
# add source repository sudo echo "deb [arch=armel] http://ports.ubuntu.com/ oneiric main universe"
/etc/apt/sources.list
# update and install packages apt-get update apt-get install gcc-arm-linux-gnueabi libgcc1-armel-cross xapt wget
wget http://wookware.org/software/repo/pool/main/e/emdebian-crush/xapt_2.2.16ubun... dpkg -i xapt_2.2.16ubuntu1_all.deb
sudo apt-get install libpthread-stubs0 libpthread-stubs0-dev sudo apt-get install libtool automake autoconf git pkg-config
xapt -a armel -m libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev libasound2-dev libxcb1 libxcb1-dev libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev libcups2-dev libpthread-stubs0 libpthread-stubs0-dev
PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig ./configure --host=arm-linux-gnueabi
I am now wondering if the same would work in natty. I'll have to give it a try, if it works, I won't have to update my pandaboard to oneiric.
On Fri, Jun 24, 2011 at 5:49 AM, Wookey wookey@wookware.org wrote:
+++ Marc-André Moreau [2011-06-23 17:40 -0400]:
[I wrote a response to this for 4hrs last night then my mail server crashed and lost it all - <mutter>. trying agin...]
Hi,
I am Marc-Andre from the FreeRDP project, an open source RDP client. I
want to
work on optimizing FreeRDP for ARM using the NEON processor extensions.
Welome
It is my first time cross-compiling, so thank you for your understanding.
Welcome to the joyful world of cross-building :-)
I have asked some questions on IRC, and read various pages from the wiki,
but I
haven't managed to successfully cross-compile FreeRDP yet. Compiling
directly
on the pandaboard works, but it is atrociously slow. I have made a chroot environment following and adapting the instructions from the following
wiki
page:
https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/UsingXdeb
Nothing wrong with this method, and it is reliable, but I find it quicker and easier to use multistrap and do: multistrap -f
I have tried both xdeb and xapt, both causing problems.
xapt:
I managed to fetch and convert packages with xapt, using the following
command:
sudo xapt -a armel -k -b --suite natty --mirror http://ports.ubuntu.com/ libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev
libasound2-dev
libxcb1 libxcb1-dev libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev
The problem is then that xapt will fail to install the converted
packages,
saying the package architecture is different from the current
architecture, as
well as missing dependencies. I worked around the problem with this ugly
hack:
cd /var/lib/xapt/output/ sudo dpkg -i --force-all *.deb
You are suffering from this problem: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629595 which is because we are in the middle of a transition to multiarch packages. When xapt/dpkg-cross were written it was assumed that thay would simply ignore multiarched packages. However in practice it turns out that that's not the case and currently they need to be converted back to old-style locations. that needs the -m option supplying to xapt. The version in natty is too old to have option.
So if you do sudo xapt -a armel -b libssl-dev libx11-dev libxv-dev \ libxkbfile-dev libxcursor-dev libasound2-dev libxcb1 libxcb1-dev \ libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev libcups2-dev
on a wheezy box/chroot then all that stuff get downloaded, converted and installed correctly.
Following this, I could get the FreeRDP configure script to work, even
though
it would fail to detect X11 properly:
PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig ./configure --host= arm-linux-gnueabi --with-neon
X11 is detected OK for me: FreeRDP configure result:
Cryptography : openssl TLS : enabled Sound : yes Printer : no CUnit : no X11 : yes DirectFB : no
When trying to build after that, it will still fail to link in the end, complaining about missing libraries such as zlib, X11, crypto, etc. I
tried
installing various packages more with xapt, but I couldn't get it to
work.
If I do PKG_CONFIG_LIBDIR=/usr/arm-linux-gnueabi/lib/pkgconfig dpkg-buildpackage -aarmel
then it all builds OK (on wheezy), except that the printer support is not found. The confiure script needs checking to find out why that's failing. That path-setting shouldn't be neeed either but it's not working without it, even with the cross-version of pkg-config installed. Again, needs further investigation.
You can work round the cups non-identificatin with HAVE_CUPS=1 PKG_CONFIG_LIBDIR=/usr/arm-linux-gnueabi/lib/pkgconfig dpkg-buildpackage -aarmel
To get this working on natty you would need to get the current xapt, an ubuntu port of which is available here:
http://wookware.org/software/repo/ natty main or just here:
http://wookware.org/software/repo/pool/main/e/emdebian-crush/xapt_2.2.16ubun...
however there is then a link failure, when it tries to link the wrong arch of libpthread.so: /usr/lib/gcc/arm-linux-gnueabi/4.5.2/../../../../arm-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so when searching for -lpthread /usr/lib/x86_64-linux-gnu/libpthread.a: could not read symbols: File format not recognized collect2: ld returned 1 exit status
Again - needs looking into.
xdeb:
I tried the following: root@workstation:/# xdeb -a armel --prefer-apt libssl-dev libx11-dev
libxv-dev
libxkbfile-dev libxcursor-dev libasound2-dev ... No source package found: libssl-dev
Or, alternatively, the following: root@workstation:/# xdeb -a armel --convert libssl-dev libx11-dev
libxv-dev
libxkbfile-dev libxcursor-dev libasound2-dev .. IOError: [Errno 2] No such file or directory: './libssl-dev'
Here is my sources.list file: root@workstation:/# cat /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu natty main universe deb-src http://archive.ubuntu.com/ubuntu natty main universe deb [arch=armel] http://ports.ubuntu.com/ natty main universe deb-src [arch=armel] http://ports.ubuntu.com/ natty main universe
That looks OK (except the last line should be: deb-src http://ports.ubuntu.com/ natty main universe (It doesn't actually break anything - just makes no sense - Have I left that in a doc somewhere?)
So for xdeb you want this command:
xdeb -a armel --prefer-apt --only-explicit freerdp
On wheezy that dies quickly with a package conflict: he following packages have unmet dependencies: heimdal-dev : Conflicts: libkrb5-dev but 1.9.1+dfsg-1+b1 is to be installed libdb-dev : Depends: libdb5.1-dev but it is not going to be installed Conflicts: libdb4.8-dev but 4.8.30-8 is to be installed libdb4.8-dev : Conflicts: libdb-dev but 5.1.4 is to be installed libkrb5-dev : Conflicts: heimdal-dev but 1.4.0-6 is to be installed unixodbc-dev : Conflicts: libiodbc2-dev but 3.52.7-2 is to be installed E: Broken packages
Not sure what's going on there, but it's not much use.
On natty things go much better and it downloads, crosses and builds a load of stuff until falling over with :
pkg-deb: building package libosmesa6-armel-cross' in ./libosmesa6-armel-cross_7.10.2-0ubuntu2_all.deb'. dpkg-cross: package libegl1-mesa-drivers doesn't provide any useful files. Skipping.
Which is due to this bug: https://bugs.launchpad.net/ubuntu/+source/xdeb/+bug/731079 (xdeb stops if it comes across a package it thought it should cross which is in fact dpkg-cross 'NULL'). This is rather annoying and I think I have a fix mostly-done but it's not merged yet - need to check where that got to. You can fix it by adding the offending package to the xdeb blacklist )that's how it currently expects to work): so add libosmesa6 to /etc/xdeb/xdeb.conf in the 'blacklist' section.
However after doing that it doesn't get much further before: .:terminate called after throwing an instance of 'std::out_of_range'
I'm stuck at this point. Can anybody point me towards possible solution
paths
on how to cross-compile FreeRDP for ARM, given the above information?
So, the easiest way to get cross-building is to do it on a debian wheezy machine/chroot where the tools and build work OK. As you want to do neon dev then you may need to install a new-enough cross-toolchain, which probably means a linaro one.
I'll look into the natty build failures and see if we can get that going for you. This is clearly a package that ought to cross OK.
So, now you know why people native-build :-) there are an awful lot fewer things to go wrong and the tools are much more mature. There is plenty of work going on at the moment to improve the situation, and at least your source package is farily well-behaved (many aren't). It does look like it needs a couple of fixes though so a plain dpkg-buildpackage -aarmel would work as expected.
So, is a wheezy-based build sufficient for you for the time being? Or do you have to have it building on natty to do useful dev?
Wookey
Principal hats: Linaro, Emdebian, Wookware, Balloonboard, ARM http://wookware.org/
Hi Wookey,
I confirm that I just got it to work with natty :D
I have put my notes on the FreeRDP wiki, I'll expand the article later: http://www.freerdp.com/wiki/doku.php?id=arm_cross_compiling
Since we're using libtool, the executables are wrapped behind scripts that set up proper environment variables for non-installed libraries. I managed to get around the broken path problem between the current system and the target system by creating the same user in both the chroot environment and the target environment, and mount the FreeRDP source directory at the exact same absolute path on the pandaboard using sshfs. I can now compile on my powerful computer, and use the results instantly on the pandaboard :)
I finally have a decent cross-compiling setup :) This is going to save me a lot of time!
Thank you, - Marc-Andre
On Sun, Jun 26, 2011 at 11:20 AM, Marc-André Moreau < marcandre.moreau@gmail.com> wrote:
Hi Wookey,
I just managed to get it to compile on oneiric. I think I figured out the problem related to pthreads: I had to install libpthread-stubs0 libpthread-stubs0-dev for the current architecture, not the target architecture, which is a bit weird, but it works. The configure script would complain about missing pthreads stubs, which is why I installed it first with xapt, without success, but when I installed it for the current architecture, the configure script worked and FreeRDP built without linker errors.
I used your updated xapt package in oneiric to correctly fetch the stuff. Here are my updated notes:
# bootstrap ubuntu oneiric sudo debootstrap oneiric oneiric-armel
# chroot to new environment sudo chroot oneiric-armel
# mount partitions mount -t proc proc /proc mount -t devpts none /dev/pts
# export environment variables export LC_ALL=C
# append "universe" after "main" in sources.list sed -i 's/main/main universe/' /etc/apt/sources.list
# add source repository sudo echo "deb [arch=armel] http://ports.ubuntu.com/ oneiric main universe" >> /etc/apt/sources.list
# update and install packages apt-get update apt-get install gcc-arm-linux-gnueabi libgcc1-armel-cross xapt wget
wget http://wookware.org/software/repo/pool/main/e/emdebian-crush/xapt_2.2.16ubun... dpkg -i xapt_2.2.16ubuntu1_all.deb
sudo apt-get install libpthread-stubs0 libpthread-stubs0-dev sudo apt-get install libtool automake autoconf git pkg-config
xapt -a armel -m libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev libasound2-dev libxcb1 libxcb1-dev libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev libcups2-dev libpthread-stubs0 libpthread-stubs0-dev
PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig ./configure --host=arm-linux-gnueabi
I am now wondering if the same would work in natty. I'll have to give it a try, if it works, I won't have to update my pandaboard to oneiric.
On Fri, Jun 24, 2011 at 5:49 AM, Wookey wookey@wookware.org wrote:
+++ Marc-André Moreau [2011-06-23 17:40 -0400]:
[I wrote a response to this for 4hrs last night then my mail server crashed and lost it all - <mutter>. trying agin...]
Hi,
I am Marc-Andre from the FreeRDP project, an open source RDP client. I
want to
work on optimizing FreeRDP for ARM using the NEON processor extensions.
Welome
It is my first time cross-compiling, so thank you for your
understanding.
Welcome to the joyful world of cross-building :-)
I have asked some questions on IRC, and read various pages from the
wiki, but I
haven't managed to successfully cross-compile FreeRDP yet. Compiling
directly
on the pandaboard works, but it is atrociously slow. I have made a
chroot
environment following and adapting the instructions from the following
wiki
page:
https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/UsingXdeb
Nothing wrong with this method, and it is reliable, but I find it quicker and easier to use multistrap and do: multistrap -f
I have tried both xdeb and xapt, both causing problems.
xapt:
I managed to fetch and convert packages with xapt, using the following
command:
sudo xapt -a armel -k -b --suite natty --mirror
libssl-dev libx11-dev libxv-dev libxkbfile-dev libxcursor-dev
libasound2-dev
libxcb1 libxcb1-dev libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev
The problem is then that xapt will fail to install the converted
packages,
saying the package architecture is different from the current
architecture, as
well as missing dependencies. I worked around the problem with this ugly
hack:
cd /var/lib/xapt/output/ sudo dpkg -i --force-all *.deb
You are suffering from this problem: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629595 which is because we are in the middle of a transition to multiarch packages. When xapt/dpkg-cross were written it was assumed that thay would simply ignore multiarched packages. However in practice it turns out that that's not the case and currently they need to be converted back to old-style locations. that needs the -m option supplying to xapt. The version in natty is too old to have option.
So if you do sudo xapt -a armel -b libssl-dev libx11-dev libxv-dev \ libxkbfile-dev libxcursor-dev libasound2-dev libxcb1 libxcb1-dev \ libdirectfb-dev libc6 libc6-dev zlib1g zlib1g-dev libcups2-dev
on a wheezy box/chroot then all that stuff get downloaded, converted and installed correctly.
Following this, I could get the FreeRDP configure script to work, even
though
it would fail to detect X11 properly:
PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig ./configure --host= arm-linux-gnueabi --with-neon
X11 is detected OK for me: FreeRDP configure result:
Cryptography : openssl TLS : enabled Sound : yes Printer : no CUnit : no X11 : yes DirectFB : no
When trying to build after that, it will still fail to link in the end, complaining about missing libraries such as zlib, X11, crypto, etc. I
tried
installing various packages more with xapt, but I couldn't get it to
work.
If I do PKG_CONFIG_LIBDIR=/usr/arm-linux-gnueabi/lib/pkgconfig dpkg-buildpackage -aarmel
then it all builds OK (on wheezy), except that the printer support is not found. The confiure script needs checking to find out why that's failing. That path-setting shouldn't be neeed either but it's not working without it, even with the cross-version of pkg-config installed. Again, needs further investigation.
You can work round the cups non-identificatin with HAVE_CUPS=1 PKG_CONFIG_LIBDIR=/usr/arm-linux-gnueabi/lib/pkgconfig dpkg-buildpackage -aarmel
To get this working on natty you would need to get the current xapt, an ubuntu port of which is available here:
http://wookware.org/software/repo/ natty main or just here:
http://wookware.org/software/repo/pool/main/e/emdebian-crush/xapt_2.2.16ubun...
however there is then a link failure, when it tries to link the wrong arch of libpthread.so: /usr/lib/gcc/arm-linux-gnueabi/4.5.2/../../../../arm-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpthread.so when searching for -lpthread /usr/lib/x86_64-linux-gnu/libpthread.a: could not read symbols: File format not recognized collect2: ld returned 1 exit status
Again - needs looking into.
xdeb:
I tried the following: root@workstation:/# xdeb -a armel --prefer-apt libssl-dev libx11-dev
libxv-dev
libxkbfile-dev libxcursor-dev libasound2-dev ... No source package found: libssl-dev
Or, alternatively, the following: root@workstation:/# xdeb -a armel --convert libssl-dev libx11-dev
libxv-dev
libxkbfile-dev libxcursor-dev libasound2-dev .. IOError: [Errno 2] No such file or directory: './libssl-dev'
Here is my sources.list file: root@workstation:/# cat /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu natty main universe deb-src http://archive.ubuntu.com/ubuntu natty main universe deb [arch=armel] http://ports.ubuntu.com/ natty main universe deb-src [arch=armel] http://ports.ubuntu.com/ natty main universe
That looks OK (except the last line should be: deb-src http://ports.ubuntu.com/ natty main universe (It doesn't actually break anything - just makes no sense - Have I left that in a doc somewhere?)
So for xdeb you want this command:
xdeb -a armel --prefer-apt --only-explicit freerdp
On wheezy that dies quickly with a package conflict: he following packages have unmet dependencies: heimdal-dev : Conflicts: libkrb5-dev but 1.9.1+dfsg-1+b1 is to be installed libdb-dev : Depends: libdb5.1-dev but it is not going to be installed Conflicts: libdb4.8-dev but 4.8.30-8 is to be installed libdb4.8-dev : Conflicts: libdb-dev but 5.1.4 is to be installed libkrb5-dev : Conflicts: heimdal-dev but 1.4.0-6 is to be installed unixodbc-dev : Conflicts: libiodbc2-dev but 3.52.7-2 is to be installed E: Broken packages
Not sure what's going on there, but it's not much use.
On natty things go much better and it downloads, crosses and builds a load of stuff until falling over with :
pkg-deb: building package libosmesa6-armel-cross' in ./libosmesa6-armel-cross_7.10.2-0ubuntu2_all.deb'. dpkg-cross: package libegl1-mesa-drivers doesn't provide any useful files. Skipping.
Which is due to this bug: https://bugs.launchpad.net/ubuntu/+source/xdeb/+bug/731079 (xdeb stops if it comes across a package it thought it should cross which is in fact dpkg-cross 'NULL'). This is rather annoying and I think I have a fix mostly-done but it's not merged yet - need to check where that got to. You can fix it by adding the offending package to the xdeb blacklist )that's how it currently expects to work): so add libosmesa6 to /etc/xdeb/xdeb.conf in the 'blacklist' section.
However after doing that it doesn't get much further before: .:terminate called after throwing an instance of 'std::out_of_range'
I'm stuck at this point. Can anybody point me towards possible solution
paths
on how to cross-compile FreeRDP for ARM, given the above information?
So, the easiest way to get cross-building is to do it on a debian wheezy machine/chroot where the tools and build work OK. As you want to do neon dev then you may need to install a new-enough cross-toolchain, which probably means a linaro one.
I'll look into the natty build failures and see if we can get that going for you. This is clearly a package that ought to cross OK.
So, now you know why people native-build :-) there are an awful lot fewer things to go wrong and the tools are much more mature. There is plenty of work going on at the moment to improve the situation, and at least your source package is farily well-behaved (many aren't). It does look like it needs a couple of fixes though so a plain dpkg-buildpackage -aarmel would work as expected.
So, is a wheezy-based build sufficient for you for the time being? Or do you have to have it building on natty to do useful dev?
Wookey
Principal hats: Linaro, Emdebian, Wookware, Balloonboard, ARM http://wookware.org/