Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^8: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location

by bulk88 (Priest)
on Dec 05, 2012 at 04:31 UTC ( #1007193=note: print w/ replies, xml ) Need Help??


in reply to Re^7: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location
in thread if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location

Google (http://groups.google.com/group/microsoft.public.win32.programmer.kernel/msg/4e96409329944018?dmode=source) says you have a non-relocatable DLL. I think you messed up a different compiler flag when you removed -s, or there is a bug in your Mingw. Look for a PE .reloc section (looking at mingw produced dlls, they all have .reloc sections), or for a by the book answer 100% accurate answer, look in the Data Directory, then at IMAGE_DIRECTORY_ENTRY_BASERELOC entry ("Relocation Table") and make the RVA and size aren't 0. I use StudPE. There are other tools out there ("dumpbin mydll.dll" will show section names and sizes, I also know of PE Explorer (shareware)). Try running dependency walker on a dll that was compiled with "-s" and the makefile unchanged.


Comment on Re^8: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location
Re^9: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location
by Anonymous Monk on Dec 05, 2012 at 05:08 UTC

    I think you messed up a different compiler flag when you removed -s

    I did the first time and it wouldn't compile, but not this time, I'm sure :)

    or there is a bug in your Mingw

    This could very well be, but the message is the same with both my perls and compilers -- one is everything compiled with  gcc version 4.6.3 (gcc-4.6.3 release with patches [build 20121012 by perlmingw.sf.net]) the other is a mix of gcc versions ( perl compiled with 4.5.2, maybe (probably not) some modules with 4.6 something, xml2 with 4.7.0 ), but the errors messages are identical

    I've also got filealyzer and gcc comes with dumpbin-alike objdump, and there is a reloc section listed with a "RVA" entry size aren't 0

    $ ack -in size 2 |head SizeOfCode 0010f000 SizeOfInitializedData 00288800 SizeOfUninitializedData 00001a00 SizeOfImage 005d0000 SizeOfHeaders 00000600 SizeOfStackReserve 00200000 SizeOfStackCommit 00001000 SizeOfHeapReserve 00100000 SizeOfHeapCommit 00001000 NumberOfRvaAndSizes 00000010 $ ack -n RVA 2 [ 0] +base[ 1] 2b500 Export RVA [ 1] +base[ 2] 2b500 Export RVA

    My search for that error message yielded http://stackoverflow.com/questions/2622607/windows-loader-problem-turn-on-verbose-mode which I don't understand :)

        Same messsage :)

        $ perl badcrabs.txt ret=1849688064 glr=2 $ perl -MDigest::SHA1 badcrabs.txt ret=0 glr=193

        In depends.exe its now

        LDR: LdrRelocateImageWithBias() failed 0xc000007b
        LDR: OldBase     : 6E400000
        LDR: NewBase     : 00A90000
        LDR: Diff        : 0xffffffff92690000
        LDR: NextOffset  : 00CC9F90
        LDR: *NextOffset : 0x302e
        LDR: SizeOfBlock : 0x5c
        

        Compared to -MDigest::SHA1 -MXML::LibXML

        LDR: LdrRelocateImageWithBias() failed 0xc000007b
        LDR: OldBase     : 6E400000
        LDR: NewBase     : 010A0000
        LDR: Diff        : 0xffffffff92ca0000
        LDR: NextOffset  : 012D9F90
        LDR: *NextOffset : 0x302e
        LDR: SizeOfBlock : 0x5c

        Apparently LdrRelocate... errors happen ( Weird problem loading a dll with win32 LoadLibrary() function ) commonly with cygwin , and they recommend using some "rebaseall" shell script, and I saw they do some rebase-ing for MakeMaker/cygwin

        So I look through my dlls $ perl -lne " chomp; print; print qx{objdump -x $_ |grep ImageBase }; " dlls.txt and both Digest/SHA1/SHA1.dll and auto/XML/LibXML/LibXML.dll share ImageBase 6e400000

        Not sure if this is a problem but http://www.sourceware.org/ml/cygwin-apps/2011-07/msg00002.html / http://www.sourceware.org/ml/cygwin/2010-07/msg00258.html / perl5140delta suggests this collision is the problem , so I'll need to rebase, so I try that with the default rebase-2.4.2 address

         perl -pi.orig -e " s{^(LDDLFLAGS = )}{$1 -Wl,--image-base=0x70000000 }; " Makefile

        and it worked!!!!!

        *whew*

        So from time to time I'll have to rebase a few dlls if I stick with this old OS

Re^9: if Digest::SHA1 loaded Can't load LibXML/LibXML.dll Invalid access to memory location
by syphilis (Canon) on Dec 05, 2012 at 11:27 UTC
    "dumpbin mydll.dll" will show section names and sizes

    I have 2 builds of PLplot.dll - both are the same size (3,327,028 bytes). I have named one of them PLplot_broken.dll, and the other PLplot_ok.dll. They can be obtained from:
    http://www.sisyphusion.tk/junk/PLplot_broken.dll and http://www.sisyphusion.tk/junk/PLplot_ok.dll
    Both were built using the same compiler, and against the same plplot static library.
    Running 'dumpbin PLplot_broken.dll' and 'dumpbin PLplot_ok.dll produces identical results (except of course, for the file name that is reported):
    Microsoft (R) COFF/PE Dumper Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file PLplot_ok.dll File Type: DLL Summary 1000 .CRT B000 .bss 6000 .data 1000 .debug_abbrev 1000 .debug_aranges B3000 .debug_info 1B000 .debug_line 92000 .debug_loc A000 .debug_ranges 2000 .debug_str C000 .edata 16000 .eh_frame 2000 .idata 16000 .rdata 4E000 .reloc 10E000 .text 1000 .tls
    If I use PLplot_ok.dll as the PLplot.dll I get:
    C:\>pmver PDL::Graphics::PLplot 0.61
    If I use PLplot_broken.dll as the PLplot.dll I get:
    C:\>pmver PDL::Graphics::PLplot Can't load 'C:/MinGW/perl589/site/lib/auto/PDL/Graphics/PLplot/PLplot. +dll' for module PDL::Graphics::PLplot: load_file:%1 is not a valid Wi +n32 application at C:/MinGW/perl589/lib/DynaLoader.pm line 226. at -e line 1 Compilation failed in require at -e line 1.
    Any advice on how I might be able to come to an understanding of why one is ok, but the other not, would be most welcome.

    Cheers,
    Rob
      sections /29, /59, and .reloc are different sizes. .text is identical size. The instructions in .text I am pretty sure (didn't look too deeply, using my tools) are identical except for the effects of relocation. The 2 DLLs have different base addresses, and both are i386 and have identical PE headers except for the relocation. Where can I get a copy of libgcc_s_dw2-1.dll? Strawberry perl 5.8.9.5 doesn't have one.

      *Both* files gave me this warning when I used PE Explorer on them.

      " Warning! Section </4> (3) extends beyond the raw file offset of section <.bss> (4)."
        Where can I get a copy of libgcc_s_dw2-1.dll?

        I've just uploaded it to here.
        It's a dll that ships with the mingw.org builds of 32-bit gcc. Strawberry's compilers are built by a different vendor.

        Thanks for taking a look.

        Cheers,
        Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007193]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (15)
As of 2014-08-01 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (37 votes), past polls