tasinofan
Senior Member
- Jan 13, 2013
- 92
- 23
just for fun and out of curiosity, I cross built some unix commands on my amd64 gentoo desktop to run on arm-none-linux-gnueabi
autoconf-2.69
automake-1.13.1
binutils-2.23.2
busybox-1.21.0
curl-7.29.0
gcc-4.8.0
gdb-7.5.1
gmp-5.1.1
gnutls-3.1.10
hello-2.8
libtasn1-3.3
libtool-2.4.2
m4-1.4.16
make-3.82
mpc-1.0.1
mpfr-3.1.2
ncurses-5.9
nettle-2.6
openssh-6.2p1
openssl-1.0.1e
proftpd-1.3.4c
readline-6.2
rsync-3.0.9
wget-1.14
zlib-1.2.7
On the tablet, together with arm cross glibc-2.17 and linux-headers-3.8, I can now, for example, compile:
I guess it should work fine on many android devices
(it needs some setup for LIBRARY PATH and some symbolic links to make tablet believe there is a /usr/arm-none-linux-gnueabi)
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/data/arm-none-linux-gnueabi/bin/../libexec/gcc/arm-none-linux-gnueabi/4.8.0/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: ./configure --enable-shared --enable-languages=c,c++ --enable-threads=posix --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi --prefix=/usr/arm-none-linux-gnueabi --with-sysroot=/usr/arm-none-linux-gnueabi
Thread model: posix
gcc version 4.8.0 (GCC)
# cat > hello.c
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
int main (int argc, char **argv) {
printf("hello world\n");
exit (0);
}
^D
# gcc -o hello hello.c
# ./hello
hello world
# cat > hello.cc
using namespace std;
#include <iostream>
#include <vector>
#include <stdlib.h>
int main(int argc, char **argv)
{
cout << "hello C++" << endl;
exit(0);
}
^D
# g++ -o hello hello.cc
# ./hello
hello C++
update: I also ported GNU build tools so I can build, say, GNU hello doing
# tar zxf hello-2.8.tar.gz
# cd hello-2.8
# ./configure --prefix=/usr/arm-none-linux-gnueabi
# make -j 5
# make install --prefix=/usr/arm-none-linux-gnueabi
update: gdb works now also:
# g++ -g -o hello hello.cc
# gdb ./hello
GNU gdb (GDB) 7.5.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-none-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /data/marc/Gcc/hello...done.
(gdb) break main
Breakpoint 1 at 0x8764: file hello.cc, line 7.
(gdb) run
Starting program: /data/marc/Gcc/hello
warning: Could not load shared library symbols for 4 libraries, e.g. /usr/arm-none-linux-gnueabi/lib/libstdc++.so.6.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
Breakpoint 1, main (argc=1, argv=0xbe94b9c4) at hello.cc:7
7 cout << "hello C++" << endl;
(gdb) list
2 #include <iostream>
3 #include <vector>
4 #include <stdlib.h>
5 int main(int argc, char **argv)
6 {
7 cout << "hello C++" << endl;
8 exit(0);
9 }
(gdb) where
#0 main (argc=1, argv=0xbe94b9c4) at hello.cc:7
(gdb) s
hello C++
8 exit(0);
(gdb) s
[Inferior 1 (process 28126) exited normally]
(gdb) q
# cat hello.cc
using namespace std;
#include <iostream>
#include <vector>
#include <stdlib.h>
int main(int argc, char **argv)
{
cout << "hello C++" << endl;
exit(0);
}
autoconf-2.69
automake-1.13.1
binutils-2.23.2
busybox-1.21.0
curl-7.29.0
gcc-4.8.0
gdb-7.5.1
gmp-5.1.1
gnutls-3.1.10
hello-2.8
libtasn1-3.3
libtool-2.4.2
m4-1.4.16
make-3.82
mpc-1.0.1
mpfr-3.1.2
ncurses-5.9
nettle-2.6
openssh-6.2p1
openssl-1.0.1e
proftpd-1.3.4c
readline-6.2
rsync-3.0.9
wget-1.14
zlib-1.2.7
On the tablet, together with arm cross glibc-2.17 and linux-headers-3.8, I can now, for example, compile:
I guess it should work fine on many android devices
(it needs some setup for LIBRARY PATH and some symbolic links to make tablet believe there is a /usr/arm-none-linux-gnueabi)
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/data/arm-none-linux-gnueabi/bin/../libexec/gcc/arm-none-linux-gnueabi/4.8.0/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: ./configure --enable-shared --enable-languages=c,c++ --enable-threads=posix --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi --prefix=/usr/arm-none-linux-gnueabi --with-sysroot=/usr/arm-none-linux-gnueabi
Thread model: posix
gcc version 4.8.0 (GCC)
# cat > hello.c
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
int main (int argc, char **argv) {
printf("hello world\n");
exit (0);
}
^D
# gcc -o hello hello.c
# ./hello
hello world
# cat > hello.cc
using namespace std;
#include <iostream>
#include <vector>
#include <stdlib.h>
int main(int argc, char **argv)
{
cout << "hello C++" << endl;
exit(0);
}
^D
# g++ -o hello hello.cc
# ./hello
hello C++
update: I also ported GNU build tools so I can build, say, GNU hello doing
# tar zxf hello-2.8.tar.gz
# cd hello-2.8
# ./configure --prefix=/usr/arm-none-linux-gnueabi
# make -j 5
# make install --prefix=/usr/arm-none-linux-gnueabi
update: gdb works now also:
# g++ -g -o hello hello.cc
# gdb ./hello
GNU gdb (GDB) 7.5.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-none-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /data/marc/Gcc/hello...done.
(gdb) break main
Breakpoint 1 at 0x8764: file hello.cc, line 7.
(gdb) run
Starting program: /data/marc/Gcc/hello
warning: Could not load shared library symbols for 4 libraries, e.g. /usr/arm-none-linux-gnueabi/lib/libstdc++.so.6.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
Breakpoint 1, main (argc=1, argv=0xbe94b9c4) at hello.cc:7
7 cout << "hello C++" << endl;
(gdb) list
2 #include <iostream>
3 #include <vector>
4 #include <stdlib.h>
5 int main(int argc, char **argv)
6 {
7 cout << "hello C++" << endl;
8 exit(0);
9 }
(gdb) where
#0 main (argc=1, argv=0xbe94b9c4) at hello.cc:7
(gdb) s
hello C++
8 exit(0);
(gdb) s
[Inferior 1 (process 28126) exited normally]
(gdb) q
# cat hello.cc
using namespace std;
#include <iostream>
#include <vector>
#include <stdlib.h>
int main(int argc, char **argv)
{
cout << "hello C++" << endl;
exit(0);
}
Last edited: