LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problems compiling from source in RH9 (https://www.linuxquestions.org/questions/linux-newbie-8/problems-compiling-from-source-in-rh9-133949/)

smirnoff 01-12-2004 07:14 AM

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

lone_nut 01-12-2004 12:27 PM

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.

smirnoff 01-12-2004 05:16 PM

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?

TheOneAndOnlySM 01-12-2004 05:58 PM

try just doing ./configure instead of sh ./configure

smirnoff 01-12-2004 06:25 PM

that doesnt work, just comes up saying something about errors and bash/sh

lone_nut 01-13-2004 08:55 AM

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

smirnoff 01-17-2004 12:23 PM

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?

lone_nut 01-18-2004 05:46 AM

save it to any file, with the ending in .c.
compile it using gcc filename -o test
and then start it using:
./test

smirnoff 01-19-2004 05:54 AM

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?

lone_nut 01-19-2004 09:22 AM

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.

smirnoff 01-19-2004 03:20 PM

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?

lone_nut 01-20-2004 08:15 AM

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.

smirnoff 01-20-2004 11:46 PM

yea it has read permissions

... what should I do?

lone_nut 01-21-2004 09:11 AM

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.


All times are GMT -5. The time now is 11:53 AM.