Subject: | Socket-2.009's Makefile.PL doesn't discover that inet_aton isn't available on Solaris |
Our Solaris builds of Socket-2.009 create a module that fails like this:
$ perl -MSocket=inet_aton -e 'inet_aton("localhost")' ld.so.1: perl-static: fatal: relocation error: file /tmp/perl/lib/auto/Socket/Socket.so: symbol inet_aton: referenced symbol not found
Solaris provide inet_aton() in libresolv.so, but that library isn't linked by perl by default.
I tracked the problem to the Sun C compiler optimizing "void *p = &inet_aton; (void)p;" in the test program away. This means that this program compiles and links even if the inet_aton symbol isn't provided. I attached a patch that fixes the problem.
I tracked the problem to the Sun C compiler optimizing "void *p = &inet_aton; (void)p;" in the test program away. This means that this program compiles and links even if the inet_aton symbol isn't provided. I attached a patch that fixes the problem.
Subject: | 0001-The-Sun-C-compiler-optimizes-void-p-inet_aton-void-p.patch |
From 5906e1c72d74539ccdf352cf068bfd50969ce09c Mon Sep 17 00:00:00 2001
From: Gisle Aas <gisle@activestate.com>
Date: Thu, 2 May 2013 15:12:23 -0700
Subject: [PATCH] The Sun C compiler optimizes "void *p = &inet_aton; (void)p;" away.
Which means that this program compiles and links even if the inet_aton symbol
isn't provided.
---
Makefile.PL | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 117d778..f2dfb26 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -30,6 +30,7 @@ sub check_for
{
open( my $file_source_fh, ">", $file_source ) or die "Cannot write $file_source - $!";
print $file_source_fh <<"EOF";
+#include <stdio.h>
#include <sys/types.h>
#ifdef WIN32
# include <ws2tcpip.h>
@@ -70,7 +71,7 @@ sub check_for_func
{
my %args = @_;
my $func = delete $args{func};
- check_for( %args, main => "void *p = &$func; (void)p;" );
+ check_for( %args, main => qq(void *p = &$func; printf("%p", p);) );
}
my %defines = (
--
1.7.0.5