LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-06-2013, 12:34 PM   #1
jdubya
LQ Newbie
 
Registered: Nov 2013
Distribution: LinuxMintNadia vers12.10
Posts: 9

Rep: Reputation: Disabled
linux mint 64bit package required to compile 32bit nasm code


Hello all. I'm new and this is my first post. I'm an assembly student and I need my 64bit linux mint (nadia) to compile code I write for my x86 class using nasm. I have searched google for the answer but haven't found the right package to download yet. Thanks in advance for your help. I would also like to know if I need to install anything to make C calls (printf, scanf, etc.)in my code. Thanks in advance for your help.
 
Old 11-06-2013, 01:04 PM   #2
paladin.michael
Member
 
Registered: Jun 2011
Location: Danbury, CT, USA
Distribution: Kubuntu, Slackware, Debian, FreePBX
Posts: 72

Rep: Reputation: 22
In my Kubuntu installation I can just run
Quote:
$ sudo apt-get install nasm
to get the assembler installed, you should have access to apt in mint.
 
Old 11-06-2013, 03:47 PM   #3
jdubya
LQ Newbie
 
Registered: Nov 2013
Distribution: LinuxMintNadia vers12.10
Posts: 9

Original Poster
Rep: Reputation: Disabled
Nasm is already installed. My professor said it was "probably the gcc libraries (lib32gcc1)". When I search that I get an ubuntu page with 14 32bit packages.
 
Old 11-06-2013, 04:15 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,364

Rep: Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004
With Ubuntu/Mint you generally just throw a ":i386" onto the end of the package name to get the 32-bit version.

For example:
Code:
sudo apt-get install libc:i386 libgcc:i386 libstdc++:i386
etc.
 
1 members found this post helpful.
Old 11-06-2013, 04:19 PM   #5
paladin.michael
Member
 
Registered: Jun 2011
Location: Danbury, CT, USA
Distribution: Kubuntu, Slackware, Debian, FreePBX
Posts: 72

Rep: Reputation: 22
Maybe it's just been too long since my assembly class or maybe it has to do with us entering our programs directly in to an 8086 primer device with apair of 7 led displays, but What kind of code are you trying to compile and what output format are you expecting which you're not getting? What commands are you using? Do you get any errors?
 
Old 11-06-2013, 06:18 PM   #6
jdubya
LQ Newbie
 
Registered: Nov 2013
Distribution: LinuxMintNadia vers12.10
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
With Ubuntu/Mint you generally just throw a ":i386" onto the end of the package name to get the 32-bit version.

For example:
Code:
sudo apt-get install libc:i386 libgcc:i386 libstdc++:i386
etc.
Thanks for your help!
After that install I got this message:
E: Unable to locate package libc
E: Unable to locate package libgcc
 
Old 11-06-2013, 06:34 PM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,364

Rep: Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004
When you type libc, hit tab a few times, it should present you with a list of the actual package names. They're probably more like libc6, libgcc1, etc. I don't use Ubuntu or any of its derivatives, so I can't check/confirm. You can also use apt-get search to find them.
 
Old 11-06-2013, 06:44 PM   #8
jdubya
LQ Newbie
 
Registered: Nov 2013
Distribution: LinuxMintNadia vers12.10
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by paladin.michael View Post
Maybe it's just been too long since my assembly class or maybe it has to do with us entering our programs directly in to an 8086 primer device with apair of 7 led displays, but What kind of code are you trying to compile and what output format are you expecting which you're not getting? What commands are you using? Do you get any errors?
I'm getting these errors:

/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status

I'm trying to compile and execute the example program below that I copied from a nasm tutorial.

Code:
SECTION .data
 
       message1: db "Enter the first number: ", 0
        message2: db "Enter the second number: ", 0
        formatin: db "%d", 0
        formatout: db "%d", 10, 0 ; newline, nul terminator

        integer1: times 4 db 0
        integer2: times 4 db 0    ; 32-bits integer = 4 bytes

SECTION .text

        global main

        extern scanf
        extern printf

     main:
        push ebx        ;save registers
        push ecx

        push message1
        call printf
        add esp, 4      ;remove parameters

        push integer1   ;address of integer1 (second parameter)
        push formatin   ; args are right to left (first parameter)
        call scanf
        add esp, 8      ; remove parameters

        push message2
        call printf
        add esp, 4      ; remove parameters

        push integer2   ; address of integer2
        push formatin   ; arguments are right ot left
        call scanf
        add esp, 8      ; remove parameters

        mov ebx, dword [integer1]
        mov ecx, dword [integer2]
        add ebx, ecx    ; add the values

        push ebx
        push formatout
        call printf     ; display the sum
        add esp, 8      ; remove parameters

        pop ecx
        pop ebx         ; restore registers in reverse order
        mov eax, 0      

     ret

Last edited by jdubya; 11-06-2013 at 08:13 PM.
 
Old 11-07-2013, 10:48 AM   #9
paladin.michael
Member
 
Registered: Jun 2011
Location: Danbury, CT, USA
Distribution: Kubuntu, Slackware, Debian, FreePBX
Posts: 72

Rep: Reputation: 22
Ok, I think the package you need to install is called gcc-multilib

Quote:
sudo apt-get install gcc-multilib
 
Old 11-07-2013, 11:59 AM   #10
jdubya
LQ Newbie
 
Registered: Nov 2013
Distribution: LinuxMintNadia vers12.10
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by paladin.michael View Post
Ok, I think the package you need to install is called gcc-multilib
You're absolutely right! Thanks for your help Michael Paladin.
 
Old 11-07-2013, 12:01 PM   #11
paladin.michael
Member
 
Registered: Jun 2011
Location: Danbury, CT, USA
Distribution: Kubuntu, Slackware, Debian, FreePBX
Posts: 72

Rep: Reputation: 22
Glad I could help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Convert NASM 32bit package to 64bit Dornith Slackware 3 07-28-2012 04:34 PM
Fedora 13 32bit and then Linux Mint 32bit and then Ubuntu 10.04 32bit ciao303 Linux - Newbie 3 08-10-2010 12:03 AM
possible to compile a 32bit kernel on a 64bit os? Shadowmeph Linux - General 5 10-02-2008 07:07 AM
How to compile source code as 32bit under 64bit OS. Brian1 Linux - Software 2 12-15-2007 03:35 PM
can I have a 64bit snd a 32bit package installed linuxmandrake Linux - Software 2 10-20-2005 10:48 AM


All times are GMT -5. The time now is 04:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration