What 64bit target to choose when compiling with Visual Studio (vcvarsall.bat)? - 64-bit

The vcvarsall.bat that does setup de build environment let you choose between x86 | ia64 | amd64 | x86_amd64 | x86_ia64.
First option is obvious for 32bit, but the question is: what would be the optimal option between the other 4 if you want to build for 64bit and you want to run on all 64 bit machines.
Let say that you don't have time/resources to make 4 builds for 64 and you have to choose only one of them?

I found a page that clarifies this issue http://msdn.microsoft.com/en-us/library/x4d2c09s%28VS.80%29.aspx
32/64 OS building for 32 => x86
32 OS building for 64 => x86_amd64
64 OS building for 64 => amd64
And you can ignore the other options because Itanium does not have a real market share.

ia64 (Itanium) is a very redundant CPU (Google for ia64 market share) and you should use it only if you're going to deploy to that architecture.
x86_amd is for running 32 bit on amd64 architecture, use it only if your code doesn't compile/work under amd64.

Related

NWJS compiling binary for different OS and different arch

I need help in compiling binary files from MacOS to Windows32 & Windows64 bit. In documentation it is written that we need to compile binary according to platform but actual options/parameters are not provided in documentation for it
Got the parameters from nwjc --help section, tried with following but nothing works:
nwjc --target-os win32 --target-arch ia32 nwapp/main.js nwapp/main.bin
nwjc --target-os win32 --target-arch x86_64 nwapp/main.js nwapp/main.bin
nwjc --target-os win32 --target-arch x64 nwapp/main.js nwapp/main.bin
By default, the binary compiled on MacOS is running on 64 bit windows without any target parameters.
Can you give me the parameters and possible values for compiling for Windows32 & Windows 64 from MacOS?
I have got the answer from nwjs gitter group. The answer is:
If you want to compile JS files to v8 binary files for a target
platform, let's suppose Windows 32 bit, then you need to compile them
on the target platform only. You cannot compile binaries for Windows
32 from a different OS (in my case I was trying with MacOS)

compiling application with gcc -m32 on 64-bit system

I try to understand the requirements for developing Linux application running on 64-bit OS (with 64-bit architecture).
If the code was written for 32-bits architecture, does it mean that on regular compilation (gcc -m32) it will run on the 64-bit system OS, without any problems ?
Thank you,
Ran
Yes, it will. The only caveats to this are that you need 32 bit libraries to run the program, and 32 bit development packages to compile it. Most distros provide these and make it simple to install them as well.

Intel OpenMP installation issues

I am trying to install the Intel OpenMP Runtime on my Linux box in the context of enabling OpenMP support for the clang compiler. I am following the following guide: http://clang-omp.github.io/.
I've gotten to the point where the compiler is built, recognizes -fopenmp, and knows where omp.h is. Now the only thing missing is that it can't find -liomp5, which I assume is the Intel OpenMP runtime. The instructions at the aforementioned website say that I need to do this:
To run (rather than just compile) code you need to get and build an IntelĀ® OpenMP* Runtime Library.
So I downloaded the runtime, and was presented with the following choice of compilers in the readme:
Supported Architectures: IA-32 architecture, Intel(R) 64, and
Intel(R) Many Integrated Core Architecture
-----------------------------------------------------------
| icc/icl | gcc |
--------------|------------------------------|--------------------------|
| Linux* OS | Yes(1,5) | Yes(2,4) |
| OS X* | Yes(1,3,4) | No |
| Windows* OS | Yes(1,4) | No |
-------------------------------------------------------------------------
(1) On IA-32 architecture and Intel(R) 64, icc/icl versions 12.x are
supported (12.1 is recommended).
(2) gcc version 4.6.2 is supported.
(3) For icc on OS X*, OS X* version 10.5.8 is supported.
(4) Intel(R) Many Integrated Core Architecture not supported.
(5) On Intel(R) Many Integrated Core Architecture, icc/icl versions 13.0
or later are required.
Which, unless my reading comprehension skills are worse than I thought, suggest that I can choose to use gcc 4.6.2 for compiling the runtime. Unfortunately, when I proceed to build it, I get:
$ make compiler=gcc
[...]
----- 1/1 --- making lib inc common -----
Build : 00000000 (development)
check-tools.pl: (!) No "gfortran" found in PATH.
check-tools.pl: (!) No "icc" found in PATH.
check-tools.pl: (!) No "icpc" found in PATH.
check-tools.pl: (!) No "ifort" found in PATH.
../../tools/src/common-checks.mk:59: *** Development tools not found: icc, icpc, ifort. Stop.
I am really at a loss here. Has anyone had any success using clang-omp, and is this step of building the Intel runtime actually required? I must be really bad at following instructions and it just isn't working out, I need some assistance. Thank you.
The first error message is the key one. You need to install gfortran, which is the optional Fortran compiler that is part of the GNU Compiler Collection (which is what GCC, the project, now stands for - as opposed to gcc, the executable, which is a C compiler).

Is it possible to set up a gcc cross compiler on Linux to compile 64 bit targets on a 32 bit architecture?

I know you can compile to a 32 bit target on 64 bit Linux by using the -m32 flag, but is it also possible to compile to 64 bit on a 32 bit machine by using the -m64 flag?
Or alternatively, do you need to set up a cross gcc tool chain that supports 64 bit targets and is this possible on a 32 bit machine?
Regards,
Johan
As MarkR said, it will be a lot easier to run a 64-bit VM and build from there. Otherwise, yes, you will need to build a gcc cross toolchain.
Good ressources for building a gcc cross toolchain :
Building and Testing gcc/glibc cross toolchains
GCC Cross-Compiler
Cross Compiling With GCC
yes, its possible and actually quite simple. Just install gcc-multilib.
Yes, this should be possible. It's certainly possible on Mac OS X, where Apple's gcc toolchain supports x86, x86-64, ppc and ppc64, and you can compile for all 4 targets from a development machine that is 32 bit or 64 bit.
You'd need to set up a cross compiler. And don't bother. Just run a 64-bit VM instead. You can run 64-bit VMs on a 32-bit host OS provided the CPU supports it (which it will, unless it's ancient).

Will a program complied in 64-bit work on 32-bit machine?

As title said, I have C program complied and created a binary in 64-bit machine.Will this binary work under 32-bit ?
64-bit binaries cannot run on a 32-bit OS. If file reports ELF 64-bit, you have a 64-bit binary.
In order to build 32-bit binaries on a 64-bit Linux, you need pass -m32 to gcc. You also need to have 32-bit libraries installed (sudo apt-get install libc6-dev-i386).
The compiling machine does not matter. What matters is: is the code generated 32 bits (answer: yes) or 64 bits (answer: no).
Will it work on a 32-bit machine? One with a CPU which doesn't support 64-bit mode? No.
Will it work on a 64-bit VM on a 32-bit native OS? Yes, in my experience.
A surprising result is that 64-bit VMs CAN be run under a 32-bit host OS, provided the CPU is capable and you don't want to allocate too much ram (>2G or thereabouts) to the guest.

Resources