Author Topic: Stat64 Missing In Dev_img-1.6  (Read 6198 times)

andrewmaier

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • http://www.andrew.maier.name
Stat64 Missing In Dev_img-1.6
« on: February 27, 2005, 08:44:37 am »
Hi all,

I frequently seem to run into trouble when compiling software using the dev-img (1.6), While linking, I get errors related to stat64 not being available, E.g. when compiling cpio I get:

Code: [Select]
gcc  -g -O2   -o cpio  copyin.o copyout.o copypass.o defer.o dstring.o global.omain.o tar.o util.o filemode.o idcache.o makepath.o userspec.o ../lib/libcpio.a
main.o: In function `parse_opt':
/mnt/card/Documents/Develop/cpio-2.6/src/main.c:413: undefined reference to `stat64'
main.o: In function `process_args':
/mnt/card/Documents/Develop/cpio-2.6/src/main.c:594: undefined reference to `stat64'
collect2: ld returned 1 exit status
make[2]: *** [cpio] Error 1
make[2]: Leaving directory `/usr/mnt.rom/card/Documents/Develop/cpio-2.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/mnt.rom/card/Documents/Develop/cpio-2.6'
make: *** [all] Error 2


I am sure this has been dealt with, or there is a workaround. BTW the debian arm cross-compiler package seems to have stat64 implemented, as I was able to cross compile cpio, but still I would like to compile packages natively

Any clues?

Andrew

m-morino

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • http://morimasa.net/
Stat64 Missing In Dev_img-1.6
« Reply #1 on: February 27, 2005, 10:13:03 am »
Hi,
Quote
I frequently seem to run into trouble when compiling software using the dev-img (1.6), While linking, I get errors related to stat64 not being available, E.g. when compiling cpio I get:
[div align=\"right\"][a href=\"index.php?act=findpost&pid=68752\"][{POST_SNAPBACK}][/a][/div]
The compiler_setup.sh script included in the dev_img-1.6 doesn't make essential sybolic links of glibc libraries.

You have to make symlinks as follows:

Code: [Select]
$ su
# ln -s /lib/libcom_err.so.2 /usr/lib/libcom_err.so
# ln -s /lib/libcrypt.so.1 /usr/lib/libcrypt.so
# ln -s /lib/libdl.so.2 /usr/lib/libdl.so
# ln -s /lib/libnsl.so.1 /usr/lib/libnsl.so
# ln -s /lib/libnss_compat.so.2 /usr/lib/libnss_compat.so
# ln -s /lib/libnss_dns.so.2 /usr/lib/libnss_dns.so
# ln -s /lib/libnss_files.so.2 /usr/lib/libnss_files.so
# ln -s /lib/libnss_nis.so.2 /usr/lib/libnss_nis.so
# ln -s /lib/libpthread.so.0 /usr/lib/libpthread.so
# ln -s /lib/libresolv.so.2 /usr/lib/libresolv.so
# ln -s /lib/libss.so.2 /usr/lib/libss.so
# ln -s /lib/libutil.so.1 /usr/lib/libutil.so
# ln -s /lib/libuuid.so.1 /usr/lib/libuuid.so
# rm /usr/lib/libc.so
# cat > /usr/lib/libc.so << EOF
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
EOF
# chmod 755 /usr/lib/libc.so
# ldconfig

HTH,
« Last Edit: February 28, 2005, 07:27:24 am by m-morino »
m-morino

andrewmaier

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • http://www.andrew.maier.name
Stat64 Missing In Dev_img-1.6
« Reply #2 on: February 27, 2005, 10:56:49 am »
Quote
Hi,
[...]
You have to make symlinks as follows:

Code: [Select]
[...]
# cat > /usr/lib/libc.so << EOF
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
EOF
[...]

Thanks for the replay. Unfortunately, on a cacko system, /usr/lib/libc.so is on a readonly system, and therefore the cat command fails. Any way to get around this?

Thanks,

Andrew

andrewmaier

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • http://www.andrew.maier.name
Stat64 Missing In Dev_img-1.6
« Reply #3 on: February 27, 2005, 11:10:42 am »
OK, following all the links, I end up that /usr/lib/libc.so is identical to /lib/libc.so.6. So what does the code below actally do? Simply append /usr/lib/libc_nonshared.a to libc.so.6??  Can this be done??

To honest I have never encountered anything like GROUP (..). What does it do?


Code: [Select]
[...]
# cat > /usr/lib/libc.so << EOF
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
EOF


Thanks,

Andrew

m-morino

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • http://morimasa.net/
Stat64 Missing In Dev_img-1.6
« Reply #4 on: February 27, 2005, 10:59:48 pm »
Hi,
Quote
OK, following all the links, I end up that /usr/lib/libc.so is identical to /lib/libc.so.6. So what does the code below actally do? Simply append /usr/lib/libc_nonshared.a to libc.so.6??  Can this be done??

To honest I have never encountered anything like GROUP (..). What does it do?
[div align=\"right\"][{POST_SNAPBACK}][/a][/div]
ld (linker) can be controlled by the "linker script" (see [a href=\"http://docsrv.sco.com:8457/cgi-bin/info2html?(ld.info.gz)Scripts]ld.info[/url]).
GROUP() command instruct the ld linker to search specified libraries for unresolved symbols repeatedly until no new undefined references are created.

It's recommended that you should put the script instead of normal symbolic link from /lib/libc.so.6.  

BTW, libc_nonshread.a literally contains non-shared libc functions.
see this Program-Library-HOWTO Document.

I don't have a detailed knowledge of the cacko system.
But I guess you can remount /(root) with r/w enabled by typing below:

Code: [Select]
$ su
# mount -o rw,remount /
# rm /usr/lib/libc.so
# cat > /usr/lib/libc.so << EOF
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
EOF
# mount -o ro,remount /
HTH,
« Last Edit: February 28, 2005, 07:26:16 am by m-morino »
m-morino

andrewmaier

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • http://www.andrew.maier.name
Stat64 Missing In Dev_img-1.6
« Reply #5 on: February 28, 2005, 05:06:36 am »
Hi,

I feel like I am such an idiot. This morning, after a good nights sleep I (without even having to read your reply) completely understood what was going on. I was obsessed by the fact, that I somehow would have to concatenate a shared and a nonshared library, which seemed to be very bizarre for me.

What I did not know, and what I have leared is that a library can consist of a linker script.

Thank you for you kind explanation.

Andrew

BTW, everything works fine now, I can link and compile software like gnu cpio, gforth, etc

papercrane

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
    • http://reversefold.com
Stat64 Missing In Dev_img-1.6
« Reply #6 on: April 07, 2005, 04:35:04 pm »
Thanks so much for this fix. I applied it to my Z and now I can compile parted. :-)