Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6983061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:22:11+00:00 2026-05-27T18:22:11+00:00

I have a 64 bit Ubuntu Operating System and I have been learning 32

  • 0

I have a 64 bit Ubuntu Operating System and I have been learning 32 bit Assembly. I am trying to compile these two files:

square.s:

#square.s

.section .text
.globl sqr
.type sqr, @function
sqr:
    pushl %ebp
    movl %esp, %ebp
    movl 8(%ebp), %eax
    imull %eax, %eax
    popl %ebp
    ret

main.c :

//main.c
#include <stdio.h>
extern long sqr(long);
int main(int argc, char* argv[])
{
    long squared = sqr(10);
    printf("%lu\n", squared);
    return 0;
}

On my 32bit Virtual Machine I compiled them with this command

  gcc main.c square.s -o test

and it worked. The problem I am having is that I would like to compile these files on my 64bit machine. I have tried several ways of compiling these files but none have worked.
Can anyone point me in the right direction? Is there an option to do this? I have tried -m32 but that didn’t work.

When I do this:

  gcc -m32 -o test main.c square.s

I get this:

  In file included from /usr/include/stdio.h:28:0,
             from main.c:1:
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:22:12+00:00Added an answer on May 27, 2026 at 6:22 pm

    Compiling / Linking 32-bit program on 64 bit ubuntu need gcc-multilib, try:

    sudo apt-get install gcc-multilib libc6-i386 lib6-dev-i386
    

    However, this may have other problem when you try to link other libraries.

    You would have better luck using a 32-bit chroot environment (i.e. running a 32-bit root on your 64-bit ubuntu).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a very simple OpenGL-app under Ubuntu 10.04 (I have a
I have tried to use setjmp/longjmp in 64 bit Ubuntu, but it doesn't properly
First a bit of background. I have been working on the MS platform for
Ubuntu 10.04 64-bit looks promising as a development environment for Android. I now have
I have set up a 64 bit ubuntu env for compiling android tools (aapt,
Ubuntu 11.04 64-bit [Tried on SuSE 32-bit, and got same error], I have gcc,
I'm debugging my CUDA 4.0/Thrust-based image reconstruction code on my Ubuntu 10.10 64-bit system
My desktop and laptop machines have 64 bit and 32 bit Ubuntu 10.10's running
I have a simple C++ program compiled using gcc 4.2.4 on 32-bit Ubuntu 8.04.
I have a 32 bit machine and I am running Ubuntu 9.10 on it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.