LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 03-25-2011, 06:36 PM   #1
sbdev
LQ Newbie
 
Registered: Mar 2011
Posts: 5

Rep: Reputation: 1
Stuck at cross compile G++ compilation


Hi,

Ok, i successfully followed the CLFS stable book, and went till 5.9. Cross GCC-4.2.4 - Final

Now i want to stop here, because all i want is just the cross compiled Gcc, G++, Glibc and the linker search path should be referenced to my /tools/lib da..da..

I see that i do that.

Now i created two sample programs one 'c++' and other one 'c' printing "hello World"

when i try to compile these two programs, i get the following error while linking.

Could someone please help me through.

clfs:/mnt/cross/x86/sources/test$ ${CLFS_TARGET}-g++ file.cc
In file included from /mnt/cross/x86/cross-tools/bin/../lib/gcc/i686-sb-linux-gnu/4.2.4/../../../../i686-sb-linux-gnu/include/c++/4.2.4/backward/iostream.h:31,
from file.cc:1:
/mnt/cross/x86/cross-tools/bin/../lib/gcc/i686-sb-linux-gnu/4.2.4/../../../../i686-sb-linux-gnu/include/c++/4.2.4/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
clfs:/mnt/cross/x86/sources/test$ ls
a.out file.cc
clfs:/mnt/cross/x86/sources/test$ readelf -l a.out | grep ' : /tools'
clfs:/mnt/cross/x86/sources/test$ readelf -l a.out

Elf file type is EXEC (Executable file)
Entry point 0x8048640
There are 8 program headers, starting at offset 52

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000034 0x08048034 0x08048034 0x00100 0x00100 R E 0x4
INTERP 0x000134 0x08048134 0x08048134 0x00019 0x00019 R 0x1
[Requesting program interpreter: /tools/lib/ld-linux.so.2]
LOAD 0x000000 0x08048000 0x08048000 0x00aac 0x00aac R E 0x1000
LOAD 0x000aac 0x08049aac 0x08049aac 0x00140 0x00200 RW 0x1000
DYNAMIC 0x000ac4 0x08049ac4 0x08049ac4 0x000e0 0x000e0 RW 0x4
NOTE 0x000150 0x08048150 0x08048150 0x00020 0x00020 R 0x4
GNU_EH_FRAME 0x0009c0 0x080489c0 0x080489c0 0x00034 0x00034 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4

Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
03 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
04 .dynamic
05 .note.ABI-tag
06 .eh_frame_hdr
07
clfs:/mnt/cross/x86/sources/test$ ls
a.out file.cc
clfs:/mnt/cross/x86/sources/test$ ./a.out
./a.out: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
clfs:/mnt/cross/x86/sources/test$ vim file1.c
clfs:/mnt/cross/x86/sources/test$ ${CLFS_TARGET}-gcc file1.c
file1.c: In function 'main':
file1.c:3: warning: return type of 'main' is not 'int'
clfs:/mnt/cross/x86/sources/test$ ls
a.out file.cc file1.c
clfs:/mnt/cross/x86/sources/test$ ./a.out
./a.out: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
clfs:/mnt/cross/x86/sources/test$
 
Old 03-25-2011, 06:47 PM   #2
sbdev
LQ Newbie
 
Registered: Mar 2011
Posts: 5

Original Poster
Rep: Reputation: 1
Figured it was because its missing the LD_LIBRARY_PATH pointing to the location of libstdc++.so.6 and libgcc_s.so.1, but how do i get them in the tools/lib folder? i mean which part of compilation does that.
 
  


Reply



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
[SOLVED] cross compilation joslyn Linux - Newbie 3 04-23-2010 02:33 AM
cross compilation shariefbe Linux - Software 5 02-15-2010 05:23 AM
cross compilation shaiva Linux - Newbie 2 10-06-2009 03:43 AM
cross compilation Kocil Slackware 6 12-18-2003 01:53 PM
Cross-compilation radhapriya Linux - Software 0 08-11-2003 07:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 11:18 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
Open Source Consulting | Domain Registration