LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 01-12-2004, 07:14 AM   #1
smirnoff
LQ Newbie
 
Registered: Sep 2003
Location: ChCh, New Zeleand
Distribution: RH9
Posts: 18

Rep: Reputation: 0
problems compiling from source in RH9


when trying to compile an extracted tar.gz file from source i get an error for

sh ./config

saying something along the lines of:

# Testing to see if can compile in C --- config error: compiling in c failed

I've got all DK packages installed from RH9 CDs so I dont know why i get this error, but I get it for various source programs when running ./config so i have no idea what problem is

I'll include the actuall error message tommorow if that would be helpful, I'm too tired to boot up my linux system again tonight
 
Old 01-12-2004, 12:27 PM   #2
lone_nut
Member
 
Registered: Dec 2003
Location: Denmark
Distribution: Mandrake
Posts: 179

Rep: Reputation: 30
Do you have installed the gcc ore any other compiler? My guess is, that you proberly didn't install the compiler. It comes with your distribution, but if you didn't install it, you can't compile ANYTHING. To check if it is installed, type:
gcc --version.
If your computer, can't find gcc. you will need to locate, and install all the packages, that has something to do with gcc.
Don't try to save space, gcc is worth the space a thousand times.

Last edited by lone_nut; 01-12-2004 at 12:30 PM.
 
Old 01-12-2004, 05:16 PM   #3
smirnoff
LQ Newbie
 
Registered: Sep 2003
Location: ChCh, New Zeleand
Distribution: RH9
Posts: 18

Original Poster
Rep: Reputation: 0
the error message :

[rob@localhost k3b_burner]$ cd id3lib-3.8.3
[rob@localhost id3lib-3.8.3]$ sh ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets ${MAKE}... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

and I do have gcc installed :

[rob@localhost id3lib-3.8.3]$ gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I've installed every Developer Kit package on the CD

what could be the problem?
 
Old 01-12-2004, 05:58 PM   #4
TheOneAndOnlySM
Member
 
Registered: Jul 2003
Location: Dallas, TX
Distribution: Ubuntu 10.04 LTS
Posts: 987

Rep: Reputation: 30
try just doing ./configure instead of sh ./configure
 
Old 01-12-2004, 06:25 PM   #5
smirnoff
LQ Newbie
 
Registered: Sep 2003
Location: ChCh, New Zeleand
Distribution: RH9
Posts: 18

Original Poster
Rep: Reputation: 0
that doesnt work, just comes up saying something about errors and bash/sh
 
Old 01-13-2004, 08:55 AM   #6
lone_nut
Member
 
Registered: Dec 2003
Location: Denmark
Distribution: Mandrake
Posts: 179

Rep: Reputation: 30
okay, try to see, if you can compile and run the code below. if you can, i have no idea of what is wrong. if you can't run the output program, i would say the problem lies in your compiler. If so, you can get a new compiler from http://www.gnu.org.
Code:
#include<stdio.h>
int main(void)
{
printf("hhm strange, your compiler does work");
}
hope it helps
 
Old 01-17-2004, 12:23 PM   #7
smirnoff
LQ Newbie
 
Registered: Sep 2003
Location: ChCh, New Zeleand
Distribution: RH9
Posts: 18

Original Poster
Rep: Reputation: 0
how do i use gcc for this file (any params)? What extension do I give the file; .c, .h, .i ??
after compilation is there any trick to running it?
 
Old 01-18-2004, 05:46 AM   #8
lone_nut
Member
 
Registered: Dec 2003
Location: Denmark
Distribution: Mandrake
Posts: 179

Rep: Reputation: 30
save it to any file, with the ending in .c.
compile it using gcc filename -o test
and then start it using:
./test
 
Old 01-19-2004, 05:54 AM   #9
smirnoff
LQ Newbie
 
Registered: Sep 2003
Location: ChCh, New Zeleand
Distribution: RH9
Posts: 18

Original Poster
Rep: Reputation: 0
i get the following:

[root@localhost ,linux]# gcc foobar.c -o test
foobar.c:5:2: warning: no newline at end of file
[root@localhost ,linux]# ./test
bash: ./test: Permission denied

where foobar.c is the code from above

Am i doing something wrong or is it my compiler?
 
Old 01-19-2004, 09:22 AM   #10
lone_nut
Member
 
Registered: Dec 2003
Location: Denmark
Distribution: Mandrake
Posts: 179

Rep: Reputation: 30
your compiler should have changed the permisions on the file to executable. Doing so, is required to be able to run the program. To manualy assign execute permision to the program, run:
chmod +x test
then you should be able to run the program.
Why the compiler doesn't set the permisions, i have no idea, but it is a normal feature of gcc.

Last edited by lone_nut; 01-19-2004 at 09:35 AM.
 
Old 01-19-2004, 03:20 PM   #11
smirnoff
LQ Newbie
 
Registered: Sep 2003
Location: ChCh, New Zeleand
Distribution: RH9
Posts: 18

Original Poster
Rep: Reputation: 0
the file has execute permissions (i even ran chmod +x test) but I still get the message:

[root@localhost ,linux]# ./test
bash: ./test: Permission denied

??

is it my compiler thats broken or redhat9 itself?
 
Old 01-20-2004, 08:15 AM   #12
lone_nut
Member
 
Registered: Dec 2003
Location: Denmark
Distribution: Mandrake
Posts: 179

Rep: Reputation: 30
Does it also have read permisions, I think that you should be able to run it as root. I am however not 100% sure. To give it read permisions: run
chmod +r test
the try to run it again.
 
Old 01-20-2004, 11:46 PM   #13
smirnoff
LQ Newbie
 
Registered: Sep 2003
Location: ChCh, New Zeleand
Distribution: RH9
Posts: 18

Original Poster
Rep: Reputation: 0
yea it has read permissions

... what should I do?
 
Old 01-21-2004, 09:11 AM   #14
lone_nut
Member
 
Registered: Dec 2003
Location: Denmark
Distribution: Mandrake
Posts: 179

Rep: Reputation: 30
Even if the program has exection and read permisions, it may still depend on the libaries used. Since the gcc compiler link your program with standard libaries, wich i stored out side of the program file to save space, you might want to check, wether theese libaries have the correct permisions. to check this, type the following at any terminal:
ls -l `ldd test |cut -d\ -f3`
If this doesn't show that all the libaries have read and (i don't know if it is needed, but it can't hurt) execution permisions, change the permsions.
if that still doesn't help, install a new compiler.
 
  


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
problems compiling C codes in RH9 Izza Programming 3 09-06-2005 01:34 AM
problems with compiling from source PKG_CONFIG_PATH ISSUES Nadim Slackware 7 01-20-2005 05:37 PM
updating xfree on rh9 by compiling from source mkaman Red Hat 2 08-29-2004 05:50 PM
Problems Compiling GTK C++ Source Code drdroid Programming 17 04-10-2004 07:08 PM
Problems with compiling source code cav Linux - General 4 02-06-2003 12:47 AM


All times are GMT -5. The time now is 04:21 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration