LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 05-06-2015, 02:39 AM   #1
AbdulWahab
LQ Newbie
 
Registered: Apr 2015
Posts: 28

Rep: Reputation: Disabled
how to make .bin file of c code


I have simple c code and I want to make .bin file to run on friendly arm board. In redhat I install cross compile gcc and Use "gcc -o hello hello.c" this command to make object file. when I run this file in friendly arm it give "line 1: syntax error: unexpected "(" "

Thanks
--
Abdul Wahab
 
Old 05-06-2015, 04:00 AM   #2
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
This looks more like shell error rather than a problem with the binary. What command do you use to run the program and what is your shell?
 
Old 05-07-2015, 11:56 PM   #3
AbdulWahab
LQ Newbie
 
Registered: Apr 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Thanks millgates to reply I use "./Hello" this command to execute binary file and what do you mean by shell

--
Abdul Wahab
 
Old 05-08-2015, 12:09 AM   #4
AbdulWahab
LQ Newbie
 
Registered: Apr 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Can you please give me the .bin file of c code so I can check it on my development board

--
Abdul Wahab
 
Old 05-08-2015, 01:55 AM   #5
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
So is it hello or Hello?
anyway, what is the output of
Code:
file hello
 
Old 05-08-2015, 01:57 AM   #6
AbdulWahab
LQ Newbie
 
Registered: Apr 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
"Hello PAFKIET"

--
Abdul Wahab
 
Old 05-08-2015, 02:01 AM   #7
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Ehm, that is what your program is supposed to output, right? What I meant was that you open a terminal, cd to the directory that contains the file and type (literaly) "file hello" and post the output here.
 
Old 05-08-2015, 02:11 AM   #8
AbdulWahab
LQ Newbie
 
Registered: Apr 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
I typed literaly file Hello in terminal so it give "literaly: not found"

--
Abdul Wahab
 
Old 05-08-2015, 02:18 AM   #9
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
OK, just type file hello
 
Old 05-08-2015, 02:23 AM   #10
AbdulWahab
LQ Newbie
 
Registered: Apr 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
I typed file Hello so it give "file: not found" this msg and when I typed only Hello-c so it give "line 1: syntax error: unexpected "(" " this msg
 
Old 05-08-2015, 02:32 AM   #11
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
that's strange. In any case, whatever you're trying to run is likely not a valid arm executable. You cannot run a c source and you cannot run a x86 or x64 ELF executables on arm. If you want to run a binary on an arm, you have to either
a/ compile the program on the arm machine, if possible, or
b/ cross-compile the program (that is compile it on a different (x86/64 or whatever) computer, but with a toolchain specifically set to create an arm executable. (search the internet for tutorials on how to do that)
 
Old 05-08-2015, 02:34 AM   #12
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
What is the OS on the arm machine?
 
Old 05-08-2015, 03:05 AM   #13
AbdulWahab
LQ Newbie
 
Registered: Apr 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
Qtopia on arm machine and I installed Redhat 9 on Vmware
 
Old 05-08-2015, 04:16 AM   #14
koloth
Member
 
Registered: Jun 2004
Location: Athens, Greece
Distribution: Slackware 14.1 - Salix Xfce 14.1
Posts: 113

Rep: Reputation: 24
Quote:
Originally Posted by AbdulWahab View Post
Qtopia on arm machine and I installed Redhat 9 on Vmware
Are you actually referring to Red Hat linux 9?
I'm I wrong or was that created in like 2004?

Last edited by koloth; 05-08-2015 at 04:17 AM. Reason: missing word
 
Old 05-09-2015, 10:37 AM   #15
AbdulWahab
LQ Newbie
 
Registered: Apr 2015
Posts: 28

Original Poster
Rep: Reputation: Disabled
I don't understand "was that created in like 2004"

--
Abdul Wahab
 
  


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
How do I create a usable .bin file from source code? friendlybear Linux - General 5 08-27-2012 08:24 PM
make with make file yields error: /usr/bin/javac: cannot execute binary file bweaver Ubuntu 4 11-19-2010 02:58 PM
How do i create a .bin file for linux from my java source code ojerag Programming 4 01-04-2010 09:45 AM
Make Trouble linking some fortran code Make file problem? any ideas? TheBrick Linux - General 0 05-17-2006 11:21 AM
I accidentally deleted make file in /usr/local/bin, now cannot use make command.... Niceman2005 Linux - Software 2 11-17-2004 07:55 PM


All times are GMT -5. The time now is 10:01 PM.

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