Compiling and linking a 32 bit application on Debian 64 bit
There are two problems:
- Your link command is incorrect: the order of libraries on the link line matters. The command should be:
gcc -m32 $^ -o $@ -lcurses
- Since you want to link against ncurses, make the last argument
-lncurses
.
How to Compile 32-bit Apps on 64-bit Ubuntu?
To get Ubuntu Server 12.04 LTS 64-bit to compile gcc 4.8 32-bit programs, you'll need to do two things.
Make sure all the 32-bit gcc 4.8 development tools are completely installed:
sudo apt-get install lib32gcc-4.8-dev
Compile programs using the -m32 flag
gcc pgm.c -m32 -o pgm
Linking with 32bit libraries under linux 64bit
Well, you can't mix and match 32-bit and 64-bit code. If you compile all your code using -m32
(to make it build as 32-bit), you may be able to get your application to link if you have 32-bit versions of all your libraries available.
Linking 32-bit library to 64-bit program
No. You can't directly link to 32bit code inside of a 64bit program.
The best option is to compile a 32bit (standalone) program that can run on your 64bit platform (using ia32), and then use a form of inter-process communication to communicate to it from your 64bit program.
Related Topics
Add Timestamp to Cat Output from Shell Script
Pte Structure in The Linux Kernel
I Need a Binary Comparison Tool for Win/Linux
Getting "Permission Denied" on Dirname and Basename
How to Make Fork Changes Reflect with The Master When Updated
Where Is User's Cron Job Stored After "Crontab -E"
Apt-Update in Azure Nvidia Gives Publickey Error
Setting The Umask of The Jenkins Process
Elf File Tls and Load Program Sections
Svn Setup of Existing Directory
Nasm X86_64 Assembly in 32-Bit Mode: Why Does This Instruction Produce Rip-Relative Addressing Code
Linux Telnet Vt100 Return Key Sends ^M
Mongodb (Result= Signal, Code = Killed, Signal = Ill
How to Remove Everything Else in a Folder Except Filea