develooper Front page | perl.perl5.porters | Postings from February 2000

[ID 20000217.002] Re: Perl5 on Linux/MIPS

Thread Previous | Thread Next
Dominic Dunlop
February 17, 2000 05:52
[ID 20000217.002] Re: Perl5 on Linux/MIPS
Message ID:
At 15:16 -0800 2000-02-04, Erik Van Coops-Lotspeich wrote:
>My goal is to get Perl 5.00503 properly running on a Cobalt RaQ 2 
>which runs Linux 2.0.34 kernel on a MIPS R3000 processor. ...

Hi, Erik.  Sorry for the belated reply.  I'm copying this to perlbug 
so that it gets a tracking number.

>The problem is that I have a server written in Perl that needs to
>execute the "socket()" function.  When I try to run this program, Perl
>comes back with:
>socket: Protocol not supported at line xxx

Hmmm.  I'd expect something like the Qube to sport a perl which had 
been well thrashed in terms of its networking abilities.  Oh, well. 
Try replacing symbols (you are using symbols, aren't you, not numeric 
constants which happen to work elsewhere?) like AF_INET with numeric 
constants taken from sys/socket.h, and see if that makes the problem 
go away.  If it does, write a program that displays the suspect 
constants, and see if they're wrong:

perl -MSocket -le 'print AF_INET'  # trivial example of such a program

If they are wrong, the problem's something to do with the way the 
Socket module (see ext/Socket/Socket.xs) is grabbing the constants.

At this stage it's worth checking whether the latest development 
version of perl (< >) fixes the 
problem.  If it does, work out how, and patch up your copy of 
5.005_03 source.  If it doesn't, you need to sort out the problem 
yourself (and please tell us what you had to do).

If everything looks OK, go in with a debugger, and find out what's 
getting passed when PerlSock_socket() (actually socket()) is called 
in pp_sys.c.  Given the error you're seeing, I'd expect the arguments 
to look screwy.  Your mission, should you choose to accept it, is to 
find out where they get screwed, fix it, and send a patch.

>  I have built Perl successfully many times on Intel machines running
>Linux, but this MIPS machine has me stumped.

I've no experience MIPS, but I seem to recall that it is/used to be 
the case that the processors could use big- or little-endian byte 
ordering at the OS implementor's whim.  Add to this network byte 
ordering, which may or may not differ from either, and there's scope 
for confusion and bugs.  If programs other than perl can create and 
use sockets happily, it's conceivable that something's up with htonl 
family of conversion macros that perl's finding.  That said, if it's 
the socket() call that's failing, IP addresses don't  enter the 

Dominic Dunlop

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About