> From: Bernhard Schmalhofer via RT <parrotbug...@parrotcode.org>
> To: d...@tc.fluke.com
> Date: Sun, 26 Feb 2006 07:31:10 -0800
> Subject: [perl #37906] socklen_t not defined
>
> Hi David,
>
>> why does parrot expect socklen_t to be defined?
>> Since it isn't on my OLD libc5 system, parrot doesn't build
>
> thanks for reporting this bug.
>
> I have looked into it and added a config probe to Parrot,
> asking Perl5's Config module, whether 'socklen_t' is there.
> 'int' is used by when there is no 'socklen_t'.
>
> Could you upgrade to SVN revision 11750 or later, checking whether
> Parrot now compiles with libc5?
I got a little further with a new error in the link phase, although these
errors in src/exec_save.c Parrot_exec_save()
c++ -o miniparrot -L/usr/local/lib -Wl,-E compilers/imcc/main.o \
-Wl,-rpath=/hdd1/jd/usr2/dcd/ftp2/ponie/ponie/parrot/blib/lib -L/hdd1/jd/usr2/dcd/ftp2/ponie/ponie/parrot/blib/lib -lparrot -ldl -lm -
lpthread src/null_config.o
/hdd1/jd/usr2/dcd/ftp2/ponie/ponie/parrot/blib/lib/libparrot.so: undefined reference to `ELF32_ST_INFO'
/hdd1/jd/usr2/dcd/ftp2/ponie/ponie/parrot/blib/lib/libparrot.so: undefined reference to `inet_pton'
/hdd1/jd/usr2/dcd/ftp2/ponie/ponie/parrot/blib/lib/libparrot.so: undefined reference to `ELF32_R_INFO'
collect2: ld returned 1 exit status
make: *** [miniparrot] Error 1
I did see in
http://www.busybox.net/lists/busybox-cvs/2003-July/004266.html
where busybox added lines like
#ifndef ELF32_ST_INFO
# define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
#endif
to support ancient c libraries (line mine :-)
and I can see
#define ELF32_R_INFO(s,t) (((s) << 8) + ((t) & 0xff))
in my binutils source file include/elf/common.h
but I'm not sure why I get the undefined reference to `inet_pton', as there seems
to be conditional code that wraps it in src/io/io_unix.c
#ifdef PARROT_DEF_INET_ATON
if (inet_aton(s, &sa.sin_addr) != 0) {
#else
if (inet_pton(family, s, &sa.sin_addr) != 0) {
#endif
but there is no definition of PARROT_DEF_INET_ATON anywhere
but it looks like I should have added --define=inet_aton
perl Configure.pl --define=inet_aton
After adding code to provide definitions for ELF32_ST_INFO and ELF32_R_INFO, and
adding the --define=inet_aton, I was able to link a new miniparrot and parrot
and start the tests.
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/compilers/imcc/syn/file.t 1 256 12 1 8.33% 11
t/perl/Parrot_IO.t 255 65280 55 77 140.00% 17-55
9 tests and 392 subtests skipped.
Failed 2/228 test scripts, 99.12% okay. 40/5635 subtests failed, 99.29% okay.
could you send your changes as a patch to me or to parr...@parrotcode.org?
Could you additionally add your test results to PLATFORMS?
I suppose there needs to be some kind of config check for older 'libc5'.
The hints you passed to Configure.pl could probably also be put into a
hints file.
Thanks for making Parrot work, on slightly older systems,
Bernhard
> could you send your changes as a patch to me or to parr...@parrotcode.org?
my hack was not how anyone should implement it.
(I was just trying to get it to compile)
> Could you additionally add your test results to PLATFORMS?
I tried find a bit more documentation on the information needed
to add to PLATFORMS, but didn't find it yet in parrot - any advice?
> I suppose there needs to be some kind of config check for older 'libc5'.
> The hints you passed to Configure.pl could probably also be put into a
> hints file.
See below
Index: parrot/src/exec_save.c
===================================================================
--- parrot/src/exec_save.c (revision 11768)
+++ parrot/src/exec_save.c (working copy)
@@ -300,6 +300,11 @@
save_struct(fp, obj->text.code, obj->text.size); /* Text */
save_struct(fp, obj->data.code, obj->data.size); /* Data */
/* Text rellocations */
+
+#ifndef ELF32_R_INFO
+# define ELF32_R_INFO(s,t) (((s) << 8) + ((t) & 0xff))
+#endif
+
for (i = 0; i < obj->text_rellocation_count; i++) {
# if PARROT_I386
bzero(&rellocation, sizeof(Elf32_Rel));
@@ -399,6 +404,11 @@
save_struct(fp, &symlst, sizeof(Elf32_Sym));
/* Text */
bzero(&symlst, sizeof(Elf32_Sym));
+
+#ifndef ELF32_ST_INFO
+# define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
+#endif
+
symlst.st_info = ELF32_ST_INFO(STB_LOCAL, STT_SECTION);
symlst.st_shndx = 2;
save_struct(fp, &symlst, sizeof(Elf32_Sym));