Skip Menu |

This queue is for tickets about the Future-AsyncAwait CPAN distribution.

Report information
The Basics
Id: 125613
Status: resolved
Priority: 0/
Queue: Future-AsyncAwait

People
Owner: Nobody in particular
Requestors: daxim [...] cpan.org
Cc:
AdminCc:

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



Subject: Win32 linker error: undefined reference to `_imp__Perl_unshare_hek'
Reporting this on RT so it doesn't fall under the table. This relates to thread <https://www.nntp.perl.org/group/perl.perl5.porters/2018/01/msg248983.html>. cpanm (App::cpanminus) 1.7043 on perl 5.026001 built for MSWin32-x86-multi-thread-64int Work directory is C:\Users\dieckow.l/.cpanm/work/1529317420.11144 You have make C:\Perl\c\bin\gmake.exe You have LWP 6.27 Falling back to Archive::Tar 2.26 Searching Future::AsyncAwait () on cpanmetadb ... --> Working on Future::AsyncAwait Fetching http://www.cpan.org/authors/id/P/PE/PEVANS/Future-AsyncAwait-0.15.tar.gz -> OK Unpacking Future-AsyncAwait-0.15.tar.gz Entering Future-AsyncAwait-0.15 Checking configure dependencies from META.json Checking if you have ExtUtils::Install 1.46 ... Yes (2.14) Checking if you have Module::Build 0.4004 ... Yes (0.4224) Configuring Future-AsyncAwait-0.15 Running Build.PL Created MYMETA.yml and MYMETA.json Creating new 'Build' script for 'Future-AsyncAwait' version '0.15' -> OK Checking dependencies from MYMETA.json ... Checking if you have Test::More 0.88 ... Yes (1.302096) Checking if you have ExtUtils::CBuilder 0 ... Yes (0.280226) Checking if you have Future 0 ... Yes (0.38) Building and testing Future-AsyncAwait-0.15 Building Future-AsyncAwait gcc -c -s -O2 -DWIN32 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -std=c89 -Ihax -s -O2 "-DVERSION=\"0.15\"" "-DXS_VERSION=\"0.15\"" -I"C:\Perl526\perl\lib\CORE" -I"C:\Perl526\c\include" -o "lib\Future\AsyncAwait.o" "lib\Future\AsyncAwait.c" ExtUtils::Mkbootstrap::Mkbootstrap('blib\arch\auto\Future\AsyncAwait\AsyncAwait.bs') Generating script 'lib\Future\AsyncAwait.lds' dlltool --def "lib\Future\AsyncAwait.def" --output-exp "lib\Future\AsyncAwait.exp" g++ -o "blib\arch\auto\Future\AsyncAwait\AsyncAwait.xs.dll" -Wl,--base-file,"lib\Future\AsyncAwait.base" -Wl,--image-base,0x22320000 -mdll -s -L"C:\Perl526\perl\lib\CORE" -L"C:\Perl526\c\lib" "lib\Future\AsyncAwait.lds" "lib\Future\AsyncAwait.exp" lib\Future\AsyncAwait.o:AsyncAwait.c:(.text+0x2947): undefined reference to `_imp__Perl_unshare_hek' collect2.exe: error: ld returned 1 exit status dlltool --def "lib\Future\AsyncAwait.def" --output-exp "lib\Future\AsyncAwait.exp" --base-file "lib\Future\AsyncAwait.base" g++ -o "blib\arch\auto\Future\AsyncAwait\AsyncAwait.xs.dll" -Wl,--image-base,0x22320000 -mdll -s -L"C:\Perl526\perl\lib\CORE" -L"C:\Perl526\c\lib" "lib\Future\AsyncAwait.lds" "lib\Future\AsyncAwait.exp" lib\Future\AsyncAwait.o:AsyncAwait.c:(.text+0x2947): undefined reference to `_imp__Perl_unshare_hek' collect2.exe: error: ld returned 1 exit status Generating script 'lib\Future\AsyncAwait.lds' dlltool --def "lib\Future\AsyncAwait.def" --output-exp "lib\Future\AsyncAwait.exp" g++ -o "blib\arch\auto\Future\AsyncAwait\AsyncAwait.xs.dll" -Wl,--base-file,"lib\Future\AsyncAwait.base" -Wl,--image-base,0x22320000 -mdll -s -L"C:\Perl526\perl\lib\CORE" -L"C:\Perl526\c\lib" "lib\Future\AsyncAwait.lds" "lib\Future\AsyncAwait.exp" lib\Future\AsyncAwait.o:AsyncAwait.c:(.text+0x2947): undefined reference to `_imp__Perl_unshare_hek' collect2.exe: error: ld returned 1 exit status dlltool --def "lib\Future\AsyncAwait.def" --output-exp "lib\Future\AsyncAwait.exp" --base-file "lib\Future\AsyncAwait.base" g++ -o "blib\arch\auto\Future\AsyncAwait\AsyncAwait.xs.dll" -Wl,--image-base,0x22320000 -mdll -s -L"C:\Perl526\perl\lib\CORE" -L"C:\Perl526\c\lib" "lib\Future\AsyncAwait.lds" "lib\Future\AsyncAwait.exp" lib\Future\AsyncAwait.o:AsyncAwait.c:(.text+0x2947): undefined reference to `_imp__Perl_unshare_hek' collect2.exe: error: ld returned 1 exit status
Turns out actually this function is fairly easy to avoid. Attached patch. -- Paul Evans
Subject: rt125613.patch
=== modified file 'lib/Future/AsyncAwait.xs' --- lib/Future/AsyncAwait.xs 2018-01-25 15:03:37 +0000 +++ lib/Future/AsyncAwait.xs 2018-01-25 15:07:15 +0000 @@ -27,10 +27,6 @@ # define CX_CUR() (&cxstack[cxstack_ix]) #endif -#ifndef unshare_hek -# define unshare_hek(a) Perl_unshare_hek(aTHX_ a) -#endif - #ifdef SAVEt_CLEARPADRANGE # include "save_clearpadrange.c.inc" #endif @@ -477,8 +473,16 @@ CvFILE(new) = CvDYNFILE(orig) ? savepv(CvFILE(orig)) : CvFILE(orig); #if HAVE_PERL_VERSION(5, 18, 0) - if(CvNAMED(orig)) - CvNAME_HEK_set(new, share_hek_hek(CvNAME_HEK(orig))); + if(CvNAMED(orig)) { + /* Perl core uses CvNAME_HEK_set() here, but that involves a call to a + * non-public function unshare_hek(). The latter is only needed in the + * case where an old value needs to be removed, but since we've only just + * created the CV we know it will be empty, so we can just set the field + * directly + */ + ((XPVCV*)MUTABLE_PTR(SvANY(new)))->xcv_gv_u.xcv_hek = share_hek_hek(CvNAME_HEK(orig)); + CvNAMED_on(new); + } else #endif CvGV_set(new, CvGV(orig));
Released in 0.16 -- Paul Evans