Menu

#1942 link error for direct 2d on MinGW 64 w64 32bit

None
closed-fixed
nobody
2017-08-03
2017-07-11
No

Enivironments WIndows 10 Home
Msys2
MinGW W64
gcc 6.3.0 dwarf thread model win32 (from MinGW w64 site)

On 64 bit platform I did not see the below link error:

g++ -L/c/Programs/gplibs32_gcc630/lib -s -L/c/Programs/Qt/5.7.1_mgw32_630/lib -mconsole -L/c/Program\ Files\ \(x86\)/HTML\ Help\ Workshop/lib -L. -o gnuplot.exe 
<snip> 
wd2d.co 
<snip>
wd2d.co:wd2d.cpp:(.text+0x6586): undefined reference to `PTOpenProvider'
wd2d.co:wd2d.cpp:(.text+0x65b5): undefined reference to `PTConvertDevModeToPrintTicket'
wd2d.co:wd2d.cpp:(.text+0x65cb): undefined reference to `PTCloseProvider'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:630: gnuplot.exe] Error 1

Any suggestions?

Discussion

  • Bastian Märkisch

    • labels: --> Windows, Direct2D
    • status: open --> pending-works-for-me
    • Group: -->
    • Priority: -->
     
  • Bastian Märkisch

    You have to regenerate the prntvpt.lib for 32bit. Simply delete that file and re-run make. I will add prntvpt.lib to make clean.`

     
  • Tatsuro MATSUOKA

    For me, prntvpt.lib prntvpt.def which is generated by gendef gives undefined reference errors for 32 bit build. I tried def file generated by pexports and it does not give undefined reference errors.

     

    Last edit: Tatsuro MATSUOKA 2017-07-12
  • Tatsuro MATSUOKA

    > gendef
    <snip>
      -r, --disable-fs-redirector
                               Disable Win64 FS redirection, for 32-bit
                               gendef on 64-bit Windows
    

    Thus

    --- a/config/mingw/Makefile  2017-07-11 16:04:57.000000000 +0900
    +++ b/config/mingw/Makefile      2017-07-12 12:08:53.712946600 +0900
    @@ -749,8 +749,12 @@
    
     prntvpt.def:
     ifdef MINGW64
    +ifdef M32
    
    +       gendef - -r /c/Windows/System32/prntvpt.dll > prntvpt.def
    +else
            gendef - /c/Windows/System32/prntvpt.dll > prntvpt.def
     endif
    +endif
    
     # Working directory for patched Japanese sources
     JA = ja/
    

    The above works for me.

     
    • Bastian Märkisch

      Weird. The -r option doesn't hurt here either. But I still get identical output for the DEF file. Could you please post yours for comparison?
      I am running 32bit builds in the MINGW32 shell of MSYS2. Whereas I do the 64bit builds in the MINGW64 shell. What are you using?

       

      Last edit: Bastian Märkisch 2017-07-13
  • Tatsuro MATSUOKA

    I am using MinGW w64 32bit complier in the MINGW32 shell of MSYS2 for 32 bit build
    and
    using MinGW w64 64bit complier in the MINGW64 shell of MSYS2 for 64 bit build

    Note: MinGW w64 compliers (32 and 64 bit) are not downloaded from MSYS2 but from MinGW w64 project.

    On my MINGW32 shell of MSYS2

    $ gendef - /c/Windows/System32/prntvpt.dll
    ;
    ; Definition file of prntvpt.dll
    ; Automatic generated by gendef
    ; written by Kai Tietz 2008
    ;
    LIBRARY "prntvpt.dll"
    EXPORTS
    PTQuerySchemaVersionSupport@8
    PTOpenProvider@12
    PTOpenProviderEx@20
    PTCloseProvider@4
    BindPTProviderThunk@20
    PTGetPrintCapabilities@16
    PTMergeAndValidatePrintTicket@24
    PTConvertPrintTicketToDevMode@28
    PTConvertDevModeToPrintTicket@20
    PTReleaseMemory@4
    ConvertDevModeToPrintTicketThunk2@24
    ConvertDevModeToPrintTicketThunk@20
    ConvertPrintTicketToDevModeThunk2@32
    ConvertPrintTicketToDevModeThunk@28
    DllCanUnloadNow
    DllGetClassObject@12
    DllMain@12
    DllRegisterServer
    DllUnregisterServer
    GetDeviceDefaultPrintTicketThunk@12
    GetDeviceNamespacesThunk@12
    GetPrintCapabilitiesThunk2@24
    GetPrintCapabilitiesThunk@20
    GetSchemaVersionThunk@4
    MergeAndValidatePrintTicketThunk2@36
    MergeAndValidatePrintTicketThunk@28
    UnbindPTProviderThunk@4
    
     * [C:/Windows/System32/prntvpt.dll] Found PE image
    
    gendef - -r /c/Windows/System32/prntvpt.dll
    ;
    ; Definition file of prntvpt.dll
    ; Automatic generated by gendef
    ; written by Kai Tietz 2008
    ;
    LIBRARY "prntvpt.dll"
    EXPORTS
    PTQuerySchemaVersionSupport
    PTOpenProvider
    PTOpenProviderEx
    PTCloseProvider
    BindPTProviderThunk
    PTGetPrintCapabilities
    PTMergeAndValidatePrintTicket
    PTConvertPrintTicketToDevMode
    PTConvertDevModeToPrintTicket
    PTReleaseMemory
    ConvertDevModeToPrintTicketThunk
    ConvertDevModeToPrintTicketThunk2
    ConvertPrintTicketToDevModeThunk
    ConvertPrintTicketToDevModeThunk2
    DllCanUnloadNow
    DllGetClassObject
    DllMain
    DllRegisterServer
    DllUnregisterServer
    GetDeviceDefaultPrintTicketThunk
    GetDeviceNamespacesThunk
    GetPrintCapabilitiesThunk
    GetPrintCapabilitiesThunk2
    GetSchemaVersionThunk
    MergeAndValidatePrintTicketThunk
    MergeAndValidatePrintTicketThunk2
    UnbindPTProviderThunk
    
     * [C:/Windows/System32/prntvpt.dll] Found PE+ image
    

    On MINGW64 shell of MSYS2

    $ gendef - /c/Windows/System32/prntvpt.dll
    ;
    ; Definition file of prntvpt.dll
    ; Automatic generated by gendef
    ; written by Kai Tietz 2008
    ;
    LIBRARY "prntvpt.dll"
    EXPORTS
    PTQuerySchemaVersionSupport
    PTOpenProvider
    PTOpenProviderEx
    PTCloseProvider
    BindPTProviderThunk
    PTGetPrintCapabilities
    PTMergeAndValidatePrintTicket
    PTConvertPrintTicketToDevMode
    PTConvertDevModeToPrintTicket
    PTReleaseMemory
    ConvertDevModeToPrintTicketThunk
    ConvertDevModeToPrintTicketThunk2
    ConvertPrintTicketToDevModeThunk
    ConvertPrintTicketToDevModeThunk2
    DllCanUnloadNow
    DllGetClassObject
    DllMain
    DllRegisterServer
    DllUnregisterServer
    GetDeviceDefaultPrintTicketThunk
    GetDeviceNamespacesThunk
    GetPrintCapabilitiesThunk
    GetPrintCapabilitiesThunk2
    GetSchemaVersionThunk
    MergeAndValidatePrintTicketThunk
    MergeAndValidatePrintTicketThunk2
    UnbindPTProviderThunk
    
     * [C:/Windows/System32/prntvpt.dll] Found PE+ image
    

    In my case, -r is required for MINGW32 shell

     
  • Bastian Märkisch

    I think your gendef is getting confused about the calling convention. Could you please try if it works to use the -a option (--assume-stdcall) instead of -r?

     
  • Tatsuro MATSUOKA

    I tried on MinGW32 shell.

    $  gendef - -a /c/Windows/System32/prntvpt.dll
    ;
    ; Definition file of prntvpt.dll
    ; Automatic generated by gendef
    ; written by Kai Tietz 2008
    ;
    LIBRARY "prntvpt.dll"
    EXPORTS
    PTQuerySchemaVersionSupport@8
    PTOpenProvider@12
    PTOpenProviderEx@20
    PTCloseProvider@4
    BindPTProviderThunk@20
    PTGetPrintCapabilities@16
    PTMergeAndValidatePrintTicket@24
    PTConvertPrintTicketToDevMode@28
    PTConvertDevModeToPrintTicket@20
    PTReleaseMemory@4
    ConvertDevModeToPrintTicketThunk2@24
    ConvertDevModeToPrintTicketThunk@20
    ConvertPrintTicketToDevModeThunk2@32
    ConvertPrintTicketToDevModeThunk@28
    DllCanUnloadNow@0
    DllGetClassObject@12
    DllMain@12
    DllRegisterServer@0
    DllUnregisterServer@0
    GetDeviceDefaultPrintTicketThunk@12
    GetDeviceNamespacesThunk@12
    GetPrintCapabilitiesThunk2@24
    GetPrintCapabilitiesThunk@20
    GetSchemaVersionThunk@4
    MergeAndValidatePrintTicketThunk2@36
    MergeAndValidatePrintTicketThunk@28
    UnbindPTProviderThunk@4
    
     * [C:/Windows/System32/prntvpt.dll] Found PE image
    
     

    Last edit: Tatsuro MATSUOKA 2017-07-13
  • Bastian Märkisch

    Not really, that still gives @N appendices. I will add your patch to CVS. It still works for me that way.
    Thanks!

     
  • Bastian Märkisch

    • status: pending-works-for-me --> pending-fixed
     
  • Bastian Märkisch

    Revised version of the patch now in CVS.

     
  • Tatsuro MATSUOKA

    Todat I have met a link error on MinGW W64 32 bit build.

    wd2d.co:wd2d.cpp:(.text+0x6521): undefined reference to `PTCloseProvider@4'
    wd2d.co:wd2d.cpp:(.text+0x6549): undefined reference to `PTOpenProvider@12'
    wd2d.co:wd2d.cpp:(.text+0x657b): undefined reference to `PTConvertDevModeToPrintTicket@20'
    collect2.exe: error: ld returned 1 exit status
    make: *** [Makefile:627: gnuplot.exe] Error 1
    

    ????
    Anywar I deleted -r option from gendef command and link went well.

     
  • Tatsuro MATSUOKA

    link is OK. But I have met runtime error.
    (Tranalated from Japanese)

    Procuder entry pouint PTCloseProvider@4 cannot found in dynamic link library D:\(snip)\bin\wgnuplot.exe.   
    

    Hmmmm

     
  • Tatsuro MATSUOKA

    I have execute date specific comit cvs code. On the source code at ChangeLog date 2017-07-30, link goes well with gendef with -r option. The code chages on 2017-07-31 may affect the link error this time but I cannot figure out why.

     

    Last edit: Tatsuro MATSUOKA 2017-08-02
  • Tatsuro MATSUOKA

    The change on 2017-07-31:

    src/win/wd2d.cpp: Missing WINAPI call type for print ticket API.

    is the point of MinGW w64 32 bit build trouble at this time.
    Deleting WINAPI make build successful again.

    Can I locally revert this change?

     
  • Tatsuro MATSUOKA

    I have tried printing on 32 bit and 64bit. On 32 bit print hangs but it does not hang on 64bit.
    Perhaps add of WINAPI are really required but I could not have any solution for runtime error
    using def file without -r option.

     
  • Bastian Märkisch

    Tatsuro, I am sure that WINAPI aka __stdcall is the correct calling convention. So something is wrong about the def or lib file, but I haven't figured out what yet. I suggest you revert to using D2d 1.0 only for 32bit builds at the moment. That will disable printing via D2d and use GDI+ instead.

    Btw. if you link to the lib file from the Windows SDK instead of the one created locally, everyhing seems to work fine.

     
  • Tatsuro MATSUOKA

    Thanks for the reply. At the momend I I revert yo D2d 1.0 only for 32bit builds at the moment.
    I will try the Windows SDK in the future.

     
  • Tatsuro MATSUOKA

    I installed windows SDK and copy prntvpt.lib to my local lib directory for gnuplot 32 bit build and modified Makefile. D2d 1.1 works! Thanks!

     
  • Bastian Märkisch

    Third, now hopefully correct attempt:

    • WINAPI is the correct calling convention.
    • We need to create the def file from the correct DLL (no -r parameter to gendef).
    • We need to strip of the @n decorations when creating the import library.
      Fixed in CVS.
     
  • Tatsuro MATSUOKA

    Tha ks! I have confirmed the change this time gives expected results for direct 2D 1.1.

     
  • Bastian Märkisch

    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.