Cygwin hosted Linux toolchain -- Howto test run
Kai Ruottu
karuottu@freenet.hut.fi
Wed Aug 11 16:41:00 GMT 1999
ÃÂystein wrote:
> Can my linking problem be due to my library files being corrupted? (remember
> I took this from a file I got from the net, glibc-2.0.bin.i386.tar.gz, so they
> are not really tested)
Why you couldn't give the error messages? So we must guess your
linking problem...
A quick checklist:
1. Are the libs in a place where GCC finds them?
Use 'i686-pc-linux-gnu-gcc -print-search-dirs' to see the search paths.
2. Is the 'ld-linux.so.2' there (in <the_lib_dir>) too?
3. Have you added the '-rpath-link <the_lib_dir>' to your specs? The linker
doesn't find the shared libs ('.so' - files) otherwise... It searches only
the native places in Linux (like '/lib' and '/usr/lib')
My Mingw32-to-linux-gnu cross-compiler has the following LINK_SPEC :
*link:
-m elf_i386 %{shared:-shared} %{!shared: %{!ibcs: %{!static:
%{rdynamic:-export-dynamic}
%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2
--rpath-link //E/usr/local/i586-linux-gnu/lib}} %{static:-static}}}
Mingw32-binaries need that '//D' for finding the stuff in disk 'D:', Cygwin
probably don't need the disk name if the 'd:\usr' is mounted as '/usr'...
Cheers, Kai
BTW, a successfull compile/link log:
E:\usr\local\samples\sort>gcc-linux-gnu -v -o sort_linux.x sort.c
Reading specs from E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/specs
gcc version gcc-2.95 19990615 (prerelease)
E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/cpp.exe -lang-c -v -iprefix E:/usr
/local/lib/gcc-lib\i586-linux-gnu/2.95/ -D__GNUC__=2 -D__GNUC_MINOR__=95 -D__ELF
__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__uni
x -D__linux -Asystem(posix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386
__ -Di486 -D__i486 -D__i486__ sort.c e:\temp\ccxcaaaa.i GNU CPP version gcc-2.95
19990615 (prerelease) (i386 Linux/ELF) #include "..." search starts here:
#include <...> search starts here:
E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/include
E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/../../../../i586-linux-gnu/include
/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/include
/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/../../../../i586-linux-gnu/include
End of search list. The following default directories have been omitted from the
search path:
/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/../../../../include/g++
/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/../../../../i586-linux-gnu/sys-inclu
de End of omitted list.
E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/cc1.exe e:\temp\ccxcaaaa.i -quiet
-dumpbase sort.c -version -o e:\temp\ccUeaaaa.s GNU C version gcc-2.95 19990615
(prerelease) (i586-linux-gnu) compiled by GNU C version egcs-2.91.66 19990314
(egcs-1.1.2 release).
E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/../../../../i586-linux-gnu/bin/as.
exe -V -Qy -o e:\temp\cchhaaaa.o e:\temp\ccUeaaaa.s GNU assembler version 990324
(i386-elf) using BFD version 990324
E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/../../../../i586-linux-gnu/bin/ld.
exe -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 --rpath-link //E/usr/local/i5
86-linux-gnu/lib -o sort_linux.x E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/..
/../../../i586-linux-gnu/lib/crt1.o E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95
/../../../../i586-linux-gnu/lib/crti.o E:/usr/local/lib/gcc-lib/i586-linux-gnu/2
.95/crtbegin.o -LE:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95 -LE:/usr/local/lib
/gcc-lib -L/usr/local/lib/gcc-lib/i586-linux-gnu/2.95 -LE:/usr/local/lib/gcc-lib
/i586-linux-gnu/2.95/../../../../i586-linux-gnu/lib -L/usr/local/lib/gcc-lib/i58
6-linux-gnu/2.95/../../../../i586-linux-gnu/lib -LE:/usr/local/lib/gcc-lib/i586-
linux-gnu/2.95/../../.. e:\temp\cchhaaaa.o -lgcc -lc -lgcc E:/usr/local/lib/gcc-
lib/i586-linux-gnu/2.95/crtend.o E:/usr/local/lib/gcc-lib/i586-linux-gnu/2.95/..
/../../../i586-linux-gnu/lib/crtn.o
E:\usr\local\samples\sort>objdump -p sort_linux.x
sort_linux.x: file format elf32-i386
Program Header:
PHDR off 0x0000000000000034 vaddr 0x0000000008048034 paddr 0x000000000804
8034 align 2**2
filesz 0x00000000000000a0 memsz 0x00000000000000a0 flags r-x
INTERP off 0x00000000000000d4 vaddr 0x00000000080480d4 paddr 0x000000000804
80d4 align 2**0
filesz 0x0000000000000013 memsz 0x0000000000000013 flags r--
LOAD off 0x0000000000000000 vaddr 0x0000000008048000 paddr 0x000000000804
8000 align 2**12
filesz 0x000000000000087e memsz 0x000000000000087e flags r-x
LOAD off 0x0000000000000880 vaddr 0x0000000008049880 paddr 0x000000000804
9880 align 2**12
filesz 0x00000000000010a0 memsz 0x00000000000010bc flags rw-
DYNAMIC off 0x0000000000001898 vaddr 0x000000000804a898 paddr 0x000000000804
a898 align 2**2
filesz 0x0000000000000088 memsz 0x0000000000000088 flags rw-
Dynamic Section:
NEEDED libc.so.6
INIT 0x80483c0
FINI 0x8048810
HASH 0x80480e8
STRTAB 0x80482c4
SYMTAB 0x8048184
STRSZ 0xb7
SYMENT 0x10
DEBUG 0x0
PLTGOT 0x804a874
PLTRELSZ 0x28
PLTREL 0x11
JMPREL 0x804838c
REL 0x804837c
RELSZ 0x10
RELENT 0x8
E:\usr\local\samples\sort>
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.
More information about the crossgcc
mailing list