LinuxQuestions.org
Help answer threads with 0 replies.
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-10-2010, 08:27 PM   #1
Jadebrain
LQ Newbie
 
Registered: Nov 2010
Posts: 6

Rep: Reputation: 0
Windows user trying to open NASM in Linux


Hello,
As the title suggests, I am accustomed to Windows, and I am inexperienced with Linux. What I am trying to do is open NASM in Linux Mint. After several (poorly made) attempts at finding binaries on the hard drive that might open NASM, I have concluded that the problem is my own inexperience.

I have installed NASM using Synaptic in hopes that I might learn x86 assembly, and I am using Linux as that is the OS that is used in the book I am using to teach myself. Unfortunately, as I have stated, I cannot even figure out how to open NASM, and thus I cannot test what I have learned.
 
Old 11-10-2010, 09:55 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
You can try to find the nasm binary using any of the following.
Code:
which nasm
locate nasm
find / -type f -name nasm
The binary should have been installed in one of the system binary directories such as /bin or /usr/bin or some directory that is in your PATH environment variable. I just installed it. The nasm binary ended up in /usr/bin on my Ubuntu 10.04 system.
Code:
echo $PATH
All of this should be done in a terminal.

When you say that you cannot open nasm I wonder if you think it is going to open a window. It won't. It is a command line utility. You use it by opening a terminal window and typing nasm followed by the appropriate arguments.

I got the following example from
http://linux.about.com/library/bl/op...cfunctions.htm
Code:
nasm -f bin -o hello hello.asm && chmod +x hello
 
Old 11-10-2010, 10:04 PM   #3
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
nasm is a command line utility so you will need to be in a terminal. It will be in your PATH by default so you should be able to run it simply by typing it's name

eg. ( in a terminal )
Code:
nasm -g -f elf test.asm
ld -o test test.o
cheers
 
Old 11-12-2010, 08:48 PM   #4
Jadebrain
LQ Newbie
 
Registered: Nov 2010
Posts: 6

Original Poster
Rep: Reputation: 0
So, I'm assuming, I would have to make a program first, then I would have to use the terminal, typing "nasm," then typing the name of the file afterwards in order to open the program?
 
Old 11-12-2010, 09:37 PM   #5
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Quote:
Originally Posted by Jadebrain View Post
So, I'm assuming, I would have to make a program first, then I would have to use the terminal, typing "nasm," then typing the name of the file afterwards in order to open the program?
Yes.
 
Old 11-13-2010, 08:58 AM   #6
Jadebrain
LQ Newbie
 
Registered: Nov 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Thank you for your help. As of yet, I haven't written any programs (as previously, I thought that opening the assembler would bring up a window that I could type the program into), but I have confidence in the instructions given. Once again, thank you.
 
Old 11-13-2010, 09:06 AM   #7
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Actually the assember (nasm) will create an object file. That file will have to be linked to create an executable file. Then you use the chmod utility to change the file permissions on the executable file. This will allow the operating system to run it.
Code:
chmod a+x filename
Here is a nasm tutorial.
http://en.kioskea.net/faq/1559-compi...gram-with-nasm

Last edited by stress_junkie; 11-13-2010 at 09:11 AM.
 
1 members found this post helpful.
Old 11-13-2010, 12:34 PM   #8
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Quote:
Originally Posted by Jadebrain View Post
(as previously, I thought that opening the assembler would bring up a window that I could type the program into),
Nasm doesn't work that way on Windows either. It is a command line program, not a GUI.

Most people use a text editor for typing in the asm program. On Linux I use kwrite as a text editor.

Setting up an IDE such as KDevelop for use with nasm both as an editor for typing in the program and as a front end for the debugger is a moderate amount of work and not well documented. But it may be worth the effort to make your continued use of nasm easier.

Once set up (the hard part) KDevelop integrated with nasm would work the way you apparently expected nasm to work on its own.
 
Old 11-13-2010, 04:03 PM   #9
peonuser
Member
 
Registered: Mar 2008
Location: Where ever I am.
Distribution: Various
Posts: 177
Blog Entries: 166

Rep: Reputation: 21
I found this and it worked for me:
http://en.kioskea.net/faq/1559-compi...gram-with-nasm


older example
http://www.csee.umbc.edu/portal/help...le.shtml#hello

Last edited by peonuser; 11-13-2010 at 04:08 PM.
 
Old 11-13-2010, 06:11 PM   #10
Jadebrain
LQ Newbie
 
Registered: Nov 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by johnsfine View Post
Nasm doesn't work that way on Windows either. It is a command line program, not a GUI.

Most people use a text editor for typing in the asm program. On Linux I use kwrite as a text editor.

Setting up an IDE such as KDevelop for use with nasm both as an editor for typing in the program and as a front end for the debugger is a moderate amount of work and not well documented. But it may be worth the effort to make your continued use of nasm easier.

Once set up (the hard part) KDevelop integrated with nasm would work the way you apparently expected nasm to work on its own.
Yeah, I was basing my assumption on previous experiences with various C++ compilers on Windows, such as DevC++ (I think that is what it was called). On a side note, I have never actually learned C++; what I am trying to learn now is my first programing language. I have heard that it would be easier to learn other languages, but I have also heard that learning assembly first would make it even easier to learn said languages.

Call me inexperienced (and you'd be right in doing so), but when I see the acronym IDE, I think of the IDE cable that connects older hard drives to motherboards. I have seen IDE used for other purposes, such as the way you're using it, but I have no clue what IDE means when it is used like that.
 
Old 11-13-2010, 06:27 PM   #11
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
IDE = Integrated Development Environment
 
1 members found this post helpful.
Old 11-14-2010, 05:58 AM   #12
peonuser
Member
 
Registered: Mar 2008
Location: Where ever I am.
Distribution: Various
Posts: 177
Blog Entries: 166

Rep: Reputation: 21
This might be a start:

http://ubuntuforums.org/showthread.php?t=470698
 
Old 11-14-2010, 07:37 AM   #13
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Quote:
Originally Posted by Jadebrain View Post
Yeah, I was basing my assumption on previous experiences with various C++ compilers on Windows, such as DevC++
Visual Studio or Dev Studio is Microsoft's IDE. It is integrated with Microsoft Visual C++ (and other languages). Since they are purchased together (or downloaded together for "express edition") and used together, the distinction between the compiler and the IDE is somewhat hidden. But the part you thought was the compiler is actually the IDE.

Linux does not have an IDE as full featured as Dev Studio nor as easy to install correctly. Linux software is typically easier to install than Windows software, but IDE's are an exception. Most parts of any IDE are optional, so its maintainers don't want it bloated by having it install every optional part. But no one seems to have a good solution to getting all the right parts installed. Microsoft Dev Studio leans much more toward a bloated default install to reduce the chance that the options you need are missing.

Quote:
I have never actually learned C++; what I am trying to learn now is my first programing language. I have heard that it would be easier to learn other languages, but I have also heard that learning assembly first would make it even easier to learn said languages.
I think you would be much better off learning C++ first. If you learn something about programming along with your first programming language then whatever language you learn first will make the next ones easier. There is no useful beginner subset of asm programming. Anything a beginner can do in asm will be so pointless and silly that it doesn't teach much in the way of programming concepts. There is no point to selecting such a hard language first.

The right subset of C++ would be far easier for a beginning programmer to learn, while still powerful enough to write interesting programs that help teach important programming lessons.

If you really, really want to learn asm first, nasm is still not a good choice. Almost any nasm tutorial you find assumes you are running in DOS or an emulation of DOS. That is not a good fit for Linux. The Gnu Assember is a better choice for learning assembler on Linux (still a much worse choice than learning C++ first, but better than nasm). Long ago, I contributed some time and ideas and debugging, etc. to the nasm project. So I think I'm more likely to be biased in favor of nasm than against it. But the objective arguments against nasm outweigh that bias.

Quote:
Originally Posted by peonuser View Post
I don't see how! That is a three year old discussion where the right question is asked, but then seems to be discussed only by people who don't know the answer, then some minor (probably obsolete) info about eclipse is tacked on the end.

Last edited by johnsfine; 11-14-2010 at 07:48 AM.
 
1 members found this post helpful.
Old 11-14-2010, 10:00 AM   #14
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora
Posts: 1,924

Rep: Reputation: 278Reputation: 278Reputation: 278
You can't learn oo techniques from a book. You must learn very basic things first. It's like trying to learn to play a guitar by reading a book. If you don't understand programming itself, learning a programming language won't be much help.
 
1 members found this post helpful.
Old 11-14-2010, 11:20 AM   #15
Jadebrain
LQ Newbie
 
Registered: Nov 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by johnsfine View Post
I think you would be much better off learning C++ first. If you learn something about programming along with your first programming language then whatever language you learn first will make the next ones easier. There is no useful beginner subset of asm programming. Anything a beginner can do in asm will be so pointless and silly that it doesn't teach much in the way of programming concepts. There is no point to selecting such a hard language first.

The right subset of C++ would be far easier for a beginning programmer to learn, while still powerful enough to write interesting programs that help teach important programming lessons.
Very well, then. I will try to learn C++ first. The only other reason I wanted to learn assembly first is because I found a cheap, well-rated book that claimed to be for beginners in programming. Other than that, I will put off assembly language for another time. Thank you for your 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
Linux->Nasm->Flush ports yousafsajjad Programming 2 07-10-2010 12:21 AM
samba and windows: can not open user share dainsane1 Linux - Networking 4 11-13-2009 04:32 PM
how to open X windows after su'ing to another user? BrianK Linux - General 7 11-18-2008 01:42 AM
Installing nasm for linux enduser000 Programming 9 07-30-2008 02:43 PM
Windows user thinks open source is crap tribalmasters General 33 09-16-2005 03:18 PM


All times are GMT -5. The time now is 06:40 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