New answers tagged

0

gcc uses the terms ''architecture'' to mean the ''instruction set'' of a specific CPU, and "target" covers the combination of CPU and architecture, along with other variables such as ABI, libc, endian-ness and more (possibly including "bare metal"). A typical compiler has a limited set of target combinations (probably one ABI, one CPU family, but possibly ...


3

It's possible to re-cast this question into an environment that might be more familiar. By analogy: "I have a Ruby program that I want to run, but my platform only has a Python interpreter. Can I use the Python interpreter to run my Ruby program, or do I have to rewrite my program in Python?" An instruction set architecture ("target") is a language -- a "...


6

You always need to target a platform. In the simplest case, the target CPU directly runs the code compiled in the binary (this roughly corresponds to MS DOS's COM executables). Let's consider two different platforms I just invented - Armistice and Intellio. In both cases, we'll have a simple hello world program that outputs 42 on the screen. I'll also assume ...


9

Note that as a last resort (i.e. when you don't have the source code), you can run binaries on a different architecture using emulators like qemu, dosbox or exagear. Some emulators are designed to emulate systems other than Linux (e.g. dosbox is designed to run MS-DOS programs, and there are plenty of emulators for popular gaming consoles). Emulation has a ...


7

Not only are binaries not portable between x86 and ARM, there are different flavours of ARM. The one you are likely to encounter in practice is ARMv6 vs ARMv7. Raspberry Pi 1 is ARMv6, later versions are ARMv7. So it's possible to compile code on the later ones that does not work on the Pi 1. Fortunately one benefit of open source and Free software is ...


14

Elizabeth Myers is correct, each architecture requires a compiled binary for the architecture in question. To build binaries for a different architecture than your system runs on you need a cross-compiler. In most cases you need to compile a cross compiler. I only have experience with gcc (but I believe that llvm, and other compilers, have similar ...


37

No. Binaries must be (re)compiled for the target architecture, and Linux offers nothing like fat binaries out of the box. The reason is because the code is compiled to machine code for a specific architecture, and machine code is very different between most processor families (ARM and x86 for instance are very different). EDIT: it is worth noting that some ...


1

I would suggest using GNU Stow to create a hierarchy under the /opt directory for any site-specific software (see Filesystem Hierarchy Standard, although some sites use /sw instead). That way, your stuff would [using /opt] ... not collide with anything installed by any package manager. [using stow] ... be really easy to install/uninstall. For stow, ...


1

If you don't mind perl, you could match instances of a single zero or a sequence of 1 to 3 ones map the zeros to themselves and the ones sequences to their lengths e.g. perl -lne '@runs = $_ =~ /(0|1{1,3})/g; print map { $_==0 ? $_ : length $_ } @runs' Testing with the provided strings: cat << EOF | \ perl -lne '@runs = $_ =~ /(0|1{1,3})/g; ...



Top 50 recent answers are included