Skip Menu |

This queue is for tickets about the Perl-Dist-Strawberry CPAN distribution.

Report information
The Basics
Id: 103782
Status: open
Priority: 0/
Queue: Perl-Dist-Strawberry

People
Owner: Nobody in particular
Requestors: John.Unsworth [...] owmessaging.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated
Date: Fri, 17 Apr 2015 10:11:54 +0000
To: "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: John Unsworth <John.Unsworth [...] owmessaging.com>
Using strawberry-perl-5.18.4.1-32bit.msi. I need to load perl518.dll in my application to use embedded perl calls. However if perl518.dll needs to be relocated (a common requirement of windows dlls) a memory access error occurs. I built a simple Visual C application: printf("Trying to load perl518.dll ...\n"); HMODULE hm = LoadLibrary(L"C:\\strawberry518\\perl\\bin\\perl518.dll"); if (hm == NULL) { LPVOID lpMsgBuf; LPTSTR args[2]; args[0] = L"perl518.dll"; args[1] = NULL; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ARGUMENT_ARRAY, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, (va_list*)args ); printf("Error %d %S\n", GetLastError(), (const char*)lpMsgBuf); } If the application is built so that it loads at perl518 preferred address 0x63300000 then the above load results in: Trying to load perl518.dll ... Error 998 Invalid access to memory location. The error occurs in the dll initialization function. If I change the application base address so it doesn't clash then it loads successfully: TestLoad.exe C:\SmartSVN\CPMDS\Atlas\v4.0\shared\Bin\TestLoad.exe 64300000-6431A000 perl518.dll C:\strawberry518\perl\bin\perl518.dll 63300000-6347E000 It cannot be guaranteed that 63300000 will be available and so the dll has to be able to relocate. The same applies to any other dlls that you supply. This is a standard windows requirement. Regards, John.
Subject: RE: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated
Date: Wed, 22 Apr 2015 12:49:22 +0000
To: "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: John Unsworth <John.Unsworth [...] owmessaging.com>
It seems that some relocation does go on however not everything is relocated correctly. 006D1443 8B 54 24 24 mov edx,dword ptr [esp+24h] 006D1447 C7 05 14 B1 BF 9D 00 00 00 00 mov dword ptr ds:[9DBFB114h],0 006D1451 83 FA 01 cmp edx,1 006D1454 74 1A je 006D1470 The dll is loaded at 0x006d0000. The jump has been correctly relocated but the code at 006D1447 hasn't. John.
Subject: Re: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated
Date: Sat, 25 Apr 2015 09:30:16 +0200
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] cpan.org>
John, the strawberry perl uses standard build procedure for MS Windows + gcc environment. If the resulting binaries are not OK it is probably an issue in perl core. I'll try to ask people with more insight into this are. If you have any proposal for special compiler/liker flags that have to be used to nake DLL/EXE files correctly relocatable, please post it here. -- kmx
On Sat Apr 25 03:30:35 2015, KMX wrote: Show quoted text
> John, > > the strawberry perl uses standard build procedure for MS Windows + gcc > environment. > > If the resulting binaries are not OK it is probably an issue in perl core. > > I'll try to ask people with more insight into this are. > > If you have any proposal for special compiler/liker flags that have to be > used to nake DLL/EXE files correctly relocatable, please post it here. > > -- > kmx
Probably related to https://rt.cpan.org/Ticket/Display.html?id=78395#txn-1458443 where i used SP 5.18 to make that report.
Double relocation strikes again. From OP's post, prefered base address is 0x63300000, new addr by os is 0x006d0000, adjustment offset is 0x1006d0000-0x63300000=0x9D3D0000. 0x63300000+0x9D3D0000=0x006D0000. fault addr 0x9DBFB114-0x9D3D0000-0x9D3D0000 (2 reloc offsets), is 0x6345B114. OP reports original preferered address range of the XS DLL was 0x63300000 to 0x6347E000 and 0x6345B114 is within those bounds.
Subject: RE: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated
Date: Mon, 27 Apr 2015 21:03:27 +0000
To: "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: John Unsworth <John.Unsworth [...] owmessaging.com>
Note that ActiveState Perl 5.18 and 5.20 are built using mingw and have exactly the same problem. How do we get both Strawberry Perl and AS Perl fixed? Is the problem that causes the invalid relocations understood? Show quoted text
-----Original Message----- From: Daniel Dragan via RT [mailto:bug-Perl-Dist-Strawberry@rt.cpan.org] Sent: 25 April 2015 20:44 To: John Unsworth Subject: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated <URL: https://rt.cpan.org/Ticket/Display.html?id=103782 > Double relocation strikes again. From OP's post, prefered base address is 0x63300000, new addr by os is 0x006d0000, adjustment offset is 0x1006d0000-0x63300000=0x9D3D0000. 0x63300000+0x9D3D0000=0x006D0000. fault addr 0x9DBFB114-0x9D3D0000-0x9D3D0000 (2 reloc offsets), is 0x6345B114. OP reports original preferered address range of the XS DLL was 0x63300000 to 0x6347E000 and 0x6345B114 is within those bounds.
On Mon Apr 27 17:03:37 2015, John.Unsworth@owmessaging.com wrote: Show quoted text
> Note that ActiveState Perl 5.18 and 5.20 are built using mingw and > have exactly the same problem. How do we get both Strawberry Perl and > AS Perl fixed? Is the problem that causes the invalid relocations > understood?
Quick answer, switch to self compiled Visual C Perl. GCC maintainers see GCC on Win32 as a toy. If you used Visual C (like I do), you wouldn't have a linker that produces unrunable binaries. Mingw GCC still doesn't support 32 bit SEH, and GCC maintainers can't keep binary compatibility between GCC releases either (try mixing an app that links to libstdc++-6.dll where one is made with 4.6 and the other with 4.8, either way around, and you can have only one libstdc++-6.dll in a process). In all reality, the first, and most widely distributed (and still distributed by ActiveState PPM) Mingw for Perl can't even produce a hello world binary that doesn't SEGV on start. --------------------------------------------------------- C:\Documents and Settings\Administrator\Desktop\assert>C:\Perl3216\site\bin\gcc. exe -v Reading specs from C:/Perl3216/site/lib/auto/MinGW/bin/../lib/gcc/mingw32/3.4.5/ specs Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --wi th-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --dis able-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --d isable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --with out-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enabl e-hash-synchronization --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.5 (mingw-vista special r3) C:\Documents and Settings\Administrator\Desktop\assert>type assert.c int main(void) { return 0; } C:\Documents and Settings\Administrator\Desktop\assert>C:\Perl3216\site\bin\gcc. exe -lkernel32 -lmsvcrt assert.c -o assert.exe C:\Documents and Settings\Administrator\Desktop\assert>assert.exe ****CRASH BOX****** C:\Documents and Settings\Administrator\Desktop\assert> ---------------------------------------------------------- If you want to complain here are some places to try (the maintenance chain is so opaque and fluid that there is no one correct place) http://sourceforge.net/p/perlmingw/tickets/?source=navbar http://sourceforge.net/p/mingw-w64/bugs/ http://sourceforge.net/p/mingw/bugs/ https://www.sourceware.org/bugzilla/ https://gcc.gnu.org/bugzilla/
Subject: RE: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated
Date: Wed, 29 Apr 2015 07:29:48 +0000
To: "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: John Unsworth <John.Unsworth [...] owmessaging.com>
Just to be clear. I use VC to compile my applications but use Perl embedded. For customer ease of use we have an ActiveState OEM licence. I was looking at Strawberry Perl as a possible replacement. Regards, John. Show quoted text
-----Original Message----- From: Daniel Dragan via RT [mailto:bug-Perl-Dist-Strawberry@rt.cpan.org] Sent: 29 April 2015 02:04 To: John Unsworth Subject: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated <URL: https://rt.cpan.org/Ticket/Display.html?id=103782 > On Mon Apr 27 17:03:37 2015, John.Unsworth@owmessaging.com wrote:
> Note that ActiveState Perl 5.18 and 5.20 are built using mingw and > have exactly the same problem. How do we get both Strawberry Perl and > AS Perl fixed? Is the problem that causes the invalid relocations > understood?
Quick answer, switch to self compiled Visual C Perl. GCC maintainers see GCC on Win32 as a toy. If you used Visual C (like I do), you wouldn't have a linker that produces unrunable binaries. Mingw GCC still doesn't support 32 bit SEH, and GCC maintainers can't keep binary compatibility between GCC releases either (try mixing an app that links to libstdc++-6.dll where one is made with 4.6 and the other with 4.8, either way around, and you can have only one libstdc++-6.dll in a process). In all reality, the first, and most widely distributed (and still distributed by ActiveState PPM) Mingw for Perl can't even produce a hello world binary that doesn't SEGV on start. --------------------------------------------------------- C:\Documents and Settings\Administrator\Desktop\assert>C:\Perl3216\site\bin\gcc. exe -v Reading specs from C:/Perl3216/site/lib/auto/MinGW/bin/../lib/gcc/mingw32/3.4.5/ specs Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --wi th-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --dis able-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --d isable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --with out-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enabl e-hash-synchronization --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.5 (mingw-vista special r3) C:\Documents and Settings\Administrator\Desktop\assert>type assert.c int main(void) { return 0; } C:\Documents and Settings\Administrator\Desktop\assert>C:\Perl3216\site\bin\gcc. exe -lkernel32 -lmsvcrt assert.c -o assert.exe C:\Documents and Settings\Administrator\Desktop\assert>assert.exe ****CRASH BOX****** C:\Documents and Settings\Administrator\Desktop\assert> ---------------------------------------------------------- If you want to complain here are some places to try (the maintenance chain is so opaque and fluid that there is no one correct place) http://sourceforge.net/p/perlmingw/tickets/?source=navbar http://sourceforge.net/p/mingw-w64/bugs/ http://sourceforge.net/p/mingw/bugs/ https://www.sourceware.org/bugzilla/ https://gcc.gnu.org/bugzilla/
Could you please post here (or somewhere else) a small demo application (Visual studio *.sln) embeding strawberry perl?
Subject: RE: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated
Date: Fri, 5 Jun 2015 15:52:51 +0000
To: "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: John Unsworth <John.Unsworth [...] owmessaging.com>
Here is a MingW example. The same can be built using VS setting the correct options. I have libperl518.a in the build folder c:\MinGW\test. %PATH% has c:\strawberry518\perl\bin;c:\mingw\bin;... TestLoad.c #include "config.h" #include "EXTERN.h" #include "perl.h" #include "XSUB.h" int main(int argc, char* argv[]) { PerlInterpreter *my_perl = perl_alloc(); return 0; } Build c:\MinGW\test>gcc -o testload.exe -I "C:\strawberry518\perl\lib\CORE" -Wl,--image-base,0x63300000 testload.c libperl518.a Note that ActiveState Perl 518 has exactly the same problem because they built using MingW too. I am hoping for a test fix from them shortly that is supposed to sort out the double relocations. John.
Subject: RE: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated
Date: Mon, 17 Aug 2015 13:18:49 +0000
To: "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: John Unsworth <John.Unsworth [...] owmessaging.com>
FYI ActiveState have now released versions of Perl for Windows that fix this problem. Show quoted text
-----Original Message----- From: John Unsworth Sent: 05 June 2015 16:53 To: 'bug-Perl-Dist-Strawberry@rt.cpan.org' <bug-Perl-Dist-Strawberry@rt.cpan.org> Subject: RE: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated Here is a MingW example. The same can be built using VS setting the correct options. I have libperl518.a in the build folder c:\MinGW\test. %PATH% has c:\strawberry518\perl\bin;c:\mingw\bin;... TestLoad.c #include "config.h" #include "EXTERN.h" #include "perl.h" #include "XSUB.h" int main(int argc, char* argv[]) { PerlInterpreter *my_perl = perl_alloc(); return 0; } Build c:\MinGW\test>gcc -o testload.exe -I "C:\strawberry518\perl\lib\CORE" -Wl,--image-base,0x63300000 testload.c libperl518.a Note that ActiveState Perl 518 has exactly the same problem because they built using MingW too. I am hoping for a test fix from them shortly that is supposed to sort out the double relocations. John.
Subject: Re: [rt.cpan.org #103782] strawberry-perl-5.18.4.1-32bit: perl518.dll cannot be relocated
Date: Sat, 22 Aug 2015 22:40:42 +0200
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] cpan.org>
On 17.8.2015 15:19, John Unsworth via RT wrote: Show quoted text
> FYI ActiveState have now released versions of Perl for Windows that fix this problem.
Thanks for an update. Jan Dubois (from ActiveState) proposed a patch for perl core so it will be fixed in some future version (I hope for 5.22.1) -- kmx