ptex icon indicating copy to clipboard operation
ptex copied to clipboard

Linking issues on Windows

Open KelSolaar opened this issue 2 years ago • 5 comments

Hello,

I'm trying to build OpenImageIO with Ptex support and I'm having linking issues:

ptexinput.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl Ptex::v2_3::String::~String(void)" (__imp_??1String@v2_3@Ptex@@QEAA@XZ) referenced in function "public: virtual bool __cdecl OpenImageIO_v2_2::PtexInput::open(class std::basic_string<char,struct std::char_traits<char>
,class std::allocator<char> > const &,class OpenImageIO_v2_2::ImageSpec &)" (?open@PtexInput@OpenImageIO_v2_2@@UEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAVImageSpec@2@@Z) [...\openimageio\build\platform-windows\arch-AMD64\msvc-19.1\python-3.7\qt-5.15.
2.rf1\oiio\src\libOpenImageIO\OpenImageIO.vcxproj]

ptexinput.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class Ptex::v2_3::PtexTexture * __cdecl Ptex::v2_3::PtexTexture::open(char const *,class Ptex::v2_3::String &,bool)" (__imp_?open@PtexTexture@v2_3@Ptex@@SAPEAV123@PEBDAEAVString@23@_N@Z) referenced in function "public:
 virtual bool __cdecl OpenImageIO_v2_2::PtexInput::open(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class OpenImageIO_v2_2::ImageSpec &)" (?open@PtexInput@OpenImageIO_v2_2@@UEAA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAVImageSpec@2@@Z
) [...\openimageio\build\platform-windows\arch-AMD64\msvc-19.1\python-3.7\qt-5.15.2.rf1\oiio\src\libOpenImageIO\OpenImageIO.vcxproj]
...\openimageio\build\platform-windows\arch-AMD64\msvc-19.1\python-3.7\qt-5.15.2.rf1\oiio\bin\Release\OpenImageIO.dll : fatal error LNK1120: 2 unresolved externals [...\openimageio\build\platform-windows\arch-AMD64\msvc-19.1\python-3.7\qt-5.15.2.rf1\
oiio\src\libOpenImageIO\OpenImageIO.vcxproj]

I looked at the exported symbols in my built Ptex.dll and there are small differences between what OpenImagIO is looking for and what is being exported:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>dumpbin /exports H:\Documents\Development\ThirdParty\Ptex\build\platform-windows\arch-AMD64\msvc-19.1\release\lib\Ptex.dll
Microsoft (R) COFF/PE Dumper Version 14.00.24245.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file H:\Documents\Development\ThirdParty\Ptex\build\platform-windows\arch-AMD64\msvc-19.1\release\lib\Ptex.dll

File Type: DLL

  Section contains the following exports for Ptex.dll

    00000000 characteristics
    FFFFFFFF time date stamp
        0.00 version
           1 ordinal base
          19 number of functions
          19 number of names

    ordinal hint RVA      name

          1    0 0001E030 ??1String@v2_3@Ptex@@QEAA@XZ
          2    1 0001E040 ??4String@v2_3@Ptex@@QEAAAEAV012@PEBD@Z
          3    2 0001E640 ?BorderModeName@v2_3@Ptex@@YAPEBDW4BorderMode@12@@Z
          4    3 0001E660 ?ConvertFromFloat@v2_3@Ptex@@YAXPEAXPEBMW4DataType@12@H@Z
          5    4 0001E960 ?ConvertToFloat@v2_3@Ptex@@YAXPEAMPEBXW4DataType@12@H@Z
          6    5 0001EAD0 ?DataTypeName@v2_3@Ptex@@YAPEBDW4DataType@12@@Z
          7    6 0001EAF0 ?EdgeFilterModeName@v2_3@Ptex@@YAPEBDW4EdgeFilterMode@12@@Z
          8    7 0001EB10 ?EdgeIdName@v2_3@Ptex@@YAPEBDW4EdgeId@12@@Z
          9    8 0001EB30 ?MeshTypeName@v2_3@Ptex@@YAPEBDW4MeshType@12@@Z
         10    9 0001EB50 ?MetaDataTypeName@v2_3@Ptex@@YAPEBDW4MetaDataType@12@@Z
         11    A 00024B20 ?applyEdits@PtexWriter@v2_3@Ptex@@SA_NPEBDAEAVString@23@@Z
         12    B 00001FC0 ?create@PtexCache@v2_3@Ptex@@SAPEAV123@H_K_NPEAVPtexInputHandler@23@PEAVPtexErrorHandler@23@@Z
         13    C 00025180 ?edit@PtexWriter@v2_3@Ptex@@SAPEAV123@PEBD_NW4MeshType@23@W4DataType@23@HHHAEAVString@23@1@Z
         14    D 00077000 ?f2hTable@PtexHalf@v2_3@Ptex@@2PAGA
         15    E 00004C80 ?fromFloat_except@PtexHalf@v2_3@Ptex@@CAGI@Z
         16    F 00004920 ?getFilter@PtexFilter@v2_3@Ptex@@SAPEAV123@PEAVPtexTexture@23@AEBUOptions@123@@Z
         17   10 00037000 ?h2fTable@PtexHalf@v2_3@Ptex@@2PAIA
         18   11 0000AE80 ?open@PtexTexture@v2_3@Ptex@@SAPEAV123@PEBDAEAVString@23@_N@Z
         19   12 00026CE0 ?open@PtexWriter@v2_3@Ptex@@SAPEAV123@PEBDW4MeshType@23@W4DataType@23@HHHAEAVString@23@_N@Z

  Summary

       46000 .data
        3000 .pdata
        B000 .rdata
        1000 .reloc
        1000 .rsrc
       2B000 .text
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>undname ??1String@v2_3@Ptex@@QEAA@XZ
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "??1String@v2_3@Ptex@@QEAA@XZ"
is :- "public: __cdecl Ptex::v2_3::String::~String(void) __ptr64"
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>undname ?open@PtexTexture@v2_3@Ptex@@SAPEAV123@PEBDAEAVString@23@_N@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "?open@PtexTexture@v2_3@Ptex@@SAPEAV123@PEBDAEAVString@23@_N@Z"
is :- "public: static class Ptex::v2_3::PtexTexture * __ptr64 __cdecl Ptex::v2_3::PtexTexture::open(char const * __ptr64,class Ptex::v2_3::String & __ptr64,bool)"
  • OIIO: public: __cdecl Ptex::v2_3::String::~String(void)
  • Ptex: public: __cdecl Ptex::v2_3::String::~String(void) __ptr64
  • OIIO: public: static class Ptex::v2_3::PtexTexture * __cdecl Ptex::v2_3::PtexTexture::open(char const *,class Ptex::v2_3::String &,bool)
  • Ptex: public: static class Ptex::v2_3::PtexTexture * __ptr64 __cdecl Ptex::v2_3::PtexTexture::open(char const * __ptr64,class Ptex::v2_3::String & __ptr64,bool)

As far as I can tell, the only difference is __ptr64, I'm building everything for x64 and I'm unclear if it is an OIIO issue at this point or Ptex. Paging @lgritz just in case he has an idea!

Cheers,

Thomas

KelSolaar avatar Aug 17 '21 03:08 KelSolaar