in reply to Re^2: Installing Javascript.pm on XP
in thread Installing Javascript.pm on XP

Please send me a patch with what you needed to change in order to get it to work on Windows and I'll integrate it.

preferably against the git repo http://github.com/claesjac/javascript.git

Cheers,
Claes

Replies are listed 'Best First'.
Re^4: Installing Javascript.pm on XP
by dogman1 (Novice) on Aug 06, 2009 at 01:30 UTC

    To be honest I have no idea how to make patch. :( I'm pretty much a noob at perl and programming in general.

    I really don't think I changed much though. I was still running into problems with the makefile.pl. Then I just decided to use the PPM shell and typed install JavaScript and that worked. I can now use the module in perl. I don't think anything I did before was a contributing factor to whether or not the Javascript.pm from the repository worked..

    Either way, the only changes I made anywhere was in Makefile.PL. The first thing I did was set the JS_INC and JS_LIB keys in the ENV hash to the correct directories. I did this by just assigning them a string value of the correct directories, so ...

    $ENV{JS_INC} = "C:\\strawberry\\js\\src"; $ENV{JS_LIB} = "C:\\strawberry\\js\\src\\WINNT5.1_OPT.OBJ";

    This "fix" is obviously very specific to my situation, so I don't know if it could help others that use different directories.

    Also in this section of the code, I changed $lib="js" to $lib="js32", because my .lib file was called js32.lib.

    if (exists $ENV{JS_LIB}) { @libs = get_paths($ENV{JS_LIB}); $ENV{DYLD_LIBRARY_PATH} = $ENV{LD_LIBRARY_PATH} = $ENV{JS_LIB}; $lib = "js"; }

    After that, the makefile.pl would give the correct gcc command with the correct directories, but now it would return a ton of compiling errors. and the first error was something like this:

    C:\strawberry\cpan\build\JavaScript-1.12-mJTECJ>makefile.pl In file included from C:/strawberry/js/src/jspubtd.h:45, from C:/strawberry/js/src/jsapi.h:47, from JavaScript_Env.h:10, from test_js.c:2: C:/strawberry/js/src/jstypes.h:248:6: #error "Must define one of XP_BE +OS, XP_OS2, XP_WIN or XP_UNIX" C:/strawberry/js/src/jstypes.h:264:2: #error No suitable type for JSIn +t8/JSUint8 C:/strawberry/js/src/jstypes.h:277:2: #error No suitable type for JSIn +t16/JSUint16 C:/strawberry/js/src/jstypes.h:297:2: #error No suitable type for JSIn +t32/JSUint32

    It was asking for XP_BEOS, XP_OS2, XP_WIN or XP_UNIX, and I saw that JavaScript_Env.h had a line that said

    #define XP_PC

    So I edited the Makefile.pl again so that it would now ouput 'XP_WIN' in place of 'XP_PC' to the .h file. This would no longer generate a super long list of compiling errors. Instead it started returning this:

    C:\strawberry\cpan\build\JavaScript-1.12-mJTECJ>makefile.pl C:\DOCUME~1\Steve\LOCALS~1\Temp/ccQm7OVj.o:test_js.c:(.text+0x2b): und +efined ref erence to `JS_GetImplementationVersion' collect2: ld returned 1 exit status Failed compiling test_js.c. ABORTING

    Those are the only changes I made. If I try to run makefile.pl now, I still get that message. I don't know what causes it or how to fix it. I'm doing this all in the cpan/build folder where cpan downloads the Makefile and other module components.

      The 'undefined reference' means that the library that resolves that symbol has not been located.
      In the Makefile.PL there's a line:
      my $cc = join(" ", $Config{cc}, $libs, @ccflags, "-l${lib}", "-o", $ex +e, (map { "-I$_" } @incs), "test_js.c");
      It would be helpful if you could insert a print "$cc\n"; into that Makefile.PL and re-run it again so we can see just what that command ($cc) actually is.
      I think that ${lib} in the above command is set to 'js', so 'libjs.a' or 'js.a' or 'js.lib' needs to be found. Is there such a file in in $ENV{JS_LIB} ?

      Cheers,
      Rob
Re^4: Installing Javascript.pm on XP
by Anonymous Monk on Aug 06, 2009 at 13:16 UTC
    Here is patch (git diff > patch) XSUB order fixed according to this. test_js order fixed according to this. :nosearch is for bug in activeperl/strawberry/ExtUtils::LibList

    This patch will get you up to this linker failure

    All these undefined reference to _imp_, are present in the *.o files, and error is because of order of *.o files. I can't figure out the correct order.
      please send any patches to claesjac@cpan.org as I don't follow perlmonks
        Sorry claesjac, I don't do emails :)
        Replace in PJS_Common.h: -#define PJS_EXTERN EXT +#define PJS_EXTERN extern __declspec(dllexport) to link this thing on win32