LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   GCC compilation error (https://www.linuxquestions.org/questions/linux-newbie-8/gcc-compilation-error-4175459243/)

AN28 04-23-2013 03:56 AM

GCC compilation error
 
Hi,

i was happilly waiting while the gcc patch was being compiled when suddenly the power went off... :((
i then powered the machine up again and mounted the partitions and tried to get back to where i stopped.

sadly when i run the

echo 'main(){}' > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ': /lib'


i get the output as
readelf: Error: 'a.out': No such file

what should I do ?

gdejonge 04-23-2013 07:57 AM

First of all make sure that your filesystems are ok, by running fsck against them.
Second. I'm not sure what you mean by 'the gcc patch', but most sources come with a clean option for the makefile. So try something like 'make clean' or 'make distclean'. And then try compiling again.

Cheers

pan64 04-23-2013 08:11 AM

and try to see what is in dummy.log (or post it)

AN28 04-23-2013 12:09 PM

Thanks guys I will check it out and keep u posted

AN28 04-23-2013 11:53 PM

Hi,
i found out that the reason behind my previous question was because i had to re-initialize the chroot environment given in the begin of chapter 6. (stupid me )

however after that i encounted some other problems

#1
when searching for the correct header files i get the output that the terminal is ignoring some directories and

#2
when verifying that the new linker is being used with the correct search paths one directory is omitted as per the books result.

however i went ahead and the subsequent commands were successful but

#3 once again in the end of the compilation process when trying to move a misplaced file i get stuck coz it says no such directory

PLEASE tell me where i have gone wrong ...............

p.s. i have colour-coded each prob with my resulting output below :)

---------------------------------------------------------------------------------------------------------------------------------------------------

root:/sources/gcc-build# echo 'main(){}' > dummy.c
root:/sources/gcc-build# cc dummy.c -v -Wl,--verbose &> dummy.log
root:/sources/gcc-build# readelf -l a.out | grep ': /lib'
[Requesting program interpreter: /lib/ld-linux.so.2]
root:/sources/gcc-build# grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
/usr/lib/crt1.o succeeded
/usr/lib/crti.o succeeded
/usr/lib/crtn.o succeeded
root:/sources/gcc-build# grep -B4 '^ /usr/include' dummy.log
ignoring nonexistent directory "/tools/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../i686-pc-linux-gnu/include"
ignoring duplicate directory "/tools/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include

[COLOR="rgb(255, 0, 255)"]root:/sources/gcc-build# grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
SEARCH_DIR("/tools/i686-pc-linux-gnu/lib")
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib")
;[/COLOR]
root:/sources/gcc-build# grep "/lib.*/libc.so.6 " dummy.log
attempt to open /lib/libc.so.6 succeeded
root:/sources/gcc-build# grep found dummy.log
found ld-linux.so.2 at /lib/ld-linux.so.2
root:/sources/gcc-build# rm -v dummy.c a.out dummy.log
removed 'dummy.c'
removed 'a.out'
removed 'dummy.log'
root:/sources/gcc-build# mkdir -pv /usr/share/gdb/auto-load/usr/lib
mkdir: created directory '/usr/share/gdb'
mkdir: created directory '/usr/share/gdb/auto-load'
mkdir: created directory '/usr/share/gdb/auto-load/usr'
mkdir: created directory '/usr/share/gdb/auto-load/usr/lib'
[COLOR="rgb(255, 140, 0)"]root:/sources/gcc-build# mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
mv: cannot stat '/usr/lib/*gdb.py': No such file or directory
[/COLOR]

gdejonge 04-24-2013 09:27 PM

Your reference to chapter 6 did make me realise that you were working on linux from scratch. It would have been easier had you mentioned that in your first post. I'm curious which version of the book you're using?

Also I don't know if you noticed, but there is a specific sub-forum for LFS in the distribution forum.

Cheers

AN28 04-30-2013 01:02 AM

ohh ok thank you for that piece of info.. sorry but i wasn't aware

and i am using LFS 7.3

---------- Post added 04-30-13 at 01:02 AM ----------

ohh ok thank you for that piece of info.. sorry but i wasn't aware

and i am using LFS 7.3


All times are GMT -5. The time now is 07:54 AM.