Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

First of all, I know exactly jack squat about c/cpp or xs. Be gentle. I've tried to read the how tos for XS, but it makes my brain hurt.

For the longest time I've wanted Data::UUID on win32. When I started on Handel, I had looked into using Class::DBI::UUID for the primary columns, but the fact that it required Data::UUID and Data::UID didn't compile on win32 left me out of luck. I instead turned to using any of the various GUID/UUID modules on CPAN; using whatever the user had installed. Sometimes that was Data::UUID, or Win32::GUIDgen, Win32API::GUID or UUID. Life was good.

Today I cought the tinker bug and decided to get Data::UUID to compile on win32 come hell or high water. Not knowing a damn thing about c and any Makefile.PL->xs/linker magic, I actually managed to make it work.

There were two problems, first there was Makefile.PL errors:

C:\Data-UUID-0.11>perl Makefile.PL Checking if your kit is complete... Looks good UUID state storage (/var/tmp): C:\ default umask (0007): Note (probably harmless): No library found for -lsocket Writing Makefile for Data::UUID

I ignored that for the time being. Then there was the compile/linker errors. All I did was turn the top of UUID.h from this:

#include <string.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include "md5.h"

into this

#define __CYGWIN__ #include <string.h> #include <stdio.h> #include <stdlib.h> //#include <unistd.h> #include <time.h> #include "md5.h"

Now, nmake compiles and links the dll without errors and nmake test passes completely. Awesome. So, what's the problem you may ask? I'd like to submit the necessary patches to the author but I have no idea what the hell I just did or what to actually tweak in Makefile.PL/.h/.c

First, Data::UUID appears to run under CYGWIN and MING32. But of course on win32, neither of those are defined; hence the #define __CYGWIN__ line. Is there some magic that goes in Makefile.PL to get __CYGWIN__ defined or is that part of the compilers ENV?

Second, what about that "No library found" error? Should I simply ditch the LIBS => 'lsocket' def is we're on MSWin32?

I'm sure I could just describe my fixes to the author and wash my hands of it, but I wouldn't learn much that way.

-=Chris

Considered (GrandFather): move to meditations.
Unconsidered (holli): Enough Keep Votes (Keep/Edit/Delete: 11/14/1)


In reply to Fixing an XS based dist by jk2addict

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2022-06-26 18:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (86 votes). Check out past polls.

    Notices?