Skip to content

Commit

Permalink
Added example VS link errors, and added unit test for isilating VS li…
Browse files Browse the repository at this point in the history
…nk errors. VS not integrated yet.
  • Loading branch information
jwgrenning committed Sep 14, 2019
1 parent 34f5c24 commit 8783091
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ $ path/to/gen-xfakes.sh error-output.txt xfakes
## Supported formats

* g++ linker output
* clang
* Visual Studio -- best guess

## To be supported formats

* clang
* Visual Studio



## Examples

Expand Down
5 changes: 5 additions & 0 deletions gen-xfakes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ isolateUndefinedSymbolsGcc()
grep ": undefined reference to " | sed -e's/^.*\`//' -e"s/'$//"
}

isolateUndefinedSymbolsVS()
{
grep "LNK2019" | sed -e's/^.*symbol //' | sed -e's/^[_"]//' | sed -e's/"* .*//'
}

usage()
{
echo "usage $0 linker-error-output.txt out-file-basename"
Expand Down
12 changes: 12 additions & 0 deletions test-gen-xfakes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ testFilterGccLinkerErrors()
assertEquals 'someGlobal' "$(echo $c_undefined | isolateUndefinedSymbolsGcc)"
}

testFilterVisualStudioLinkerErrors()
{
cpp_function1="blah: LNK2019 blah symbol \"SomeClass::someFunction(Foo&)\" blah blah"
cpp_function2="blah: LNK2019 blah symbol \"someFunction(Foo*)\" blah blah"
cpp_global="blah: LNK2019 blah symbol \"SomeClass::someGlobal\" blah blah"
c_undefined="blah: LNK2019 blah symbol _someGlobal blah blah"
assertEquals 'SomeClass::someFunction(Foo&)' "$(echo $cpp_function1 | isolateUndefinedSymbolsVS)"
assertEquals 'someFunction(Foo*)' "$(echo $cpp_function2 | isolateUndefinedSymbolsVS)"
assertEquals 'SomeClass::someGlobal' "$(echo $cpp_global | isolateUndefinedSymbolsVS)"
assertEquals 'someGlobal' "$(echo $c_undefined | isolateUndefinedSymbolsVS)"
}

testMakeCFake()
{
cpp_function1="SomeClass::someFunction(Foo&)"
Expand Down
28 changes: 27 additions & 1 deletion test/example-vs-link-errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,30 @@
1>states.obj : error LNK2019: unresolved external symbol _errorHalt referenced in function _State_Update
1>states.obj : error LNK2019: unresolved external symbol _Add_double referenced in function _State_Update
1>states.obj : error LNK2019: unresolved external symbol _Get_Digit_UINT32 referenced in function _State_Update_BatchDispense
1>states.obj : error LNK2019: unresolved external symbol _Set_Digit_UINT16 referenced in function _State_Update_BatchDispense
1>states.obj : error LNK2019: unresolved external symbol _Set_Digit_UINT16 referenced in function _State_Update_BatchDispense

Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static double __cdecl vtkLine::DistanceToLine(double * const,double * const,double * const,double &,double * const)" (__imp_?DistanceToLine@vtkLine@@SANQAN00AAN0@Z) referenced in function _main E:\DistancePointToLine\DistancePointToLine.obj DistancePointToLine

Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: static double __cdecl vtkLine::DistanceToLine(double * const,double * const,double * const)" (__imp_?DistanceToLine@vtkLine@@SANQAN00@Z) referenced in function _main E:\DistancePointToLine\DistancePointToLine.obj DistancePointToLine

: error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual signed char __cdecl icu_62::UCharCharacterIterator::hasNext(void)" (__imp_?hasNext@UCharCharacterIterator@icu_62@@UEAACXZ) referenced in function "void __cdecl tensorflow::anonymous namespace'::Encode(enum tensorflow::UnicodeEncoding,class icu_62::UnicodeString const &,class std::basic_string<char,struct std::char_traits,class std::allocator > *)" (?Encode@?A0xb9816742@tensorflow@@YAXW4UnicodeEncoding@2@AEBVUnicodeString@icu_62@@peav?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@z)
unicode_ops.lo.lib(unicode_ops.obj)

: error LNK2019: unresolved external symbol "__declspec(dllimport) public: signed char __cdecl icu_62::ErrorCode::isSuccess(void)const " (_imp?isSuccess@ErrorCode@icu_62@@QEBACXZ) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@z)

unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: enum UErrorCode __cdecl icu_62::ErrorCode::reset(void)" (_imp?reset@ErrorCode@icu_62@@QEAA?AW4UErrorCode@@xz) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@z)

unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) const icu_62::ErrorCode::`vftable'" (_imp??_7ErrorCode@icu_62@@6b@) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@z)icuuc.lib(udata.obj)

: error LNK2019: unresolved external symbol __imp_icudt62_dat referenced in function "struct UDataMemory * __cdecl openCommonData(char const *,int,enum UErrorCode *)" (?openCommonData@@YAPEAUUDataMemory@@PEBDHPEAW4UErrorCode@@@z)

bazel-out/x64_windows-opt/bin/tensorflow/cc/example/example.exe : fatal error LNK1120: 9 unresolved externals
Target //tensorflow/cc/example:example failed to build
INFO: Elapsed time: 19976.467s, Critical Path: 13898.60s
INFO: 1461 processes: 1461 local.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
**



0 comments on commit 8783091

Please sign in to comment.