MASM x86 assembly program compile on linux platform - masm

I am new for x86 assembly programming ,currently i am compiling and executing x86 assembly programs on visual studio with MASM assembler, still it is working, but i don't have clear how to x86 programs compile and execute on linux platform, could you any one explain me
advance thanks
By
Ajith

You can use wine to run MASM code in Linux using emulator8086.
install wine : sudo apt-get install wine
Here is link for emulator: http://www.emu8086.com/

Related

Install gcc in 32 bit ARM architecture

I've installed BuildRoot, to set a SoftetherVPN.
Well, my problem is that I necessary need to install GCC, in a 32-bit ARM Architecture, (obviously I've downloaded the 32 bit version).
I looked all over the internet, because of many problems:
My first idea was to install GCC using command sudo apt-get or sudo yum, but I can only find it in Debian Linux (Buildroot kernel, and its toolchain are very reduced).
At this point I tried to cross-compiling GCC but with no results, because it produced in shell output Library errors. And I also tried to paste those missing libraries yet achieve very little.
You could download some GCC cross-compiler. For example, if your PC is running some Debian-like Linux distribution -perhaps Ubuntu- you might install some gcc-7-arm-linux-gnueabi or similar (gcc-7-arm-linux-gnueabihf ...) package.
The SDK for your board is likely to provide some cross-GCC & cross-binutils.
You could build some cross binutils then some GCC cross-compiler from their source code (this is a bit more tricky).
Your cross-compiler would compile (for ARM) on your Linux-running PC, not on your ARM circuit board.

Creating a DLL file of C program on ubuntu [duplicate]

I have written some effects in C++ (g++) using freeglut on Linux, and I compile them with
g++ -Wall -lglut part8.cpp -o part8
So I was wondering if it is possible to have g++ make static compiled Windows executables that contains everything needed?
I don't have Windows, so it would be really cool, if I could do that on Linux :)
mingw32 exists as a package for Linux. You can cross-compile and -link Windows applications with it. There's a tutorial here at the Code::Blocks forum. Mind that the command changes to x86_64-w64-mingw32-gcc-win32, for example.
Ubuntu, for example, has MinGW in its repositories:
$ apt-cache search mingw
[...]
g++-mingw-w64 - GNU C++ compiler for MinGW-w64
gcc-mingw-w64 - GNU C compiler for MinGW-w64
mingw-w64 - Development environment targeting 32- and 64-bit Windows
[...]
Suggested method gave me error on Ubuntu 16.04: E: Unable to locate package mingw32
===========================================================================
To install this package on Ubuntu please use following:
sudo apt-get install mingw-w64
After install you can use it:
x86_64-w64-mingw32-g++
Please note!
For 64-bit use: x86_64-w64-mingw32-g++
For 32-bit use: i686-w64-mingw32-g++
One option of compiling for Windows in Linux is via mingw. I found a very helpful tutorial here.
To install mingw32 on Debian based systems, run the following command:
sudo apt-get install mingw32
To compile your code, you can use something like:
i586-mingw32msvc-g++ -o myApp.exe myApp.cpp
You'll sometimes want to test the new Windows application directly in Linux. You can use wine for that, although you should always keep in mind that wine could have bugs. This means that you might not be sure that a bug is in wine, your program, or both, so only use wine for general testing.
To install wine, run:
sudo apt-get install wine
Install a cross compiler, like mingw64 from your package manager.
Then compile in the following way: instead of simply calling gcc call i686-w64-mingw32-gcc for 32-bit Windows or x86_64-w64-mingw32-gcc" for 64-bit Windows. I would also use the --static option, as the target system may not have all the libraries.
If you want to compile other language, like Fortran, replace -gcc with -gfortran in the previous commands.
I've used mingw on Linux to make Windows executables in C, I suspect C++ would work as well.
I have a project, ELLCC, that packages clang and other things as a cross compiler tool chain. I use it to compile clang (C++), binutils, and GDB for Windows. Follow the download link at ellcc.org for pre-compiled binaries for several Linux hosts.
From: https://fedoraproject.org/wiki/MinGW/Tutorial
As of Fedora 17 it is possible to easily build (cross-compile) binaries for the win32 and win64 targets. This is realized using the mingw-w64 toolchain: http://mingw-w64.sf.net/. Using this toolchain allows you to build binaries for the following programming languages: C, C++, Objective-C, Objective-C++ and Fortran.
"Tips and tricks for using the Windows cross-compiler": https://fedoraproject.org/wiki/MinGW/Tips
For Fedora:
# Fedora 18 or greater
sudo dnf group install "MinGW cross-compiler"
# Or (not recommended, because of its deprecation)
sudo yum groupinstall -y "MinGW cross-compiler"

How to create .exe executable file in Linux Ubuntu by .c source file [duplicate]

I have written some effects in C++ (g++) using freeglut on Linux, and I compile them with
g++ -Wall -lglut part8.cpp -o part8
So I was wondering if it is possible to have g++ make static compiled Windows executables that contains everything needed?
I don't have Windows, so it would be really cool, if I could do that on Linux :)
mingw32 exists as a package for Linux. You can cross-compile and -link Windows applications with it. There's a tutorial here at the Code::Blocks forum. Mind that the command changes to x86_64-w64-mingw32-gcc-win32, for example.
Ubuntu, for example, has MinGW in its repositories:
$ apt-cache search mingw
[...]
g++-mingw-w64 - GNU C++ compiler for MinGW-w64
gcc-mingw-w64 - GNU C compiler for MinGW-w64
mingw-w64 - Development environment targeting 32- and 64-bit Windows
[...]
Suggested method gave me error on Ubuntu 16.04: E: Unable to locate package mingw32
===========================================================================
To install this package on Ubuntu please use following:
sudo apt-get install mingw-w64
After install you can use it:
x86_64-w64-mingw32-g++
Please note!
For 64-bit use: x86_64-w64-mingw32-g++
For 32-bit use: i686-w64-mingw32-g++
One option of compiling for Windows in Linux is via mingw. I found a very helpful tutorial here.
To install mingw32 on Debian based systems, run the following command:
sudo apt-get install mingw32
To compile your code, you can use something like:
i586-mingw32msvc-g++ -o myApp.exe myApp.cpp
You'll sometimes want to test the new Windows application directly in Linux. You can use wine for that, although you should always keep in mind that wine could have bugs. This means that you might not be sure that a bug is in wine, your program, or both, so only use wine for general testing.
To install wine, run:
sudo apt-get install wine
Install a cross compiler, like mingw64 from your package manager.
Then compile in the following way: instead of simply calling gcc call i686-w64-mingw32-gcc for 32-bit Windows or x86_64-w64-mingw32-gcc" for 64-bit Windows. I would also use the --static option, as the target system may not have all the libraries.
If you want to compile other language, like Fortran, replace -gcc with -gfortran in the previous commands.
I've used mingw on Linux to make Windows executables in C, I suspect C++ would work as well.
I have a project, ELLCC, that packages clang and other things as a cross compiler tool chain. I use it to compile clang (C++), binutils, and GDB for Windows. Follow the download link at ellcc.org for pre-compiled binaries for several Linux hosts.
From: https://fedoraproject.org/wiki/MinGW/Tutorial
As of Fedora 17 it is possible to easily build (cross-compile) binaries for the win32 and win64 targets. This is realized using the mingw-w64 toolchain: http://mingw-w64.sf.net/. Using this toolchain allows you to build binaries for the following programming languages: C, C++, Objective-C, Objective-C++ and Fortran.
"Tips and tricks for using the Windows cross-compiler": https://fedoraproject.org/wiki/MinGW/Tips
For Fedora:
# Fedora 18 or greater
sudo dnf group install "MinGW cross-compiler"
# Or (not recommended, because of its deprecation)
sudo yum groupinstall -y "MinGW cross-compiler"

Cross-compiling and running hello world for ARM Linux

I'm trying to run hello world program on ARM computer with Linux (Debian Wheezy). The libc version on it is 2.13, while my own computer has 2.15 (Ubuntu Precise).
I installed arm-linux-gnueabi-gcc on my computer and compiled the application with static linkage.
All my attempts to run compiled binary result in "cannot execute binary file" message. However, QEMU on my own computer (qemu-arm-static) runs the application succesfully.
I thought that it should be enough to link my app statically. The permissions are 755. What am I missing here?
UPD: I tried to install Arch Linux on that ARM. In that distribution my compiled binaries crash with segfault instead of bash error message. Does stock cross compiler in Ubuntu distribution ever work? :-/
Thanks!

Can't find gcc compiler

I am running Fedora 19 via VMware and I want to compile and run, a simple C program. However, after running which gcc I get:
/usr/bin/which: no gcc in (/home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin:/home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin_cache:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/demetres/.local/bin:/home/demetres/bin)
It hasn't been a long time, since I installed Sourcery CodeBench Lite, an ARM cross-compiler, for a project I'm working on. Is there a problem with cross-compiler? Othewise, what is required to compile and run the program?
p.s. This specific program is not intended for an ARM platform.
Try yum install gcc for reinstalling.

Resources