Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build module #4

Closed
noaoh opened this issue Jul 30, 2020 · 11 comments · Fixed by #5
Closed

Unable to build module #4

noaoh opened this issue Jul 30, 2020 · 11 comments · Fixed by #5

Comments

@noaoh
Copy link

noaoh commented Jul 30, 2020

Hello there! I am attempting to build this code on a Windows Server 2019 Datacenter machine. I have Visual Studio 2019 with the Microsoft c++ toolset installed, gcc version 9.2.0 installed via MinGW. Here is the
build.log I get when attempting to build this module from source.

@atoomic
Copy link
Owner

atoomic commented Jul 30, 2020

log output

cpanm (App::cpanminus) 1.7044 on perl 5.014002 built for MSWin32-x64-multi-thread
Work directory is C:\Users\n0h0130/.cpanm/work/1596121006.7408
You have make C:\PROGRA~2\MIB055~1\2019\ENTERP~1\VC\Tools\MSVC\1426~1.288\bin\HostX86\x64\nmake.exe
You have LWP 6.02
Falling back to Archive::Tar 1.78
Searching XString () on cpanmetadb ...
-> FAIL Finding XString on cpanmetadb failed.
! Could not find a release matching XString on MetaCPAN.
Searching XString on mirror https://repository.walmart.com/repository/cpan-releases ...
Downloading index file https://repository.walmart.com/repository/cpan-releases/modules/02packages.details.txt.gz ...
--> Working on XString
Fetching https://repository.walmart.com/repository/cpan-releases/authors/id/A/AT/ATOOMIC/XString-0.002.tar.gz
-> OK
Unpacking XString-0.002.tar.gz
Entering XString-0.002
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.46)
Configuring XString-0.002
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a nmake-style Makefile
Writing Makefile for XString
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Test::More 0 ... Yes (1.302175)
Checking if you have File::Temp 0 ... Yes (0.22)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.46)
Checking if you have File::Spec 0 ... Yes (3.33)
Checking if you have Test2::Plugin::NoWarnings 0 ... Yes (0.09)
Checking if you have Test2::Bundle::Extended 0 ... Yes (0.000130)
Checking if you have Test2::Tools::Explain 0 ... Yes (0.02)
Building and testing XString-0.002

Microsoft (R) Program Maintenance Utility Version 14.26.28806.0
Copyright (C) Microsoft Corporation.  All rights reserved.

cp lib/XString.pm blib\lib\XString.pm
Running Mkbootstrap for XString ()
	"C:\Perl64\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "XString.bs"
	"C:\Perl64\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- XString.bs blib\arch\auto\XString\XString.bs 644
	"C:\Perl64\bin\perl.exe" "C:\Perl64\lib\ExtUtils\xsubpp"  -typemap C:\Perl64\lib\ExtUtils\typemap  XString.xs > XString.xsc
Please specify prototyping behavior for XString.xs (see perlxs manual)
	"C:\Perl64\bin\perl.exe" -MExtUtils::Command -e mv -- XString.xsc XString.c
	cl -c    -nologo -GF -W3 -MD -Zi -DNDEBUG -Ox -GL -fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -MD -Zi -DNDEBUG -Ox -GL -fp:precise    -DVERSION=\"0.002\"  -DXS_VERSION=\"0.002\"  "-IC:\Perl64\lib\CORE"   -FdXString.pdb XString.c
XString.c
C:\Perl64\lib\CORE\win32.h(250): warning C4005: 'isnan': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_math.h(276): note: see previous definition of 'isnan'
	"C:\Perl64\bin\perl.exe" -MExtUtils::Mksymlists  -e "Mksymlists('NAME'=>\"XString\", 'DLBASE' => 'XString', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
	link -out:blib\arch\auto\XString\XString.dll -dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg  -libpath:"C:\Perl64\lib\CORE"  -machine:AMD64 XString.obj   "C:\Perl64\lib\CORE\perl514.lib" oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib  msvcrt.lib -def:XString.def
   Creating library blib\arch\auto\XString\XString.lib and object blib\arch\auto\XString\XString.exp
XString.obj : error LNK2001: unresolved external symbol strchr
msvcrt.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol _initterm
msvcrt.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol _initterm_e
msvcrt.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol __C_specific_handler
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol __C_specific_handler
msvcrt.lib(tncleanup.obj) : error LNK2001: unresolved external symbol __std_type_info_destroy_list
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _seh_filter_dll
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _configure_narrow_argv
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _initialize_narrow_environment
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _initialize_onexit_table
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _register_onexit_function
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _execute_onexit_table
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _crt_atexit
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _crt_at_quick_exit
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _cexit
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol terminate
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol __current_exception
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol __current_exception_context
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol memset
blib\arch\auto\XString\XString.dll : fatal error LNK1120: 18 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\link.EXE"' : return code '0x460'
Stop.
-> FAIL Installing XString failed. See C:\Users\n0h0130\.cpanm\work\1596121006.7408\build.log for details. Retry with --force to force install it.

@atoomic
Copy link
Owner

atoomic commented Jul 30, 2020

it seems the error comes from strchr
XString.obj : error LNK2001: unresolved external symbol strchr

@atoomic
Copy link
Owner

atoomic commented Jul 30, 2020

I think adding #include <string.h> to XString.xs should fix it
@noaoh can you confirm? thanks

atoomic added a commit that referenced this issue Jul 30, 2020
Fix #4

strchr is coming from string.h
we should import it to make sure it's available.
atoomic added a commit that referenced this issue Jul 30, 2020
Fix #4

strchr is coming from string.h
we should import it to make sure it's available.
@atoomic
Copy link
Owner

atoomic commented Jul 30, 2020

@noaoh please view #5 could you give it a try? if so I will release an update with the fix
thanks

@noaoh
Copy link
Author

noaoh commented Jul 30, 2020

I tried it out and got the following build log:

Microsoft (R) Program Maintenance Utility Version 14.26.28806.0
Copyright (C) Microsoft Corporation.  All rights reserved.

cp lib/XString.pm blib\lib\XString.pm
Running Mkbootstrap for XString ()
        "C:\Perl64\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "XString.bs"
        "C:\Perl64\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- XString.bs blib\arch\auto\XString\XString.bs 644
        "C:\Perl64\bin\perl.exe" "C:\Perl64\lib\ExtUtils\xsubpp"  -typemap C:\Perl64\lib\ExtUtils\typemap  XString.xs > XString.xsc
Please specify prototyping behavior for XString.xs (see perlxs manual)
        "C:\Perl64\bin\perl.exe" -MExtUtils::Command -e mv -- XString.xsc XString.c
        cl -c    -nologo -GF -W3 -MD -Zi -DNDEBUG -Ox -GL -fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -MD -Zi -DNDEBUG -Ox -GL -fp:precise    -DVERSION=\"0.003\"  -DXS_VERSION=\"0.003\"  "-IC:\Perl64\lib\CORE"   -FdXString.pdb XString.c
XString.c
C:\Perl64\lib\CORE\win32.h(250): warning C4005: 'isnan': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_math.h(276): note: see previous definition of 'isnan'
        "C:\Perl64\bin\perl.exe" -MExtUtils::Mksymlists  -e "Mksymlists('NAME'=>\"XString\", 'DLBASE' => 'XString', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
        link -out:blib\arch\auto\XString\XString.dll -dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg  -libpath:"C:\Perl64\lib\CORE"  -machine:AMD64 XString.obj   "C:\Perl64\lib\CORE\perl514.lib" oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib  msvcrt.lib -def:XString.def
   Creating library blib\arch\auto\XString\XString.lib and object blib\arch\auto\XString\XString.exp
XString.obj : error LNK2001: unresolved external symbol strchr
msvcrt.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol _initterm
msvcrt.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol _initterm_e
msvcrt.lib(dll_dllmain.obj) : error LNK2001: unresolved external symbol __C_specific_handler
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol __C_specific_handler
msvcrt.lib(tncleanup.obj) : error LNK2001: unresolved external symbol __std_type_info_destroy_listmsvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _seh_filter_dll
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _configure_narrow_argv
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _initialize_narrow_environmentmsvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _initialize_onexit_table
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _register_onexit_function
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _execute_onexit_table
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _crt_atexit
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _crt_at_quick_exit
msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol _cexit
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol terminate
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol __current_exception
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol __current_exception_context
msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved external symbol memset
blib\arch\auto\XString\XString.dll : fatal error LNK1120: 18 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX86\x64\link.EXE"' : return code '0x460'
Stop.

@atoomic
Copy link
Owner

atoomic commented Jul 30, 2020

seems like the same issue XString.obj : error LNK2001: unresolved external symbol strchr

@noaoh
Copy link
Author

noaoh commented Jul 30, 2020

It looks somewhat similar to this issue: MrGF/py-faster-rcnn-windows#30. At least the missing strchr part.

@atoomic
Copy link
Owner

atoomic commented Jul 30, 2020

I'm not sure how to fix this issue on windows, adding @bulk88 to the conversation in case he's aware of a solution

@ikegami
Copy link

ikegami commented Aug 3, 2020

Looks like some library isn't provided to link as it should be.

Specifically, this is relevant.

In light of that, I think the problem is that the petitioner is using a different compiler than the one that was used to build perl.

@atoomic
Copy link
Owner

atoomic commented Aug 3, 2020

@ikegami can you confirm this is an error from the user?
Anything I can do on my side to force these libraries to be required?

@ikegami
Copy link

ikegami commented Aug 3, 2020

I can't confirm that. It's out of my area of expertise. I'd have to recreate the problem, and fix it.

If it is missing libraries, it might be possible to fix the problem without changing compiler version by editing in the missing libraries in the OP's Config_heavy.pl

That could probably be done in Makefile.PL as well, but that seems out of place. If the Q&A I linked is right, the OP will have the same problem with other XS modules too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants