Re: Building PL/Perl with ActiveState Perl 5.22 and MSVC
Noah Misch <noah@leadboat.com>
From: Noah Misch <noah@leadboat.com>
To: Victor Wagner <vitus@wagner.pp.ru>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-12-09T18:27:25Z
Lists: pgsql-hackers
On Mon, Nov 13, 2017 at 07:41:42AM +0000, Noah Misch wrote: > On Sat, Mar 26, 2016 at 03:43:21PM +0300, Victor Wagner wrote: > > 1. ActiveState Perl doesn't ship MSVC-build import library perl522.lib > > for their perl522.dll. Instead they ship MINGW-build library > > libperl522.a. > > 2. There is macro PERL_STATIC_INLINME in perl's lib/CORE/config.h file, > > which produces compilation errors. > I've seen the same problems, and I converted your description into the > attached patch. With ActivePerl-5.24.1.2402-MSWin32-x64-401627.exe binaries, > "vcregress plcheck" passes. I plan to back-patch this. If some site has > worked around this with "copy libperl522.a perl522.lib", that site's build > will fail due to having two matching libraries. The build failure and fix > will be clear enough, so that seems acceptable. I pushed commit 84c4313. > > 3. Fixing two issues above was enough to make build complete for 64-bit > > windows target. With 32-bit build I'v got linking errors > > LINK2026: module unsafe for safeseh image > > > > for all modules which are linked with perl DLL. I suspect that it is > > not a problem with DLL itself, it is rather related to way MINGW32 > > generates its import libraries. To fix this problem XML element > > <ImageHasSafeExceptionHandlers>false</ImageHasExceptionHandlers> > > should be added inside <Link> element of the two vcxproj files which > > link with perl - plperl.vcxproj and hstore_plperl.vcxproj. > > Official 10.1 x86 binaries[1] contain a SAFESEH build of plperl.dll, linked > with a perl524.dll. I wonder how. Do they use a perl524.dll from a source > other than ActivePerl? Yes; they distribute a custom, MSVC-built Perl. > Also, I'd instead use > "<ImageHasSafeExceptionHandlers/>", which omits /SAFESEH entirely instead of > passing /SAFESEH:NO. That way, only the binaries linked to Perl (or other > old-fashioned DLLs) lose their safe exception handler table. I pushed commit 7e0c574. > Even if I do this, "vcregress plcheck" fails with "loadable library and perl > binaries are mismatched (got handshake key 0B080080, needed 0AF00080)". > That's building with ActivePerl-5.22.4.2205-MSWin32-x86-64int-403863.exe and > VS2015. Commit 65a00f3 resolved that. I think support for 32-bit Perl on Windows is now back up to standard.
Commits
-
MSVC 2012+: Permit linking to 32-bit, MinGW-built libraries.
- d78c3ca0ea10 9.4.16 landed
- 70dc7ad584f5 9.3.21 landed
- 470de6a24d37 9.5.11 landed
- e2cc65050b0b 10.2 landed
- 055532badd16 9.6.7 landed
- 7e0c574ee26c 11.0 landed
-
MSVC: Test whether 32-bit Perl needs -D_USE_32BIT_TIME_T.
- 65a00f30352a 11.0 cited
-
Support linking with MinGW-built Perl.
- 83e6b1434402 9.3.21 landed
- 558f6207928b 9.4.16 landed
- da8eae56eb4e 9.5.11 landed
- 1695ce068604 9.6.7 landed
- f16a0958d0eb 10.2 landed
- 84c4313c6f6a 11.0 landed