With gcc installed i could just write
Is it possible to find this information without gcc?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You can get a lot of information by means of
uname and also by checking with
file the type of executables:
$ gcc -dumpmachine x86_64-linux-gnu $ uname -o -m x86_64 GNU/Linux $ file /usr/bin/file /usr/bin/file: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d8ac02806880576708bf189c064fca78ea89f1d0, stripped
If your device doesn't have
file installed, copy a binary executable from it to another Linux computer and run
You'll need to find files in the file system which preserve the triplet passed to / probed by
configure on the build time of your target userland.
In common GNU/Linux distributions the best bet would be querying to common command binaries like
svn. In the following example on Debian/armhf (QEMU image taken from here) I got the canonical triplet
bash --version. So it would be basically safe to configure my cross toolchain for this system by
root@debian-armhf:~# bash --version GNU bash, version 4.2.37(1)-release (arm-unknown-linux-gnueabihf) Copyright (C) 2011 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.
There's no reliable way to know non-canonical triplet like
x86_64-linux-gnu from the userland, and there might be distribution specific conventions like Debian multiarch and tuples. You'll need to collect info from your distribution's document or other resources online.
Another option is
make -v. In my laptop:
$ make -v GNU Make 4.1 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2014 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.
Then built triple is