LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   What is wrong with my GCC? (http://www.linuxquestions.org/questions/slackware-14/what-is-wrong-with-my-gcc-4175437308/)

Iuz 11-15-2012 01:02 PM

What is wrong with my GCC?
 
Trying to install some slackbuilds Im getting the same error all the time:

configure: error: in `/tmp/SBo/mono-2.10.9':
configure: error: C compiler cannot create executables

Same thing happened with code::blocks, LÍVE configure...

Mono config.log
http://pastebin.com/vD5bHAvw

code::blocks config.log
http://pastebin.com/u2b3tMMn

also trying to compile things (not sure if this is related):

# gcc -o prog3 prog3.c
prog3.c:1:19: fatal error: stdio.h: No such file or directory

with:

find /usr -name stdio.h
/usr/src/linux-3.2.29/arch/powerpc/boot/stdio.h
/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/include/ssp/stdio.h
/usr/lib64/bcc/include/stdio.h
/usr/include/isc/stdio.h
/usr/include/c++/4.7.1/tr1/stdio.h

Im no expert and have no idea what is going on...

markush 11-15-2012 01:37 PM

Hi,

possibly the architecture isn't recognized correctly. If you build for 64bit, please check if the slackbuildscript is able to recognize this architecture. Otherwise change it in the Slackbuildscript.

Markus

bosth 11-15-2012 02:10 PM

Missing glibc? Try (re)installing that package.

ssl779 11-15-2012 04:50 PM

Quote:

Originally Posted by Iuz (Post 4830212)

find /usr -name stdio.h
/usr/src/linux-3.2.29/arch/powerpc/boot/stdio.h
/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/include/ssp/stdio.h
/usr/lib64/bcc/include/stdio.h
/usr/include/isc/stdio.h
/usr/include/c++/4.7.1/tr1/stdio.h

Im no expert and have no idea what is going on...

I would expect to find stdio.h in "/usr/include".
What distro do you use?
Have you installed complete gcc suite?

Iuz 11-15-2012 04:54 PM

slackware 14.0 64...
It should come with the installation right?

I also installed http://www.slackware.com/~alien/multilib/14.0/ and Im feeling I did something wrong here...

Didier Spaier 11-15-2012 06:00 PM

As pointed out by bosth, /usr/include/stdio.h is provided by glibc, which should be installed. Did you make a full install?

Also, check that all your packages are for x86_64. Following command should return 0:
Code:

ls -l /var/log/packages | grep i486 | wc -l

ssl779 11-15-2012 06:04 PM

Quote:

Originally Posted by Iuz (Post 4830385)
slackware 14.0 64...
It should come with the installation right?

If you did full installation then yes.
But if you chose custom package selection then you had to select binutils, gcc, glibc, kernel headers, all this stuff...

btw, take a look into /var/log/packages to make sure they are actually installed.
As bosth suggested above, glibc is likely missing (package glib-1.2.10-x86_64-3, at least om my Slack)


Quote:

Originally Posted by Iuz (Post 4830385)
I also installed http://www.slackware.com/~alien/multilib/14.0/ and Im feeling I did something wrong here...

Unlikely.
"/usr/include/stdio.h" should remain there...

Didier Spaier 11-15-2012 06:09 PM

Quote:

Originally Posted by ssl779 (Post 4830412)
glibc is likely missing (package glib-1.2.10-x86_64-3, at least om my Slack)

It is glibc-2.15-x86_64-7.txz in the /l series of packages

ssl779 11-15-2012 06:20 PM

Quote:

Originally Posted by Didier Spaier (Post 4830413)
It is glibc-2.15-x86_64-7.txz in the /l series of packages

Yes, it comes from this package. Then in /var/log/packages there must be a corresponding file
"glib-2.15-x86_64-<some number>".
Also, if he successfully installed multilibs there will be another file like "glibc-2.15_multilib-x86_64-7alien",
which substitutes /usr/include/stdio.h, but in any case it must be there.

Iuz 11-15-2012 06:34 PM

ls -l /var/log/packages | grep i486 | wc -l returned 0 and yes, I did a full install

and on /var/log/packages:

-rw-r--r-- 1 root root 1436 02.10.2012 16:56 glib-1.2.10-x86_64-3
-rw-r--r-- 1 root root 7416 02.10.2012 16:56 glib-networking-2.32.3-x86_64-1
-rw-r--r-- 1 root root 43781 02.10.2012 16:56 glib2-2.32.4-x86_64-1
-rw-r--r-- 1 root root 210 22.10.2012 02:40 glibc-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 2287 16.11.2012 19:22 glibc-debug-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 464815 22.10.2012 02:41 glibc-i18n-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 1303 22.10.2012 02:41 glibc-profile-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 15553 22.10.2012 02:41 glibc-solibs-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 69793 22.10.2012 02:41 glibc-zoneinfo-2012f_

I still have no idea on what seems to be the problem

lkraemer 11-15-2012 10:15 PM

Iuz,
Your problem is likely that your environment isn't set properly.

To find those settings you can type the following commands:
Code:

env
env | grep SHELL=

The command "env" Displays the current environment, and one of those items is the PATH. Here is my Slackware 14 (32 Bit) path:
Quote:

PATH=/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/java/jre/bin:/usr/lib/kde4/libexec:/usr/lib/qt/bin:/usr/share/texmf/bin:.:/home/larry/bin:/usr/sbin
The command "env | grep SHELL=" displays what Shell is being used. Bash is default for Slackware 14.

REF:
http://en.wikipedia.org/wiki/Unix_shell
Bourne shell (sh)
Almquist shell (ash)
Bourne-Again shell (bash)
Debian Almquist shell (dash)
Korn shell (ksh)
Z shell (zsh)
C shell (csh)
TENEX C shell (tcsh)
other shells..............


The next thing to do is determine if there is a .*rc file, or a .bash_profile file.

To find the current logged in user's home shell Configuration file (*rc)... use:
Code:

man updatedb
updatedb
cd ~
locate .*rc
locate .bash_p*

One (or more) of the above files should exist.


There may be a .bash_profile file in /home/loginuser along with .bashrc. You can put configurations in either file,
and you can create either if it doesn’t exist. But, why two different files? What is the difference?

According to the bash man page, .bash_profile is executed for login shells, while .bashrc is executed for
interactive non-login shells.

If .bash_profile exists in /home/user/ with the following information already inserted:
Code:

  PATH=$PATH:$HOME/bin
  export PATH

just append your path modifications here instead of the .bashrc file. (ie. CentOS 6 Distro)

You need to list the *rc file to verify the contents and set the PATHS. I'm ASSUMING a Bash shell......Your may be different!
Code:

cat .bashrc
cat .bashrc -- Lists the configuration file, then you must append the proper search paths for the users shell with edit.
Quote:

export LD_LIBRARY_PATH=????????????????????????????????
export LIBRARY_PATH=???????????????????????????????????
export C_INCLUDE_PATH=?????????????????????????????????
export CPATH=??????????????????????????????????????????
My Debian Distro happens to be:
Quote:

export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
export LIBRARY_PATH=/usr/lib:/usr/local/lib
export C_INCLUDE_PATH=.:/usr/include:/usr/local/include
export CPATH=.:/usr/include:/usr/local/include
But yours may vary accordingly. You won't be able to cut & paste mine, unless your system is built exactly like mine.
It's up to you to locate exactly where all the libs, and includes are located. That is what all the previous commands
should have helped you do. Just because you have /usr/lib & /usr/local/lib included....doesn't mean your needed lib is
in that path.

That is where your detective work comes to play. SEARCH and use grep to locate the libs.

Once you have the env file set either reboot or reset the env. Once again, your system command for this
can/may be different.

Code:

source .bashrc
This command resets the environment to what you need for Compiles, assuming the SHELL is bash. This may not be available on your system.....

REF:
http://linux.about.com/library/cmd/blcmdl1_ulimit.htm

Quote:

source filename [arguments]
Read and execute commands from filename in the current shell environment and return the exit status of the last command executed from filename. If filename does not contain a slash, file names in PATH are used to find the directory containing filename. The file searched for in PATH need not be executable. When bash is not in posix mode, the current directory is searched if no file is found in PATH. If the sourcepath option to the shopt builtin command is turned off, the PATH is not searched. If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. The return status is the status of the last command exited within the script (0 if no commands are executed), and false if filename is not found or cannot be read.
A quick and easy way is to append the desired directory to the PATH variable located on your .bashrc file.
Code:

echo "PATH=$PATH:/home/jacob/Dakota/bin" >> .bashrc
The command below should find several copies of stdio.h.
Code:

find /usr -iname "stdio.h"
Here is what was found on my Slackware 14 (32 Bit) Full install.

Quote:

/usr/include/stdio.h
/usr/include/isc/stdio.h
/usr/include/bits/stdio.h
/usr/include/wine/msvcrt/stdio.h
/usr/include/c++/4.7.1/tr1/stdio.h
/usr/lib/gcc/i486-slackware-linux/4.7.1/include/ssp/stdio.h
/usr/lib/bcc/include/stdio.h
/usr/src/linux-3.2.29/arch/powerpc/boot/stdio.h
bash-4.2$
For the test program named hello.c you just need to compile it and execute it with:
Code:

/*        HELLO.C -- Hello, world */

#include <stdio.h>

main()
{
int i;
i = 0x10;
/* comment  */
        printf("Hello, World.....Interrupt used was %d\n",i);
}

Code:

gcc -o hello hello.c
./hello

assuming the proper file permissions are set:
Quote:

bash-4.2$ ls -alt hello*
-rwxr-xr-x 1 larry users 6084 Nov 16 03:39 hello
-rw-r--r-- 1 larry users 150 Nov 16 03:38 hello.c
bash-4.2$
giving the following result:
Quote:

bash-4.2$ ./hello
Hello, World.....Interrupt used was 16
bash-4.2$
What did you find set incorrect?



Larry

ssl779 11-15-2012 10:56 PM

Larry, everything you said above is correct.
But, it would be his next step.
For now he is missing /usr/include/stdio.h - the glibc header which is expected by gcc.
It comes from glibc-2.15-x86_64-7.txz.
As Didier mentioned, it is in the /l series, so I guess step one is go into directory slackware64/l of installation CD and run "installpkg glibc-2.15-x86_64-7.txz"

Quote:

Originally Posted by Iuz (Post 4830212)
# gcc -o prog3 prog3.c
prog3.c:1:19: fatal error: stdio.h: No such file or directory

btw, a silly question - which way do you include it?
#include "stdio.h", or
#include <stdio.h> ?
(note angle brackets vs quotation marks)

ssl779 11-15-2012 11:17 PM

Quote:

Originally Posted by Iuz (Post 4830421)
... and on /var/log/packages:
...
-rw-r--r-- 1 root root 210 22.10.2012 02:40 glibc-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 2287 16.11.2012 19:22 glibc-debug-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 464815 22.10.2012 02:41 glibc-i18n-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 1303 22.10.2012 02:41 glibc-profile-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 15553 22.10.2012 02:41 glibc-solibs-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 69793 22.10.2012 02:41 glibc-zoneinfo-2012f_

oh, I see you have multilib installed. In this case please disregard my advice about glibc-2.15-x86_64-7.txz,
you have to reinstall glibc-debug-2.15_multilib-x86_64-7alien from Alien's packages.

ssl779 11-15-2012 11:24 PM

sorry, a mistake - I mean "glibc-2.15_multilib-x86_64-7alien",
not the "-debug-" version

markush 11-15-2012 11:27 PM

Quote:

Originally Posted by Iuz (Post 4830421)
ls -l /var/log/packages | grep i486 | wc -l returned 0 and yes, I did a full install

and on /var/log/packages:

-rw-r--r-- 1 root root 1436 02.10.2012 16:56 glib-1.2.10-x86_64-3
-rw-r--r-- 1 root root 7416 02.10.2012 16:56 glib-networking-2.32.3-x86_64-1
-rw-r--r-- 1 root root 43781 02.10.2012 16:56 glib2-2.32.4-x86_64-1
-rw-r--r-- 1 root root 210 22.10.2012 02:40 glibc-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 2287 16.11.2012 19:22 glibc-debug-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 464815 22.10.2012 02:41 glibc-i18n-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 1303 22.10.2012 02:41 glibc-profile-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 15553 22.10.2012 02:41 glibc-solibs-2.15_multilib-x86_64-7alien
-rw-r--r-- 1 root root 69793 22.10.2012 02:41 glibc-zoneinfo-2012f_

I still have no idea on what seems to be the problem

I would like to see the Slackbuildscript, the part where the architecture is initialized, I suppose as I wrote above that it doesn't recognize that you have a 64bit architecture.

I know this type of error, it's likely related to the architecture.

Markus


All times are GMT -5. The time now is 02:19 AM.